1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * SPIP, Systeme de publication pour l'internet * |
---|
5 | * * |
---|
6 | * Copyright (c) 2001-2015 * |
---|
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
---|
8 | * * |
---|
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
---|
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
---|
11 | \***************************************************************************/ |
---|
12 | |
---|
13 | if (!defined("_ECRIRE_INC_VERSION")) { |
---|
14 | return; |
---|
15 | } |
---|
16 | |
---|
17 | /** |
---|
18 | * |
---|
19 | * On arrive ici depuis le #FORMULAIRE_RESTAURER |
---|
20 | * - l'initialisation a ete faite avant redirection |
---|
21 | * - on enchaine sur inc/restaurer, qui remplit le dump et renvoie ici a chaque timeout |
---|
22 | * - a chaque coup on relance inc/restaurer |
---|
23 | * - lorsque inc/restaurer a fini, il retourne true |
---|
24 | * - on renvoie vers exec=restaurer pour afficher le resume |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | include_spip('base/dump'); |
---|
29 | include_spip('inc/dump'); |
---|
30 | |
---|
31 | /** |
---|
32 | * Sauvegarder par morceaux |
---|
33 | * |
---|
34 | * @param string $arg |
---|
35 | */ |
---|
36 | function action_restaurer_dist($arg = null) { |
---|
37 | if (!$arg) { |
---|
38 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
---|
39 | $arg = $securiser_action(); |
---|
40 | } |
---|
41 | |
---|
42 | $status_file = $arg; |
---|
43 | define('_DUMP_STATUS_FILE', $status_file); |
---|
44 | $status_file = _DIR_TMP . basename($status_file) . ".txt"; |
---|
45 | if (!lire_fichier($status_file, $status) |
---|
46 | or !$status = unserialize($status) |
---|
47 | ) { |
---|
48 | |
---|
49 | include_spip('inc/headers'); |
---|
50 | echo redirige_formulaire(generer_url_ecrire("restaurer", 'status=' . _DUMP_STATUS_FILE, '', true, true)); |
---|
51 | } else { |
---|
52 | utiliser_langue_visiteur(); |
---|
53 | $archive = "<br />" . joli_repertoire($status['archive']); |
---|
54 | $action = _T('dump:info_restauration_sauvegarde', array('archive' => $archive)); |
---|
55 | $admin = charger_fonction('admin', 'inc'); |
---|
56 | echo $admin('restaurer', $action, "", true); |
---|
57 | } |
---|
58 | |
---|
59 | // forcer l'envoi du buffer par tous les moyens ! |
---|
60 | echo(str_repeat("<br />\r\n", 256)); |
---|
61 | while (@ob_get_level()) { |
---|
62 | @ob_flush(); |
---|
63 | @flush(); |
---|
64 | @ob_end_flush(); |
---|
65 | } |
---|
66 | |
---|
67 | } |
---|