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 |
//
|
|
|
15 |
// Ce fichier ne sera execute qu'une fois
|
|
|
16 |
if (defined("_ECRIRE_INC_MAJBASE")) return;
|
|
|
17 |
define("_ECRIRE_INC_MAJBASE", "1");
|
|
|
18 |
|
|
|
19 |
function maj_version ($version, $test = true) {
|
|
|
20 |
if ($test) {
|
|
|
21 |
include_ecrire('inc_meta.php3');
|
|
|
22 |
ecrire_meta('version_installee', $version);
|
|
|
23 |
ecrire_metas();
|
|
|
24 |
spip_log("mise a jour de la base vers $version");
|
|
|
25 |
} else {
|
|
|
26 |
include_ecrire ('inc_lang.php3');
|
|
|
27 |
echo _T('alerte_maj_impossible', array('version' => $version));
|
|
|
28 |
exit;
|
|
|
29 |
}
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
function maj_base() {
|
|
|
33 |
global $spip_version;
|
|
|
34 |
|
|
|
35 |
//
|
|
|
36 |
// Lecture de la version installee
|
|
|
37 |
//
|
|
|
38 |
// spip_query_db car on est peut-etre en cours d'installation
|
|
|
39 |
$version_installee = 0.0;
|
|
|
40 |
$result = spip_query_db ("SELECT valeur FROM spip_meta WHERE nom='version_installee'");
|
|
|
41 |
if ($result) if ($row = spip_fetch_array($result)) $version_installee = (double) $row['valeur'];
|
|
|
42 |
|
|
|
43 |
//
|
|
|
44 |
// Si pas de version mentionnee dans spip_meta, c'est qu'il s'agit
|
|
|
45 |
// d'une nouvelle installation
|
|
|
46 |
// => ne pas passer par le processus de mise a jour
|
|
|
47 |
//
|
|
|
48 |
// $version_installee = 1.702; quand on a besoin de forcer une MAJ
|
|
|
49 |
|
|
|
50 |
if (!$version_installee) {
|
|
|
51 |
spip_query_db("REPLACE spip_meta (nom, valeur)
|
|
|
52 |
VALUES ('version_installee', '$spip_version')");
|
|
|
53 |
return true;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
//
|
|
|
58 |
// Verification des droits de modification sur la base
|
|
|
59 |
//
|
|
|
60 |
|
|
|
61 |
spip_query("DROP TABLE IF EXISTS spip_test");
|
|
|
62 |
spip_query("CREATE TABLE spip_test (a INT)");
|
|
|
63 |
spip_query("ALTER TABLE spip_test ADD b INT");
|
|
|
64 |
spip_query("INSERT INTO spip_test (b) VALUES (1)");
|
|
|
65 |
$result = spip_query("SELECT b FROM spip_test");
|
|
|
66 |
spip_query("ALTER TABLE spip_test DROP b");
|
|
|
67 |
if (!$result) return false;
|
|
|
68 |
|
|
|
69 |
//
|
|
|
70 |
// Selection en fonction de la version
|
|
|
71 |
//
|
|
|
72 |
if ($version_installee < 0.98) {
|
|
|
73 |
|
|
|
74 |
spip_query("ALTER TABLE spip_articles ADD maj TIMESTAMP");
|
|
|
75 |
spip_query("ALTER TABLE spip_articles ADD export VARCHAR(10) DEFAULT 'oui'");
|
|
|
76 |
spip_query("ALTER TABLE spip_articles ADD images TEXT DEFAULT ''");
|
|
|
77 |
spip_query("ALTER TABLE spip_articles ADD date_redac datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
78 |
spip_query("ALTER TABLE spip_articles DROP INDEX id_article");
|
|
|
79 |
spip_query("ALTER TABLE spip_articles ADD INDEX id_rubrique (id_rubrique)");
|
|
|
80 |
spip_query("ALTER TABLE spip_articles ADD visites INTEGER DEFAULT '0' NOT NULL");
|
|
|
81 |
spip_query("ALTER TABLE spip_articles ADD referers BLOB NOT NULL");
|
|
|
82 |
|
|
|
83 |
spip_query("ALTER TABLE spip_auteurs ADD maj TIMESTAMP");
|
|
|
84 |
spip_query("ALTER TABLE spip_auteurs ADD pgp BLOB NOT NULL");
|
|
|
85 |
|
|
|
86 |
spip_query("ALTER TABLE spip_auteurs_articles ADD INDEX id_auteur (id_auteur), ADD INDEX id_article (id_article)");
|
|
|
87 |
|
|
|
88 |
spip_query("ALTER TABLE spip_rubriques ADD maj TIMESTAMP");
|
|
|
89 |
spip_query("ALTER TABLE spip_rubriques ADD export VARCHAR(10) DEFAULT 'oui', ADD id_import BIGINT DEFAULT '0'");
|
|
|
90 |
|
|
|
91 |
spip_query("ALTER TABLE spip_breves ADD maj TIMESTAMP");
|
|
|
92 |
spip_query("ALTER TABLE spip_breves DROP INDEX id_breve");
|
|
|
93 |
spip_query("ALTER TABLE spip_breves DROP INDEX id_breve_2");
|
|
|
94 |
spip_query("ALTER TABLE spip_breves ADD INDEX id_rubrique (id_rubrique)");
|
|
|
95 |
|
|
|
96 |
spip_query("ALTER TABLE spip_forum ADD ip VARCHAR(16)");
|
|
|
97 |
spip_query("ALTER TABLE spip_forum ADD maj TIMESTAMP");
|
|
|
98 |
spip_query("ALTER TABLE spip_forum DROP INDEX id_forum");
|
|
|
99 |
spip_query("ALTER TABLE spip_forum ADD INDEX id_parent (id_parent), ADD INDEX id_rubrique (id_rubrique), ADD INDEX id_article(id_article), ADD INDEX id_breve(id_breve)");
|
|
|
100 |
maj_version (0.98);
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
if ($version_installee < 0.99) {
|
|
|
104 |
|
|
|
105 |
$query = "SELECT DISTINCT id_article FROM spip_forum WHERE id_article!=0 AND id_parent=0";
|
|
|
106 |
$result = spip_query($query);
|
|
|
107 |
while ($row = spip_fetch_array($result)) {
|
|
|
108 |
unset($forums_article);
|
|
|
109 |
$id_article = $row['id_article'];
|
|
|
110 |
$query2 = "SELECT id_forum FROM spip_forum WHERE id_article=$id_article";
|
|
|
111 |
for (;;) {
|
|
|
112 |
$result2 = spip_query($query2);
|
|
|
113 |
unset($forums);
|
|
|
114 |
while ($row2 = spip_fetch_array($result2)) $forums[] = $row2['id_forum'];
|
|
|
115 |
if (!$forums) break;
|
|
|
116 |
$forums = join(',', $forums);
|
|
|
117 |
$forums_article[] = $forums;
|
|
|
118 |
$query2 = "SELECT id_forum FROM spip_forum WHERE id_parent IN ($forums)";
|
|
|
119 |
}
|
|
|
120 |
$forums_article = join(',', $forums_article);
|
|
|
121 |
$query3 = "UPDATE spip_forum SET id_article=$id_article WHERE id_forum IN ($forums_article)";
|
|
|
122 |
spip_query($query3);
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
$query = "SELECT DISTINCT id_breve FROM spip_forum WHERE id_breve!=0 AND id_parent=0";
|
|
|
126 |
$result = spip_query($query);
|
|
|
127 |
while ($row = spip_fetch_array($result)) {
|
|
|
128 |
unset($forums_breve);
|
|
|
129 |
$id_breve = $row['id_breve'];
|
|
|
130 |
$query2 = "SELECT id_forum FROM spip_forum WHERE id_breve=$id_breve";
|
|
|
131 |
for (;;) {
|
|
|
132 |
$result2 = spip_query($query2);
|
|
|
133 |
unset($forums);
|
|
|
134 |
while ($row2 = spip_fetch_array($result2)) $forums[] = $row2['id_forum'];
|
|
|
135 |
if (!$forums) break;
|
|
|
136 |
$forums = join(',', $forums);
|
|
|
137 |
$forums_breve[] = $forums;
|
|
|
138 |
$query2 = "SELECT id_forum FROM spip_forum WHERE id_parent IN ($forums)";
|
|
|
139 |
}
|
|
|
140 |
$forums_breve = join(',', $forums_breve);
|
|
|
141 |
$query3 = "UPDATE spip_forum SET id_breve=$id_breve WHERE id_forum IN ($forums_breve)";
|
|
|
142 |
spip_query($query3);
|
|
|
143 |
}
|
|
|
144 |
|
|
|
145 |
$query = "SELECT DISTINCT id_rubrique FROM spip_forum WHERE id_rubrique!=0 AND id_parent=0";
|
|
|
146 |
$result = spip_query($query);
|
|
|
147 |
while ($row = spip_fetch_array($result)) {
|
|
|
148 |
unset($forums_rubrique);
|
|
|
149 |
$id_rubrique = $row['id_rubrique'];
|
|
|
150 |
$query2 = "SELECT id_forum FROM spip_forum WHERE id_rubrique=$id_rubrique";
|
|
|
151 |
for (;;) {
|
|
|
152 |
$result2 = spip_query($query2);
|
|
|
153 |
unset($forums);
|
|
|
154 |
while ($row2 = spip_fetch_array($result2)) $forums[] = $row2['id_forum'];
|
|
|
155 |
if (!$forums) break;
|
|
|
156 |
$forums = join(',', $forums);
|
|
|
157 |
$forums_rubrique[] = $forums;
|
|
|
158 |
$query2 = "SELECT id_forum FROM spip_forum WHERE id_parent IN ($forums)";
|
|
|
159 |
}
|
|
|
160 |
$forums_rubrique = join(',', $forums_rubrique);
|
|
|
161 |
$query3 = "UPDATE spip_forum SET id_rubrique=$id_rubrique WHERE id_forum IN ($forums_rubrique)";
|
|
|
162 |
spip_query($query3);
|
|
|
163 |
}
|
|
|
164 |
maj_version (0.99);
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
if ($version_installee < 0.997) {
|
|
|
168 |
spip_query("DROP TABLE spip_index");
|
|
|
169 |
maj_version (0.997);
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
if ($version_installee < 0.999) {
|
|
|
173 |
global $htsalt;
|
|
|
174 |
spip_query("ALTER TABLE spip_auteurs CHANGE pass pass tinyblob NOT NULL");
|
|
|
175 |
spip_query("ALTER TABLE spip_auteurs ADD htpass tinyblob NOT NULL");
|
|
|
176 |
$query = "SELECT id_auteur, pass FROM spip_auteurs WHERE pass!=''";
|
|
|
177 |
$result = spip_query($query);
|
|
|
178 |
while (list($id_auteur, $pass) = spip_fetch_array($result)) {
|
|
|
179 |
$htpass = generer_htpass($pass);
|
|
|
180 |
$pass = md5($pass);
|
|
|
181 |
spip_query("UPDATE spip_auteurs SET pass='$pass', htpass='$htpass' WHERE id_auteur=$id_auteur");
|
|
|
182 |
}
|
|
|
183 |
maj_version (0.999);
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
if ($version_installee < 1.01) {
|
|
|
187 |
spip_query("UPDATE spip_forum SET statut='publie' WHERE statut=''");
|
|
|
188 |
maj_version (1.01);
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
if ($version_installee < 1.02) {
|
|
|
192 |
spip_query("ALTER TABLE spip_forum ADD id_auteur BIGINT DEFAULT '0' NOT NULL");
|
|
|
193 |
maj_version (1.02);
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
if ($version_installee < 1.03) {
|
|
|
197 |
spip_query("DROP TABLE spip_maj");
|
|
|
198 |
maj_version (1.03);
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
if ($version_installee < 1.04) {
|
|
|
202 |
spip_query("ALTER TABLE spip_articles ADD accepter_forum VARCHAR(3)");
|
|
|
203 |
maj_version (1.04);
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
if ($version_installee < 1.05) {
|
|
|
207 |
spip_query("DROP TABLE spip_petition");
|
|
|
208 |
spip_query("DROP TABLE spip_signatures_petition");
|
|
|
209 |
maj_version (1.05);
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
if ($version_installee < 1.1) {
|
|
|
213 |
spip_query("DROP TABLE spip_petition");
|
|
|
214 |
spip_query("DROP TABLE spip_signatures_petition");
|
|
|
215 |
maj_version (1.1);
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
// Correction de l'oubli des modifs creations depuis 1.04
|
|
|
219 |
if ($version_installee < 1.204) {
|
|
|
220 |
spip_query("ALTER TABLE spip_articles ADD accepter_forum VARCHAR(3) NOT NULL");
|
|
|
221 |
spip_query("ALTER TABLE spip_forum ADD id_message bigint(21) NOT NULL");
|
|
|
222 |
spip_query("ALTER TABLE spip_forum ADD INDEX id_message (id_message)");
|
|
|
223 |
spip_query("ALTER TABLE spip_auteurs ADD en_ligne datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
224 |
spip_query("ALTER TABLE spip_auteurs ADD imessage VARCHAR(3) not null");
|
|
|
225 |
spip_query("ALTER TABLE spip_auteurs ADD messagerie VARCHAR(3) not null");
|
|
|
226 |
maj_version (1.204);
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
if ($version_installee < 1.207) {
|
|
|
230 |
spip_query("ALTER TABLE spip_rubriques DROP INDEX id_rubrique");
|
|
|
231 |
spip_query("ALTER TABLE spip_rubriques ADD INDEX id_parent (id_parent)");
|
|
|
232 |
spip_query("ALTER TABLE spip_rubriques ADD statut VARCHAR(10) NOT NULL");
|
|
|
233 |
// Declencher le calcul des rubriques publiques
|
|
|
234 |
spip_query("REPLACE spip_meta (nom, valeur) VALUES ('calculer_rubriques', 'oui')");
|
|
|
235 |
maj_version (1.207);
|
|
|
236 |
}
|
|
|
237 |
|
|
|
238 |
if ($version_installee < 1.208) {
|
|
|
239 |
spip_query("ALTER TABLE spip_auteurs_messages CHANGE forum vu CHAR(3) NOT NULL");
|
|
|
240 |
spip_query("UPDATE spip_auteurs_messages SET vu='oui'");
|
|
|
241 |
spip_query("UPDATE spip_auteurs_messages SET vu='non' WHERE statut='a'");
|
|
|
242 |
|
|
|
243 |
spip_query("ALTER TABLE spip_messages ADD id_auteur bigint(21) NOT NULL");
|
|
|
244 |
spip_query("ALTER TABLE spip_messages ADD INDEX id_auteur (id_auteur)");
|
|
|
245 |
$result = spip_query("SELECT id_auteur, id_message FROM spip_auteurs_messages WHERE statut='de'");
|
|
|
246 |
while ($row = spip_fetch_array($result)) {
|
|
|
247 |
$id_auteur = $row['id_auteur'];
|
|
|
248 |
$id_message = $row['id_message'];
|
|
|
249 |
spip_query("UPDATE spip_messages SET id_auteur=$id_auteur WHERE id_message=$id_message");
|
|
|
250 |
}
|
|
|
251 |
|
|
|
252 |
spip_query("ALTER TABLE spip_auteurs_messages DROP statut");
|
|
|
253 |
maj_version (1.208);
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
if ($version_installee < 1.209) {
|
|
|
257 |
spip_query("ALTER TABLE spip_syndic ADD maj TIMESTAMP");
|
|
|
258 |
spip_query("ALTER TABLE spip_syndic_articles ADD maj TIMESTAMP");
|
|
|
259 |
spip_query("ALTER TABLE spip_messages ADD maj TIMESTAMP");
|
|
|
260 |
maj_version (1.209);
|
|
|
261 |
}
|
|
|
262 |
|
|
|
263 |
if ($version_installee < 1.210) {
|
|
|
264 |
spip_query("ALTER TABLE spip_messages DROP page");
|
|
|
265 |
|
|
|
266 |
stripslashes_base('spip_articles', array('surtitre', 'titre', 'soustitre', 'descriptif', 'chapo', 'texte', 'ps'));
|
|
|
267 |
stripslashes_base('spip_auteurs', array('nom', 'bio', 'nom_site'));
|
|
|
268 |
stripslashes_base('spip_breves', array('titre', 'texte', 'lien_titre'));
|
|
|
269 |
stripslashes_base('spip_forum', array('titre', 'texte', 'auteur', 'nom_site'));
|
|
|
270 |
stripslashes_base('spip_messages', array('titre', 'texte'));
|
|
|
271 |
stripslashes_base('spip_mots', array('type', 'titre', 'descriptif', 'texte'));
|
|
|
272 |
stripslashes_base('spip_petitions', array('texte'));
|
|
|
273 |
stripslashes_base('spip_rubriques', array('titre', 'descriptif', 'texte'));
|
|
|
274 |
stripslashes_base('spip_signatures', array('nom_email', 'nom_site', 'message'));
|
|
|
275 |
stripslashes_base('spip_syndic', array('nom_site', 'descriptif'));
|
|
|
276 |
stripslashes_base('spip_syndic_articles', array('titre', 'lesauteurs'));
|
|
|
277 |
maj_version (1.210);
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
if ($version_installee < 1.3) {
|
|
|
281 |
// Modifier la syndication (pour liste de sites)
|
|
|
282 |
spip_query("ALTER TABLE spip_syndic ADD syndication VARCHAR(3) NOT NULL");
|
|
|
283 |
spip_query("ALTER TABLE spip_syndic ADD statut VARCHAR(10) NOT NULL");
|
|
|
284 |
spip_query("ALTER TABLE spip_syndic ADD date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
285 |
spip_query("UPDATE spip_syndic SET syndication='oui', statut='publie', date=NOW()");
|
|
|
286 |
|
|
|
287 |
// Statut pour articles syndication, pour pouvoir desactiver un article
|
|
|
288 |
spip_query("ALTER TABLE spip_syndic_articles ADD statut VARCHAR(10) NOT NULL");
|
|
|
289 |
spip_query("UPDATE spip_syndic_articles SET statut='publie'");
|
|
|
290 |
maj_version (1.3);
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
if ($version_installee < 1.301) {
|
|
|
294 |
spip_query("ALTER TABLE spip_forum ADD id_syndic bigint(21) DEFAULT '0' NOT NULL");
|
|
|
295 |
maj_version (1.301);
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
if ($version_installee < 1.302) {
|
|
|
299 |
# spip_query("ALTER TABLE spip_forum_cache DROP PRIMARY KEY");
|
|
|
300 |
# spip_query("ALTER TABLE spip_forum_cache DROP INDEX fichier");
|
|
|
301 |
# spip_query("ALTER TABLE spip_forum_cache ADD PRIMARY KEY (fichier, id_forum, id_article, id_rubrique, id_breve, id_syndic)");
|
|
|
302 |
spip_query("ALTER TABLE spip_forum ADD INDEX id_syndic (id_syndic)");
|
|
|
303 |
maj_version (1.302);
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
if ($version_installee < 1.303) {
|
|
|
307 |
spip_query("ALTER TABLE spip_rubriques ADD date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
308 |
spip_query("ALTER TABLE spip_syndic ADD date_syndic datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
309 |
spip_query("UPDATE spip_syndic SET date_syndic=date");
|
|
|
310 |
maj_version (1.303);
|
|
|
311 |
}
|
|
|
312 |
|
|
|
313 |
if ($version_installee < 1.306) {
|
|
|
314 |
spip_query("DROP TABLE spip_index_syndic_articles");
|
|
|
315 |
spip_query("ALTER TABLE spip_syndic ADD date_index datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
316 |
spip_query("ALTER TABLE spip_syndic ADD INDEX date_index (date_index)");
|
|
|
317 |
maj_version (1.306);
|
|
|
318 |
}
|
|
|
319 |
|
|
|
320 |
if ($version_installee < 1.307) {
|
|
|
321 |
spip_query("ALTER TABLE spip_syndic_articles ADD descriptif blob NOT NULL");
|
|
|
322 |
maj_version (1.307);
|
|
|
323 |
}
|
|
|
324 |
|
|
|
325 |
if ($version_installee < 1.404) {
|
|
|
326 |
spip_query("UPDATE spip_mots SET type='Mots sans groupe...' WHERE type=''");
|
|
|
327 |
|
|
|
328 |
$result = spip_query("SELECT * FROM spip_mots GROUP BY type");
|
|
|
329 |
while($row = spip_fetch_array($result)) {
|
|
|
330 |
$type = addslashes($row['type']);
|
|
|
331 |
spip_query("INSERT INTO spip_groupes_mots
|
|
|
332 |
(titre, unseul, obligatoire, articles, breves, rubriques, syndic, 0minirezo, 1comite, 6forum)
|
|
|
333 |
VALUES (\"$type\", 'non', 'non', 'oui', 'oui', 'non', 'oui', 'oui', 'oui', 'non')");
|
|
|
334 |
}
|
|
|
335 |
spip_query("DELETE FROM spip_mots WHERE titre='kawax'");
|
|
|
336 |
maj_version (1.404);
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
if ($version_installee < 1.405) {
|
|
|
340 |
spip_query("ALTER TABLE spip_mots ADD id_groupe bigint(21) NOT NULL");
|
|
|
341 |
|
|
|
342 |
$result = spip_query("SELECT * FROM spip_groupes_mots");
|
|
|
343 |
while($row = spip_fetch_array($result)) {
|
|
|
344 |
$id_groupe = addslashes($row['id_groupe']);
|
|
|
345 |
$type = addslashes($row['titre']);
|
|
|
346 |
spip_query("UPDATE spip_mots SET id_groupe = '$id_groupe' WHERE type='$type'");
|
|
|
347 |
}
|
|
|
348 |
maj_version (1.405);
|
|
|
349 |
}
|
|
|
350 |
|
|
|
351 |
if ($version_installee < 1.408) {
|
|
|
352 |
// Images articles passent dans spip_documents
|
|
|
353 |
$query = "SELECT id_article, images FROM spip_articles WHERE LENGTH(images) > 0";
|
|
|
354 |
$result = spip_query($query);
|
|
|
355 |
|
|
|
356 |
$types = array('jpg' => 1, 'png' => 2, 'gif' => 3);
|
|
|
357 |
|
|
|
358 |
while ($row = @spip_fetch_array($result)) {
|
|
|
359 |
$id_article = $row['id_article'];
|
|
|
360 |
$images = $row['images'];
|
|
|
361 |
$images = explode(",", $images);
|
|
|
362 |
reset($images);
|
|
|
363 |
$replace = '_orig_';
|
|
|
364 |
while (list (, $val) = each($images)) {
|
|
|
365 |
$image = explode("|", $val);
|
|
|
366 |
$fichier = $image[0];
|
|
|
367 |
$largeur = $image[1];
|
|
|
368 |
$hauteur = $image[2];
|
|
|
369 |
ereg("-([0-9]+)\.(gif|jpg|png)$", $fichier, $match);
|
|
|
370 |
$id_type = intval($types[$match[2]]);
|
|
|
371 |
$num_img = $match[1];
|
|
|
372 |
$fichier = _DIR_IMG . $fichier;
|
|
|
373 |
$taille = @filesize($fichier);
|
|
|
374 |
$fichier = substr('../', '', $fichier);
|
|
|
375 |
$id_document = spip_abstract_insert("spip_documents",
|
|
|
376 |
"(titre, id_type, fichier, mode, largeur, hauteur, taille)",
|
|
|
377 |
"('image $largeur x $hauteur', $id_type, '$fichier', 'vignette', '$largeur', '$hauteur', '$taille')");
|
|
|
378 |
|
|
|
379 |
if ($id_document > 0) {
|
|
|
380 |
spip_query("INSERT INTO spip_documents_articles (id_document, id_article) VALUES ($id_document, $id_article)");
|
|
|
381 |
$replace = "REPLACE($replace, '<IMG$num_img|', '<IM_$id_document|')";
|
|
|
382 |
} else {
|
|
|
383 |
echo _T('texte_erreur_mise_niveau_base', array('fichier' => $fichier, 'id_article' => $id_article));
|
|
|
384 |
exit;
|
|
|
385 |
}
|
|
|
386 |
}
|
|
|
387 |
$replace = "REPLACE($replace, '<IM_', '<IMG')";
|
|
|
388 |
$replace_chapo = ereg_replace('_orig_', 'chapo', $replace);
|
|
|
389 |
$replace_descriptif = ereg_replace('_orig_', 'descriptif', $replace);
|
|
|
390 |
$replace_texte = ereg_replace('_orig_', 'texte', $replace);
|
|
|
391 |
$replace_ps = ereg_replace('_orig_', 'ps', $replace);
|
|
|
392 |
$query = "UPDATE spip_articles ".
|
|
|
393 |
"SET chapo=$replace_chapo, descriptif=$replace_descriptif, texte=$replace_texte, ps=$replace_ps ".
|
|
|
394 |
"WHERE id_article=$id_article";
|
|
|
395 |
spip_query($query);
|
|
|
396 |
}
|
|
|
397 |
spip_query("ALTER TABLE spip_articles DROP images");
|
|
|
398 |
maj_version (1.408);
|
|
|
399 |
}
|
|
|
400 |
|
|
|
401 |
if ($version_installee < 1.414) {
|
|
|
402 |
// Forum par defaut "en dur" dans les spip_articles
|
|
|
403 |
// -> non, prio (priori), pos (posteriori), abo (abonnement)
|
|
|
404 |
include_ecrire ("inc_meta.php3");
|
|
|
405 |
$accepter_forum = substr(lire_meta("forums_publics"),0,3) ;
|
|
|
406 |
$query = "ALTER TABLE spip_articles CHANGE accepter_forum accepter_forum CHAR(3) NOT NULL";
|
|
|
407 |
$result = spip_query($query);
|
|
|
408 |
$query = "UPDATE spip_articles SET accepter_forum='$accepter_forum' WHERE accepter_forum != 'non'";
|
|
|
409 |
$result = spip_query($query);
|
|
|
410 |
maj_version (1.414);
|
|
|
411 |
}
|
|
|
412 |
|
|
|
413 |
/*
|
|
|
414 |
if ($version_installee == 1.415) {
|
|
|
415 |
spip_query("ALTER TABLE spip_documents DROP inclus");
|
|
|
416 |
maj_version (1.415);
|
|
|
417 |
}
|
|
|
418 |
*/
|
|
|
419 |
|
|
|
420 |
if ($version_installee < 1.417) {
|
|
|
421 |
spip_query("ALTER TABLE spip_syndic_articles DROP date_index");
|
|
|
422 |
maj_version (1.417);
|
|
|
423 |
}
|
|
|
424 |
|
|
|
425 |
if ($version_installee < 1.418) {
|
|
|
426 |
$query = "SELECT * FROM spip_auteurs WHERE statut = '0minirezo' AND email != '' ORDER BY id_auteur LIMIT 0,1";
|
|
|
427 |
$result = spip_query($query);
|
|
|
428 |
if ($webmaster = spip_fetch_array($result)) {
|
|
|
429 |
include_ecrire("inc_meta.php3");
|
|
|
430 |
ecrire_meta('email_webmaster', $webmaster['email']);
|
|
|
431 |
ecrire_metas();
|
|
|
432 |
}
|
|
|
433 |
maj_version (1.418);
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
if ($version_installee < 1.419) {
|
|
|
437 |
$query = "ALTER TABLE spip_auteurs ADD alea_actuel TINYTEXT DEFAULT ''";
|
|
|
438 |
spip_query($query);
|
|
|
439 |
$query = "ALTER TABLE spip_auteurs ADD alea_futur TINYTEXT DEFAULT ''";
|
|
|
440 |
spip_query($query);
|
|
|
441 |
$query = "UPDATE spip_auteurs SET alea_futur = FLOOR(32000*RAND())";
|
|
|
442 |
spip_query($query);
|
|
|
443 |
maj_version (1.419);
|
|
|
444 |
}
|
|
|
445 |
|
|
|
446 |
if ($version_installee < 1.420) {
|
|
|
447 |
$query = "UPDATE spip_auteurs SET alea_actuel='' WHERE statut='nouveau'";
|
|
|
448 |
spip_query($query);
|
|
|
449 |
maj_version (1.420);
|
|
|
450 |
}
|
|
|
451 |
|
|
|
452 |
if ($version_installee < 1.421) {
|
|
|
453 |
$query = "ALTER TABLE spip_articles ADD auteur_modif bigint(21) DEFAULT '0' NOT NULL";
|
|
|
454 |
spip_query($query);
|
|
|
455 |
$query = "ALTER TABLE spip_articles ADD date_modif datetime DEFAULT '0000-00-00 00:00:00' NOT NULL";
|
|
|
456 |
spip_query($query);
|
|
|
457 |
maj_version (1.421);
|
|
|
458 |
}
|
|
|
459 |
|
|
|
460 |
if ($version_installee < 1.432) {
|
|
|
461 |
spip_query("ALTER TABLE spip_articles DROP referers");
|
|
|
462 |
$query = "ALTER TABLE spip_articles ADD referers INTEGER DEFAULT '0' NOT NULL";
|
|
|
463 |
spip_query($query);
|
|
|
464 |
$query = "ALTER TABLE spip_articles ADD popularite INTEGER DEFAULT '0' NOT NULL";
|
|
|
465 |
spip_query($query);
|
|
|
466 |
maj_version (1.432);
|
|
|
467 |
}
|
|
|
468 |
|
|
|
469 |
if ($version_installee < 1.436) {
|
|
|
470 |
$query = "ALTER TABLE spip_documents ADD date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL";
|
|
|
471 |
spip_query($query);
|
|
|
472 |
maj_version (1.436);
|
|
|
473 |
}
|
|
|
474 |
|
|
|
475 |
if ($version_installee < 1.437) {
|
|
|
476 |
spip_query("ALTER TABLE spip_visites ADD maj TIMESTAMP");
|
|
|
477 |
spip_query("ALTER TABLE spip_visites_referers ADD maj TIMESTAMP");
|
|
|
478 |
maj_version (1.437);
|
|
|
479 |
}
|
|
|
480 |
|
|
|
481 |
if ($version_installee < 1.438) {
|
|
|
482 |
spip_query("ALTER TABLE spip_articles ADD INDEX id_secteur (id_secteur)");
|
|
|
483 |
spip_query("ALTER TABLE spip_articles ADD INDEX statut (statut, date)");
|
|
|
484 |
maj_version (1.438);
|
|
|
485 |
}
|
|
|
486 |
|
|
|
487 |
if ($version_installee < 1.439) {
|
|
|
488 |
spip_query("ALTER TABLE spip_syndic ADD INDEX statut (statut, date_syndic)");
|
|
|
489 |
spip_query("ALTER TABLE spip_syndic_articles ADD INDEX statut (statut)");
|
|
|
490 |
spip_query("ALTER TABLE spip_syndic_articles CHANGE url url VARCHAR(255) NOT NULL");
|
|
|
491 |
spip_query("ALTER TABLE spip_syndic_articles ADD INDEX url (url)");
|
|
|
492 |
maj_version (1.439);
|
|
|
493 |
}
|
|
|
494 |
|
|
|
495 |
if ($version_installee < 1.440) {
|
|
|
496 |
spip_query("ALTER TABLE spip_visites_temp CHANGE ip ip INTEGER UNSIGNED NOT NULL");
|
|
|
497 |
maj_version (1.440);
|
|
|
498 |
}
|
|
|
499 |
|
|
|
500 |
if ($version_installee < 1.441) {
|
|
|
501 |
spip_query("ALTER TABLE spip_visites_temp CHANGE date date DATE NOT NULL");
|
|
|
502 |
spip_query("ALTER TABLE spip_visites CHANGE date date DATE NOT NULL");
|
|
|
503 |
spip_query("ALTER TABLE spip_visites_referers CHANGE date date DATE NOT NULL");
|
|
|
504 |
maj_version (1.441);
|
|
|
505 |
}
|
|
|
506 |
|
|
|
507 |
if ($version_installee < 1.442) {
|
|
|
508 |
$query = "ALTER TABLE spip_auteurs ADD prefs TINYTEXT NOT NULL";
|
|
|
509 |
spip_query($query);
|
|
|
510 |
maj_version (1.442);
|
|
|
511 |
}
|
|
|
512 |
|
|
|
513 |
if ($version_installee < 1.443) {
|
|
|
514 |
spip_query("ALTER TABLE spip_auteurs CHANGE login login VARCHAR(255) BINARY NOT NULL");
|
|
|
515 |
spip_query("ALTER TABLE spip_auteurs CHANGE statut statut VARCHAR(255) NOT NULL");
|
|
|
516 |
spip_query("ALTER TABLE spip_auteurs ADD INDEX login (login)");
|
|
|
517 |
spip_query("ALTER TABLE spip_auteurs ADD INDEX statut (statut)");
|
|
|
518 |
maj_version (1.443);
|
|
|
519 |
}
|
|
|
520 |
|
|
|
521 |
if ($version_installee < 1.444) {
|
|
|
522 |
spip_query("ALTER TABLE spip_syndic ADD moderation VARCHAR(3) NOT NULL");
|
|
|
523 |
maj_version (1.444);
|
|
|
524 |
}
|
|
|
525 |
|
|
|
526 |
if ($version_installee < 1.457) {
|
|
|
527 |
spip_query("DROP TABLE spip_visites");
|
|
|
528 |
spip_query("DROP TABLE spip_visites_temp");
|
|
|
529 |
spip_query("DROP TABLE spip_visites_referers");
|
|
|
530 |
creer_base(); // crade, a ameliorer :-((
|
|
|
531 |
maj_version (1.457);
|
|
|
532 |
}
|
|
|
533 |
|
|
|
534 |
if ($version_installee < 1.458) {
|
|
|
535 |
spip_query("ALTER TABLE spip_auteurs ADD cookie_oubli TINYTEXT NOT NULL");
|
|
|
536 |
maj_version (1.458);
|
|
|
537 |
}
|
|
|
538 |
|
|
|
539 |
if ($version_installee < 1.459) {
|
|
|
540 |
$result = spip_query("SELECT type FROM spip_mots GROUP BY type");
|
|
|
541 |
while ($row = spip_fetch_array($result)) {
|
|
|
542 |
$type = addslashes($row['type']);
|
|
|
543 |
$res = spip_query("SELECT * FROM spip_groupes_mots
|
|
|
544 |
WHERE titre='$type'");
|
|
|
545 |
if (spip_num_rows($res) == 0) {
|
|
|
546 |
if ($id_groupe = spip_abstract_insert("spip_groupes_mots",
|
|
|
547 |
"(titre, unseul, obligatoire, articles, breves, rubriques, syndic, 0minirezo, 1comite, 6forum)",
|
|
|
548 |
"('$type', 'non', 'non', 'oui', 'oui', 'non', 'oui', 'oui', 'oui', 'non')"))
|
|
|
549 |
|
|
|
550 |
spip_query("UPDATE spip_mots SET id_groupe = '$id_groupe' WHERE type='$type'");
|
|
|
551 |
}
|
|
|
552 |
}
|
|
|
553 |
spip_query("UPDATE spip_articles SET popularite=0");
|
|
|
554 |
maj_version (1.459);
|
|
|
555 |
}
|
|
|
556 |
|
|
|
557 |
if ($version_installee < 1.460) {
|
|
|
558 |
// remettre les mots dans les groupes dupliques par erreur
|
|
|
559 |
// dans la precedente version du paragraphe de maj 1.459
|
|
|
560 |
// et supprimer ceux-ci
|
|
|
561 |
$result = spip_query("SELECT * FROM spip_groupes_mots ORDER BY id_groupe");
|
|
|
562 |
while ($row = spip_fetch_array($result)) {
|
|
|
563 |
$titre = addslashes($row['titre']);
|
|
|
564 |
if (! $vu[$titre] ) {
|
|
|
565 |
$vu[$titre] = true;
|
|
|
566 |
$id_groupe = $row['id_groupe'];
|
|
|
567 |
spip_query ("UPDATE spip_mots SET id_groupe=$id_groupe WHERE type='$titre'");
|
|
|
568 |
spip_query ("DELETE FROM spip_groupes_mots WHERE titre='$titre' AND id_groupe<>$id_groupe");
|
|
|
569 |
}
|
|
|
570 |
}
|
|
|
571 |
maj_version (1.460);
|
|
|
572 |
}
|
|
|
573 |
|
|
|
574 |
if ($version_installee < 1.462) {
|
|
|
575 |
spip_query("UPDATE spip_types_documents SET inclus='embed' WHERE inclus!='non' AND extension IN ".
|
|
|
576 |
"('aiff', 'asf', 'avi', 'mid', 'mov', 'mp3', 'mpg', 'ogg', 'qt', 'ra', 'ram', 'rm', 'swf', 'wav', 'wmv')");
|
|
|
577 |
maj_version (1.462);
|
|
|
578 |
}
|
|
|
579 |
|
|
|
580 |
if ($version_installee < 1.463) {
|
|
|
581 |
spip_query("ALTER TABLE spip_articles CHANGE popularite popularite DOUBLE");
|
|
|
582 |
spip_query("ALTER TABLE spip_visites_temp ADD maj TIMESTAMP");
|
|
|
583 |
spip_query("ALTER TABLE spip_referers_temp ADD maj TIMESTAMP");
|
|
|
584 |
maj_version (1.463);
|
|
|
585 |
}
|
|
|
586 |
|
|
|
587 |
// l'upgrade < 1.462 ci-dessus etait fausse, d'ou correctif
|
|
|
588 |
if (($version_installee < 1.464) AND ($version_installee >= 1.462)) {
|
|
|
589 |
$res = spip_query("SELECT id_type, extension FROM spip_types_documents WHERE id_type NOT IN (1,2,3)");
|
|
|
590 |
while ($row = spip_fetch_array($res)) {
|
|
|
591 |
$extension = $row['extension'];
|
|
|
592 |
$id_type = $row['id_type'];
|
|
|
593 |
spip_query("UPDATE spip_documents SET id_type=$id_type
|
|
|
594 |
WHERE fichier like '%.$extension'");
|
|
|
595 |
}
|
|
|
596 |
maj_version (1.464);
|
|
|
597 |
}
|
|
|
598 |
|
|
|
599 |
if ($version_installee < 1.465) {
|
|
|
600 |
spip_query("ALTER TABLE spip_articles CHANGE popularite popularite DOUBLE NOT NULL");
|
|
|
601 |
maj_version (1.465);
|
|
|
602 |
}
|
|
|
603 |
|
|
|
604 |
if ($version_installee < 1.466) {
|
|
|
605 |
spip_query("ALTER TABLE spip_auteurs ADD source VARCHAR(10) DEFAULT 'spip' NOT NULL");
|
|
|
606 |
maj_version (1.466);
|
|
|
607 |
}
|
|
|
608 |
|
|
|
609 |
if ($version_installee < 1.468) {
|
|
|
610 |
spip_query("ALTER TABLE spip_auteurs ADD INDEX en_ligne (en_ligne)");
|
|
|
611 |
spip_query("ALTER TABLE spip_forum ADD INDEX statut (statut, date_heure)");
|
|
|
612 |
maj_version (1.468);
|
|
|
613 |
}
|
|
|
614 |
|
|
|
615 |
if ($version_installee < 1.470) {
|
|
|
616 |
if ($version_installee >= 1.467) { // annule les "listes de diff"
|
|
|
617 |
spip_query("DROP TABLE spip_listes");
|
|
|
618 |
spip_query("ALTER TABLE spip_auteurs DROP abonne");
|
|
|
619 |
spip_query("ALTER TABLE spip_auteurs DROP abonne_pass");
|
|
|
620 |
}
|
|
|
621 |
maj_version (1.470);
|
|
|
622 |
}
|
|
|
623 |
|
|
|
624 |
if ($version_installee < 1.471) {
|
|
|
625 |
if ($version_installee >= 1.470) { // annule les "maj"
|
|
|
626 |
spip_query("ALTER TABLE spip_auteurs_articles DROP maj TIMESTAMP");
|
|
|
627 |
spip_query("ALTER TABLE spip_auteurs_rubriques DROP maj TIMESTAMP");
|
|
|
628 |
spip_query("ALTER TABLE spip_auteurs_messages DROP maj TIMESTAMP");
|
|
|
629 |
spip_query("ALTER TABLE spip_documents_articles DROP maj TIMESTAMP");
|
|
|
630 |
spip_query("ALTER TABLE spip_documents_rubriques DROP maj TIMESTAMP");
|
|
|
631 |
spip_query("ALTER TABLE spip_documents_breves DROP maj TIMESTAMP");
|
|
|
632 |
spip_query("ALTER TABLE spip_mots_articles DROP maj TIMESTAMP");
|
|
|
633 |
spip_query("ALTER TABLE spip_mots_breves DROP maj TIMESTAMP");
|
|
|
634 |
spip_query("ALTER TABLE spip_mots_rubriques DROP maj TIMESTAMP");
|
|
|
635 |
spip_query("ALTER TABLE spip_mots_syndic DROP maj TIMESTAMP");
|
|
|
636 |
spip_query("ALTER TABLE spip_mots_forum DROP maj TIMESTAMP");
|
|
|
637 |
}
|
|
|
638 |
maj_version (1.471);
|
|
|
639 |
}
|
|
|
640 |
|
|
|
641 |
if ($version_installee < 1.472) {
|
|
|
642 |
spip_query("ALTER TABLE spip_referers ADD visites_jour INTEGER UNSIGNED NOT NULL");
|
|
|
643 |
maj_version (1.472);
|
|
|
644 |
}
|
|
|
645 |
|
|
|
646 |
if ($version_installee < 1.473) {
|
|
|
647 |
spip_query("UPDATE spip_syndic_articles SET url = REPLACE(url, '&', '&')");
|
|
|
648 |
spip_query("UPDATE spip_syndic SET url_site = REPLACE(url_site, '&', '&')");
|
|
|
649 |
maj_version (1.473);
|
|
|
650 |
}
|
|
|
651 |
|
|
|
652 |
if ($version_installee < 1.600) {
|
|
|
653 |
include_ecrire('inc_index.php3');
|
|
|
654 |
purger_index();
|
|
|
655 |
creer_liste_indexation();
|
|
|
656 |
maj_version (1.600);
|
|
|
657 |
}
|
|
|
658 |
|
|
|
659 |
if ($version_installee < 1.601) {
|
|
|
660 |
spip_query("ALTER TABLE spip_forum ADD INDEX id_syndic (id_syndic)");
|
|
|
661 |
maj_version (1.601);
|
|
|
662 |
}
|
|
|
663 |
|
|
|
664 |
if ($version_installee < 1.603) {
|
|
|
665 |
// supprimer les fichiers deplaces
|
|
|
666 |
@unlink('inc_meta_cache.php3');
|
|
|
667 |
@unlink('data/engines-list.ini');
|
|
|
668 |
maj_version (1.603);
|
|
|
669 |
}
|
|
|
670 |
|
|
|
671 |
if ($version_installee < 1.604) {
|
|
|
672 |
spip_query("ALTER TABLE spip_auteurs ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
|
|
|
673 |
$u = spip_query("SELECT * FROM spip_auteurs WHERE prefs LIKE '%spip_lang%'");
|
|
|
674 |
while ($row = spip_fetch_array($u)) {
|
|
|
675 |
$prefs = unserialize($row['prefs']);
|
|
|
676 |
$l = $prefs['spip_lang'];
|
|
|
677 |
unset ($prefs['spip_lang']);
|
|
|
678 |
spip_query ("UPDATE spip_auteurs SET lang='".addslashes($l)."',
|
|
|
679 |
prefs='".addslashes(serialize($prefs))."'
|
|
|
680 |
WHERE id_auteur=".$row['id_auteur']);
|
|
|
681 |
}
|
|
|
682 |
maj_version (1.604, spip_query("SELECT lang FROM spip_auteurs"));
|
|
|
683 |
}
|
|
|
684 |
|
|
|
685 |
if ($version_installee < 1.702) {
|
|
|
686 |
spip_query("ALTER TABLE spip_articles ADD extra longblob NULL");
|
|
|
687 |
spip_query("ALTER TABLE spip_auteurs ADD extra longblob NULL");
|
|
|
688 |
spip_query("ALTER TABLE spip_breves ADD extra longblob NULL");
|
|
|
689 |
spip_query("ALTER TABLE spip_rubriques ADD extra longblob NULL");
|
|
|
690 |
spip_query("ALTER TABLE spip_mots ADD extra longblob NULL");
|
|
|
691 |
|
|
|
692 |
// recuperer les eventuels 'supplement' installes en 1.701
|
|
|
693 |
if ($version_installee == 1.701) {
|
|
|
694 |
spip_query ("UPDATE spip_articles SET extra = supplement");
|
|
|
695 |
spip_query ("ALTER TABLE spip_articles DROP supplement");
|
|
|
696 |
spip_query ("UPDATE spip_auteurs SET extra = supplement");
|
|
|
697 |
spip_query ("ALTER TABLE spip_auteurs DROP supplement");
|
|
|
698 |
spip_query ("UPDATE spip_breves SET extra = supplement");
|
|
|
699 |
spip_query ("ALTER TABLE spip_breves DROP supplement");
|
|
|
700 |
spip_query ("UPDATE spip_rubriques SET extra = supplement");
|
|
|
701 |
spip_query ("ALTER TABLE spip_rubriques DROP supplement");
|
|
|
702 |
spip_query ("UPDATE spip_mots SET extra = supplement");
|
|
|
703 |
spip_query ("ALTER TABLE spip_mots DROP supplement");
|
|
|
704 |
}
|
|
|
705 |
maj_version (1.702,
|
|
|
706 |
spip_query("SELECT extra FROM spip_articles")
|
|
|
707 |
&& spip_query("SELECT extra FROM spip_auteurs")
|
|
|
708 |
&& spip_query("SELECT extra FROM spip_breves")
|
|
|
709 |
&& spip_query("SELECT extra FROM spip_rubriques")
|
|
|
710 |
&& spip_query("SELECT extra FROM spip_mots")
|
|
|
711 |
);
|
|
|
712 |
}
|
|
|
713 |
|
|
|
714 |
if ($version_installee < 1.703) {
|
|
|
715 |
spip_query("ALTER TABLE spip_articles ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
|
|
|
716 |
spip_query("ALTER TABLE spip_rubriques ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
|
|
|
717 |
maj_version (1.703);
|
|
|
718 |
}
|
|
|
719 |
|
|
|
720 |
if ($version_installee < 1.704) {
|
|
|
721 |
spip_query("ALTER TABLE spip_articles ADD INDEX lang (lang)");
|
|
|
722 |
spip_query("ALTER TABLE spip_auteurs ADD INDEX lang (lang)");
|
|
|
723 |
spip_query("ALTER TABLE spip_rubriques ADD INDEX lang (lang)");
|
|
|
724 |
maj_version (1.704);
|
|
|
725 |
}
|
|
|
726 |
|
|
|
727 |
if ($version_installee < 1.705) {
|
|
|
728 |
spip_query("ALTER TABLE spip_articles ADD langue_choisie VARCHAR(3) DEFAULT 'non'");
|
|
|
729 |
spip_query("ALTER TABLE spip_rubriques ADD langue_choisie VARCHAR(3) DEFAULT 'non'");
|
|
|
730 |
maj_version (1.705);
|
|
|
731 |
}
|
|
|
732 |
|
|
|
733 |
if ($version_installee < 1.707) {
|
|
|
734 |
spip_query("UPDATE spip_articles SET langue_choisie='oui' WHERE MID(lang,1,1) != '.' AND lang != ''");
|
|
|
735 |
spip_query("UPDATE spip_articles SET lang=MID(lang,2,8) WHERE langue_choisie = 'non'");
|
|
|
736 |
spip_query("UPDATE spip_rubriques SET langue_choisie='oui' WHERE MID(lang,1,1) != '.' AND lang != ''");
|
|
|
737 |
spip_query("UPDATE spip_rubriques SET lang=MID(lang,2,8) WHERE langue_choisie = 'non'");
|
|
|
738 |
maj_version (1.707);
|
|
|
739 |
}
|
|
|
740 |
|
|
|
741 |
if ($version_installee < 1.708) {
|
|
|
742 |
spip_query("ALTER TABLE spip_breves ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
|
|
|
743 |
spip_query("ALTER TABLE spip_breves ADD langue_choisie VARCHAR(3) DEFAULT 'non'");
|
|
|
744 |
maj_version (1.708);
|
|
|
745 |
}
|
|
|
746 |
|
|
|
747 |
if ($version_installee < 1.709) {
|
|
|
748 |
spip_query("ALTER TABLE spip_articles ADD id_trad bigint(21) DEFAULT '0' NOT NULL");
|
|
|
749 |
spip_query("ALTER TABLE spip_articles ADD INDEX id_trad (id_trad)");
|
|
|
750 |
maj_version (1.709);
|
|
|
751 |
}
|
|
|
752 |
|
|
|
753 |
if ($version_installee < 1.717) {
|
|
|
754 |
spip_query("ALTER TABLE spip_articles ADD INDEX date_modif (date_modif)");
|
|
|
755 |
maj_version (1.717);
|
|
|
756 |
}
|
|
|
757 |
|
|
|
758 |
if ($version_installee < 1.718) {
|
|
|
759 |
spip_query("ALTER TABLE spip_referers DROP domaine");
|
|
|
760 |
spip_query("ALTER TABLE spip_referers_articles DROP domaine");
|
|
|
761 |
spip_query("ALTER TABLE spip_referers_temp DROP domaine");
|
|
|
762 |
maj_version (1.718);
|
|
|
763 |
}
|
|
|
764 |
|
|
|
765 |
if ($version_installee < 1.722) {
|
|
|
766 |
spip_query("ALTER TABLE spip_articles ADD nom_site tinytext NOT NULL");
|
|
|
767 |
spip_query("ALTER TABLE spip_articles ADD url_site VARCHAR(255) NOT NULL");
|
|
|
768 |
spip_query("ALTER TABLE spip_articles ADD INDEX url_site (url_site)");
|
|
|
769 |
if ($version_installee >= 1.720) {
|
|
|
770 |
spip_query("UPDATE spip_articles SET url_site=url_ref");
|
|
|
771 |
spip_query("ALTER TABLE spip_articles DROP INDEX url_ref");
|
|
|
772 |
spip_query("ALTER TABLE spip_articles DROP url_ref");
|
|
|
773 |
}
|
|
|
774 |
maj_version (1.722);
|
|
|
775 |
}
|
|
|
776 |
|
|
|
777 |
if ($version_installee < 1.723) {
|
|
|
778 |
if ($version_installee == 1.722) {
|
|
|
779 |
spip_query("ALTER TABLE spip_articles MODIFY url_site VARCHAR(255) NOT NULL");
|
|
|
780 |
spip_query("ALTER TABLE spip_articles DROP INDEX url_site;");
|
|
|
781 |
spip_query("ALTER TABLE spip_articles ADD INDEX url_site (url_site);");
|
|
|
782 |
}
|
|
|
783 |
maj_version (1.723);
|
|
|
784 |
}
|
|
|
785 |
|
|
|
786 |
if ($version_installee < 1.724) {
|
|
|
787 |
spip_query("ALTER TABLE spip_messages ADD date_fin datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
788 |
maj_version (1.724);
|
|
|
789 |
}
|
|
|
790 |
|
|
|
791 |
if ($version_installee < 1.726) {
|
|
|
792 |
spip_query("ALTER TABLE spip_auteurs ADD low_sec tinytext NOT NULL");
|
|
|
793 |
maj_version (1.726);
|
|
|
794 |
}
|
|
|
795 |
|
|
|
796 |
if ($version_installee < 1.727) {
|
|
|
797 |
// occitans : oci_xx -> oc_xx
|
|
|
798 |
spip_query("UPDATE spip_auteurs SET lang=REPLACE(lang,'oci_', 'oc_') WHERE lang LIKE 'oci_%'");
|
|
|
799 |
spip_query("UPDATE spip_rubriques SET lang=REPLACE(lang,'oci_', 'oc_') WHERE lang LIKE 'oci_%'");
|
|
|
800 |
spip_query("UPDATE spip_articles SET lang=REPLACE(lang,'oci_', 'oc_') WHERE lang LIKE 'oci_%'");
|
|
|
801 |
spip_query("UPDATE spip_breves SET lang=REPLACE(lang,'oci_', 'oc_') WHERE lang LIKE 'oci_%'");
|
|
|
802 |
maj_version (1.727);
|
|
|
803 |
}
|
|
|
804 |
|
|
|
805 |
// Ici version 1.7 officielle
|
|
|
806 |
|
|
|
807 |
if ($version_installee < 1.728) {
|
|
|
808 |
spip_query("ALTER TABLE spip_articles ADD id_version int unsigned DEFAULT '0' NOT NULL");
|
|
|
809 |
maj_version (1.728);
|
|
|
810 |
}
|
|
|
811 |
|
|
|
812 |
if ($version_installee < 1.730) {
|
|
|
813 |
spip_query("ALTER TABLE spip_articles ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
814 |
spip_query("ALTER TABLE spip_articles ADD INDEX idx (idx)");
|
|
|
815 |
spip_query("ALTER TABLE spip_auteurs ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
816 |
spip_query("ALTER TABLE spip_auteurs ADD INDEX idx (idx)");
|
|
|
817 |
spip_query("ALTER TABLE spip_breves ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
818 |
spip_query("ALTER TABLE spip_breves ADD INDEX idx (idx)");
|
|
|
819 |
spip_query("ALTER TABLE spip_mots ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
820 |
spip_query("ALTER TABLE spip_mots ADD INDEX idx (idx)");
|
|
|
821 |
spip_query("ALTER TABLE spip_rubriques ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
822 |
spip_query("ALTER TABLE spip_rubriques ADD INDEX idx (idx)");
|
|
|
823 |
spip_query("ALTER TABLE spip_syndic ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
824 |
spip_query("ALTER TABLE spip_syndic ADD INDEX idx (idx)");
|
|
|
825 |
spip_query("ALTER TABLE spip_forum ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
826 |
spip_query("ALTER TABLE spip_forum ADD ADD INDEX idx (idx)");
|
|
|
827 |
spip_query("ALTER TABLE spip_signatures ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
828 |
spip_query("ALTER TABLE spip_signatures ADD INDEX idx (idx)");
|
|
|
829 |
maj_version (1.730);
|
|
|
830 |
}
|
|
|
831 |
|
|
|
832 |
if ($version_installee < 1.731) { // reindexer les docs allemands et vietnamiens
|
|
|
833 |
spip_query("UPDATE spip_articles SET idx='1' where lang IN ('de','vi')");
|
|
|
834 |
spip_query("UPDATE spip_rubriques SET idx='1' where lang IN ('de','vi')");
|
|
|
835 |
spip_query("UPDATE spip_breves SET idx='1' where lang IN ('de','vi')");
|
|
|
836 |
spip_query("UPDATE spip_auteurs SET idx='1' where lang IN ('de','vi')");
|
|
|
837 |
maj_version (1.731);
|
|
|
838 |
}
|
|
|
839 |
|
|
|
840 |
if ($version_installee < 1.732) { // en correction d'un vieux truc qui avait fait sauter le champ inclus sur les bases version 1.415
|
|
|
841 |
spip_query ("ALTER TABLE spip_documents ADD inclus VARCHAR(3) DEFAULT 'non'");
|
|
|
842 |
maj_version (1.732);
|
|
|
843 |
}
|
|
|
844 |
|
|
|
845 |
if ($version_installee < 1.733) {
|
|
|
846 |
// spip_query("ALTER TABLE spip_articles ADD id_version int unsigned DEFAULT '0' NOT NULL");
|
|
|
847 |
spip_query("DROP TABLE spip_versions");
|
|
|
848 |
spip_query("DROP TABLE spip_versions_fragments");
|
|
|
849 |
creer_base();
|
|
|
850 |
maj_version(1.733);
|
|
|
851 |
}
|
|
|
852 |
|
|
|
853 |
#if ($version_installee < 1.734) {
|
|
|
854 |
# // integrer nouvelles tables auxiliaires du compilateur ESJ
|
|
|
855 |
# creer_base();
|
|
|
856 |
# maj_version(1.734);
|
|
|
857 |
#}
|
|
|
858 |
|
|
|
859 |
if ($version_installee < 1.801) {
|
|
|
860 |
spip_query("ALTER TABLE spip_rubriques
|
|
|
861 |
ADD statut_tmp VARCHAR(10) NOT NULL,
|
|
|
862 |
ADD date_tmp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
|
|
|
863 |
include_ecrire('inc_rubriques.php3');
|
|
|
864 |
calculer_rubriques();
|
|
|
865 |
maj_version(1.801);
|
|
|
866 |
}
|
|
|
867 |
|
|
|
868 |
// Nouvelles tables d'invalidation
|
|
|
869 |
if ($version_installee < 1.802) {
|
|
|
870 |
spip_query("DROP TABLE spip_id_article_caches");
|
|
|
871 |
spip_query("DROP TABLE spip_id_auteur_caches");
|
|
|
872 |
spip_query("DROP TABLE spip_id_breve_caches");
|
|
|
873 |
spip_query("DROP TABLE spip_id_document_caches");
|
|
|
874 |
spip_query("DROP TABLE spip_id_forum_caches");
|
|
|
875 |
spip_query("DROP TABLE spip_id_groupe_caches");
|
|
|
876 |
spip_query("DROP TABLE spip_id_message_caches");
|
|
|
877 |
spip_query("DROP TABLE spip_id_mot_caches");
|
|
|
878 |
spip_query("DROP TABLE spip_id_rubrique_caches");
|
|
|
879 |
spip_query("DROP TABLE spip_id_signature_caches");
|
|
|
880 |
spip_query("DROP TABLE spip_id_syndic_article_caches");
|
|
|
881 |
spip_query("DROP TABLE spip_id_syndic_caches");
|
|
|
882 |
spip_query("DROP TABLE spip_id_type_caches");
|
|
|
883 |
spip_query("DROP TABLE spip_inclure_caches");
|
|
|
884 |
maj_version(1.802);
|
|
|
885 |
}
|
|
|
886 |
if ($version_installee < 1.803) {
|
|
|
887 |
|
|
|
888 |
# 27 AOUT 2004 : conservons cette table pour autoriser les retours
|
|
|
889 |
# de SPIP 1.8a6 CVS vers 1.7.2
|
|
|
890 |
# spip_query("DROP TABLE spip_forum_cache");
|
|
|
891 |
|
|
|
892 |
spip_query("DROP TABLE spip_inclure_caches");
|
|
|
893 |
maj_version(1.803);
|
|
|
894 |
}
|
|
|
895 |
if ($version_installee < 1.804) {
|
|
|
896 |
// recreer la table spip_caches
|
|
|
897 |
spip_query("DROP TABLE spip_caches");
|
|
|
898 |
creer_base();
|
|
|
899 |
maj_version(1.804);
|
|
|
900 |
}
|
|
|
901 |
|
|
|
902 |
if ($version_installee < 1.805) {
|
|
|
903 |
spip_query("ALTER TABLE spip_forum
|
|
|
904 |
ADD id_thread bigint(21) DEFAULT '0' NOT NULL");
|
|
|
905 |
include_ecrire('inc_forum.php3');
|
|
|
906 |
calculer_threads();
|
|
|
907 |
maj_version(1.805);
|
|
|
908 |
}
|
|
|
909 |
|
|
|
910 |
// tables d'orthographe
|
|
|
911 |
#if ($version_installee < 1.806)
|
|
|
912 |
# maj_version(1.806);
|
|
|
913 |
|
|
|
914 |
// URLs propres (lab_version = 0.12)
|
|
|
915 |
if ($version_installee < 1.807) {
|
|
|
916 |
foreach (array('articles', 'breves', 'rubriques', 'mots') as $objets) {
|
|
|
917 |
spip_query("ALTER TABLE spip_$objets
|
|
|
918 |
ADD url_propre VARCHAR(255) NOT NULL");
|
|
|
919 |
spip_query("ALTER TABLE spip_$objets
|
|
|
920 |
ADD INDEX url_propre (url_propre)");
|
|
|
921 |
}
|
|
|
922 |
maj_version(1.807);
|
|
|
923 |
}
|
|
|
924 |
|
|
|
925 |
// referers de la veille
|
|
|
926 |
if ($version_installee < 1.808) {
|
|
|
927 |
spip_query("ALTER TABLE spip_referers
|
|
|
928 |
ADD visites_veille INT UNSIGNED NOT NULL");
|
|
|
929 |
maj_version(1.808);
|
|
|
930 |
}
|
|
|
931 |
|
|
|
932 |
|
|
|
933 |
// corrections diverses
|
|
|
934 |
if ($version_installee < 1.809) {
|
|
|
935 |
// plus de retour possible vers 1.7.2
|
|
|
936 |
spip_query("DROP TABLE spip_forum_cache");
|
|
|
937 |
|
|
|
938 |
// les requetes ci-dessous ne s'appliqueront que si on est passe
|
|
|
939 |
// par une certaine version de developpement - oublie de le faire
|
|
|
940 |
// plus tot, car le code d'alors recreait purement et simplement
|
|
|
941 |
// cette table
|
|
|
942 |
spip_query("ALTER TABLE spip_versions DROP chapo");
|
|
|
943 |
spip_query("ALTER TABLE spip_versions DROP texte");
|
|
|
944 |
spip_query("ALTER TABLE spip_versions DROP ps");
|
|
|
945 |
spip_query("ALTER TABLE spip_versions DROP extra");
|
|
|
946 |
spip_query("ALTER TABLE spip_versions ADD champs text NOT NULL");
|
|
|
947 |
|
|
|
948 |
maj_version(1.809);
|
|
|
949 |
}
|
|
|
950 |
|
|
|
951 |
// Annuler les brouillons de forum jamais valides
|
|
|
952 |
if ($version_installee < 1.810) {
|
|
|
953 |
spip_query("DELETE FROM spip_forum WHERE statut='redac'");
|
|
|
954 |
maj_version(1.810);
|
|
|
955 |
}
|
|
|
956 |
|
|
|
957 |
if ($version_installee < 1.811) {
|
|
|
958 |
spip_query("ALTER TABLE spip_syndic ADD extra longblob NULL");
|
|
|
959 |
maj_version(1.811);
|
|
|
960 |
}
|
|
|
961 |
|
|
|
962 |
if ($version_installee < 1.812) {
|
|
|
963 |
spip_query("ALTER TABLE spip_documents
|
|
|
964 |
ADD idx ENUM('', '1', 'non', 'oui', 'idx') DEFAULT '' NOT NULL");
|
|
|
965 |
maj_version(1.812);
|
|
|
966 |
}
|
|
|
967 |
|
|
|
968 |
// Mise a jour des types MIME
|
|
|
969 |
if ($version_installee < 1.813) {
|
|
|
970 |
# rien a faire car c'est creer_base() qui s'en charge
|
|
|
971 |
maj_version(1.813);
|
|
|
972 |
}
|
|
|
973 |
|
|
|
974 |
// URLs propres auteurs (et prevoir les sites, sait-on jamais)
|
|
|
975 |
if ($version_installee < 1.814) {
|
|
|
976 |
foreach (array('auteurs', 'syndic') as $objets) {
|
|
|
977 |
spip_query("ALTER TABLE spip_$objets
|
|
|
978 |
ADD url_propre VARCHAR(255) NOT NULL");
|
|
|
979 |
spip_query("ALTER TABLE spip_$objets
|
|
|
980 |
ADD INDEX url_propre (url_propre)");
|
|
|
981 |
}
|
|
|
982 |
maj_version(1.814);
|
|
|
983 |
}
|
|
|
984 |
|
|
|
985 |
// Mots-cles sur les documents
|
|
|
986 |
// + liens documents <-> sites et articles syndiques (podcasting)
|
|
|
987 |
if ($version_installee < 1.815) {
|
|
|
988 |
spip_query("ALTER TABLE spip_documents
|
|
|
989 |
ADD distant VARCHAR(3) DEFAULT 'non'");
|
|
|
990 |
maj_version(1.815);
|
|
|
991 |
}
|
|
|
992 |
|
|
|
993 |
// Indexation des documents (rien a faire sauf reinstaller inc_auxbase)
|
|
|
994 |
if ($version_installee < 1.816) {
|
|
|
995 |
maj_version(1.816);
|
|
|
996 |
}
|
|
|
997 |
|
|
|
998 |
// Texte et descriptif des groupes de mots-cles
|
|
|
999 |
if ($version_installee < 1.817) {
|
|
|
1000 |
spip_query("ALTER TABLE spip_groupes_mots
|
|
|
1001 |
ADD descriptif text NOT NULL AFTER titre");
|
|
|
1002 |
spip_query("ALTER TABLE spip_groupes_mots
|
|
|
1003 |
ADD COLUMN texte longblob NOT NULL AFTER descriptif");
|
|
|
1004 |
maj_version(1.817);
|
|
|
1005 |
}
|
|
|
1006 |
|
|
|
1007 |
// Conformite des noms de certains champs (0minirezo => minirezo)
|
|
|
1008 |
if ($version_installee < 1.818) {
|
|
|
1009 |
spip_query("ALTER TABLE spip_groupes_mots CHANGE COLUMN 0minirezo minirezo char(3) NOT NULL");
|
|
|
1010 |
spip_query("ALTER TABLE spip_groupes_mots CHANGE COLUMN 1comite comite char(3) NOT NULL");
|
|
|
1011 |
spip_query("ALTER TABLE spip_groupes_mots CHANGE COLUMN 6forum forum char(3) NOT NULL");
|
|
|
1012 |
maj_version(1.818);
|
|
|
1013 |
}
|
|
|
1014 |
|
|
|
1015 |
// Options de syndication : miroir + oubli
|
|
|
1016 |
if ($version_installee < 1.819) {
|
|
|
1017 |
spip_query("ALTER TABLE spip_syndic
|
|
|
1018 |
ADD miroir VARCHAR(3) DEFAULT 'non'");
|
|
|
1019 |
spip_query("ALTER TABLE spip_syndic
|
|
|
1020 |
ADD oubli VARCHAR(3) DEFAULT 'non'");
|
|
|
1021 |
maj_version(1.819);
|
|
|
1022 |
}
|
|
|
1023 |
|
|
|
1024 |
// Un bug dans les 1.730 (il manquait le "ADD")
|
|
|
1025 |
if ($version_installee < 1.820) {
|
|
|
1026 |
spip_query("ALTER TABLE spip_articles ADD INDEX idx (idx)");
|
|
|
1027 |
spip_query("ALTER TABLE spip_auteurs ADD INDEX idx (idx)");
|
|
|
1028 |
spip_query("ALTER TABLE spip_breves ADD INDEX idx (idx)");
|
|
|
1029 |
spip_query("ALTER TABLE spip_mots ADD INDEX idx (idx)");
|
|
|
1030 |
spip_query("ALTER TABLE spip_rubriques ADD INDEX idx (idx)");
|
|
|
1031 |
spip_query("ALTER TABLE spip_syndic ADD INDEX idx (idx)");
|
|
|
1032 |
spip_query("ALTER TABLE spip_forum ADD ADD INDEX idx (idx)");
|
|
|
1033 |
spip_query("ALTER TABLE spip_signatures ADD INDEX idx (idx)");
|
|
|
1034 |
maj_version(1.820);
|
|
|
1035 |
}
|
|
|
1036 |
|
|
|
1037 |
// reindexer les articles (on avait oublie les auteurs)
|
|
|
1038 |
if ($version_installee < 1.821) {
|
|
|
1039 |
spip_query("UPDATE spip_articles SET idx='1' WHERE idx='oui'");
|
|
|
1040 |
maj_version(1.821);
|
|
|
1041 |
}
|
|
|
1042 |
|
|
|
1043 |
return true;
|
|
|
1044 |
}
|
|
|
1045 |
|
|
|
1046 |
?>
|