4 |
david |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/***************************************************************************\
|
|
|
4 |
* SPIP, Systeme de publication pour l'internet *
|
|
|
5 |
* *
|
|
|
6 |
* Copyright (c) 2001-2005 *
|
|
|
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 |
|
|
|
14 |
include ("inc_version.php3");
|
|
|
15 |
|
|
|
16 |
include_ecrire ("inc_auth.php3");
|
|
|
17 |
include_ecrire ("inc_export.php3");
|
|
|
18 |
include_ecrire ("inc_admin.php3");
|
|
|
19 |
include_ecrire ("inc_presentation.php3");
|
|
|
20 |
|
|
|
21 |
if (!$archive) {
|
|
|
22 |
if ($gz) $archive = "dump.xml.gz";
|
|
|
23 |
else $archive = "dump.xml";
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
$action = _T('info_exportation_base', array('archive' => $archive));
|
|
|
27 |
|
|
|
28 |
debut_admin($action);
|
|
|
29 |
|
|
|
30 |
$debug_limit = '';
|
|
|
31 |
//$debug_limit = ' LIMIT 0,100';
|
|
|
32 |
if (!$debut_limit) $debut_limit = 0;
|
|
|
33 |
|
|
|
34 |
install_debut_html(_T('info_sauvegarde'));
|
|
|
35 |
|
|
|
36 |
if (!$etape) echo "<p><blockquote><font size=2>"._T('info_sauvegarde_echouee')." <a href='export_all.php3?etape=1&gz=$gz'>"._T('info_procedez_par_etape')."</a></font></blockquote><p>";
|
|
|
37 |
|
|
|
38 |
if ($etape < 2)
|
|
|
39 |
$f = ($gz) ? gzopen(_DIR_SESSIONS . $archive, "wb") : fopen(_DIR_SESSIONS . $archive, "wb");
|
|
|
40 |
else
|
|
|
41 |
$f = ($gz) ? gzopen(_DIR_SESSIONS . $archive, "ab") : fopen(_DIR_SESSIONS . $archive, "ab");
|
|
|
42 |
|
|
|
43 |
if (!$f) {
|
|
|
44 |
echo _T('avis_erreur_sauvegarde', array('type'=>'.', 'id_objet'=>'. .'));
|
|
|
45 |
exit;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
$_fputs = ($gz) ? gzputs : fputs;
|
|
|
49 |
|
|
|
50 |
if ($etape < 2)
|
|
|
51 |
$_fputs($f, "<"."?xml version=\"1.0\" encoding=\"".lire_meta('charset')."\"?".">\n<SPIP version=\"$spip_version_affichee\" version_base=\"$spip_version\" version_archive=\"$version_archive\">\n\n");
|
|
|
52 |
|
|
|
53 |
$query = "SELECT * FROM spip_rubriques";
|
|
|
54 |
export_objets($query, "rubrique", $f, $gz, $etape, 1, _T('info_sauvegarde_rubriques'));
|
|
|
55 |
|
|
|
56 |
$query = "SELECT * FROM spip_auteurs";
|
|
|
57 |
export_objets($query, "auteur", $f, $gz, $etape, 2, _T('info_sauvegarde_auteurs'));
|
|
|
58 |
|
|
|
59 |
$query = "SELECT * FROM spip_articles";
|
|
|
60 |
export_objets($query, "article", $f, $gz, $etape, 3, _T('info_sauvegarde_articles'));
|
|
|
61 |
|
|
|
62 |
$query = "SELECT * FROM spip_types_documents";
|
|
|
63 |
export_objets($query, "type_document", $f, $gz, $etape, 4, _T('info_sauvegarde_type_documents'));
|
|
|
64 |
|
|
|
65 |
$query = "SELECT * FROM spip_documents";
|
|
|
66 |
export_objets($query, "document", $f, $gz, $etape, 5, _T('info_sauvegarde_documents'));
|
|
|
67 |
|
|
|
68 |
$query = "SELECT * FROM spip_mots";
|
|
|
69 |
export_objets($query, "mot", $f, $gz, $etape, 6, _T('info_sauvegarde_mots_cles'));
|
|
|
70 |
|
|
|
71 |
$query = "SELECT * FROM spip_groupes_mots";
|
|
|
72 |
export_objets($query, "groupe_mots", $f, $gz, $etape, 7, _T('info_sauvegarde_groupe_mots'));
|
|
|
73 |
|
|
|
74 |
$query = "SELECT * FROM spip_breves".$debug_limit;
|
|
|
75 |
export_objets($query, "breve", $f, $gz, $etape, 8, _T('info_sauvegarde_breves'));
|
|
|
76 |
|
|
|
77 |
//$query = "SELECT * FROM spip_messages";
|
|
|
78 |
//export_objets($query, "message", $f, $gz, $etape, 9, _T('info_sauvegarde_messages'));
|
|
|
79 |
|
|
|
80 |
$query = "SELECT * FROM spip_forum".$debug_limit;
|
|
|
81 |
export_objets($query, "forum", $f, $gz, $etape, 9, _T('info_sauvegarde_forums'));
|
|
|
82 |
|
|
|
83 |
$query = "SELECT * FROM spip_petitions";
|
|
|
84 |
export_objets($query, "petition", $f, $gz, $etape, 10, _T('info_sauvegarde_petitions'));
|
|
|
85 |
|
|
|
86 |
$query = "SELECT * FROM spip_signatures".$debug_limit;
|
|
|
87 |
export_objets($query, "signature", $f, $gz, $etape, 11, _T('info_sauvegarde_signatures'));
|
|
|
88 |
|
|
|
89 |
$query = "SELECT * FROM spip_syndic";
|
|
|
90 |
export_objets($query, "syndic", $f, $gz, $etape, 12, _T('info_sauvegarde_sites_references'));
|
|
|
91 |
|
|
|
92 |
$query = "SELECT * FROM spip_syndic_articles".$debug_limit;
|
|
|
93 |
export_objets($query, "syndic_article", $f, $gz, $etape, 13, _T('info_sauvegarde_articles_sites_ref'));
|
|
|
94 |
|
|
|
95 |
/*$query = "SELECT * FROM spip_visites".$debug_limit;
|
|
|
96 |
export_objets($query, "spip_visite", $f, $gz, $etape, 14, _T('info_sauvegarde_visites'));
|
|
|
97 |
|
|
|
98 |
$query = "SELECT * FROM spip_referers".$debug_limit;
|
|
|
99 |
export_objets($query, "spip_referers", $f, $gz, $etape, 15, _T('info_sauvegarde_refers'));
|
|
|
100 |
*/
|
|
|
101 |
|
|
|
102 |
if (!$etape OR $etape == 13){
|
|
|
103 |
$_fputs ($f, build_end_tag("SPIP")."\n");
|
|
|
104 |
echo "<p>"._T('info_sauvegarde_reussi_01')."</b><p>"._T('info_sauvegarde_reussi_02', array('archive' => $archive))." <a href='index.php3'>"._T('info_sauvegarde_reussi_03')."</a> "._T('info_sauvegarde_reussi_04')."\n";
|
|
|
105 |
}
|
|
|
106 |
else {
|
|
|
107 |
$etape_suivante = $etape + 1;
|
|
|
108 |
if ($debut_limit > 1) echo "<p align='right'> <a href='export_all.php3?etape=$etape&debut_limit=$debut_limit&gz=$gz'>>>>> "._T('info_etape_suivante')."</a>";
|
|
|
109 |
else echo "<p align='right'> <a href='export_all.php3?etape=$etape_suivante&gz=$gz'>>>>> "._T('info_etape_suivante')."</a>";
|
|
|
110 |
}
|
|
|
111 |
install_fin_html();
|
|
|
112 |
|
|
|
113 |
if ($gz) gzclose($f);
|
|
|
114 |
else fclose($f);
|
|
|
115 |
|
|
|
116 |
if (!$etape OR $etape == 14) fin_admin($action);
|
|
|
117 |
|
|
|
118 |
exit;
|
|
|
119 |
|
|
|
120 |
?>
|