[SPIP] +2.1.12
[velocampus/web/www.git] / www / ecrire / maj / svn10000.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2011 *
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')) return;
14
15 /*--------------------------------------------------------------------- */
16 /* Gestion des MAJ par tableau indexe par le numero SVN du chgt */
17 /*--------------------------------------------------------------------- */
18
19 // Type cls et sty pour LaTeX
20 $GLOBALS['maj'][10990] = array(array('upgrade_types_documents'));
21
22 // Type 3gp: http://www.faqs.org/rfcs/rfc3839.html
23 // Aller plus vite pour les vieilles versions en redeclarant une seule les doc
24 unset($GLOBALS['maj'][10990]);
25 $GLOBALS['maj'][11042] = array(array('upgrade_types_documents'));
26
27
28 // Un bug permettait au champ 'upload' d'etre vide, provoquant
29 // l'impossibilite de telecharger une image
30 // http://trac.rezo.net/trac/spip/ticket/1238
31 $GLOBALS['maj'][11171] = array(
32 array('spip_query', "UPDATE spip_types_documents SET upload='oui' WHERE upload IS NULL OR upload!='non'")
33 );
34
35 function maj_11268() {
36 global $tables_auxiliaires;
37 include_spip('base/auxiliaires');
38 $v = $tables_auxiliaires[$k='spip_resultats'];
39 sql_create($k, $v['field'], $v['key'], false, false);
40 }
41 $GLOBALS['maj'][11268] = array(array('maj_11268'));
42
43
44 function maj_11276 () {
45 include_spip('maj/v019');
46 maj_1_938();
47 }
48 $GLOBALS['maj'][11276] = array(array('maj_11276'));
49
50 // reparer les referers d'article, qui sont vides depuis [10572]
51 function maj_11388 () {
52 $s = sql_select('referer_md5', 'spip_referers_articles', "referer='' OR referer IS NULL");
53 while ($t = sql_fetch($s)) {
54 $k = sql_fetsel('referer', 'spip_referers', 'referer_md5='.sql_quote($t['referer_md5']));
55 if ($k['referer']) {
56 spip_query('UPDATE spip_referers_articles
57 SET referer='.sql_quote($k['referer']).'
58 WHERE referer_md5='.sql_quote($t['referer_md5'])
59 ." AND (referer='' OR referer IS NULL)"
60 );
61 }
62 }
63 }
64 $GLOBALS['maj'][11388] = array(array('maj_11388'));
65
66 // reparer spip_mots.type = titre du groupe
67 function maj_11431 () {
68 // mysql only
69 // spip_query("UPDATE spip_mots AS a LEFT JOIN spip_groupes_mots AS b ON (a.id_groupe = b.id_groupe) SET a.type=b.titre");
70
71 // selection des mots cles dont le type est different du groupe
72 $res = sql_select(
73 array("a.id_mot AS id_mot", "b.titre AS type"),
74 array("spip_mots AS a LEFT JOIN spip_groupes_mots AS b ON (a.id_groupe = b.id_groupe)"),
75 array("a.type != b.titre"));
76 // mise a jour de ces mots la
77 if ($res){
78 while ($r = sql_fetch($res)){
79 sql_updateq('spip_mots', array('type'=>$r['type']), 'id_mot='.sql_quote($r['id_mot']));
80 }
81 }
82 }
83 $GLOBALS['maj'][11431] = array(array('maj_11431'));
84
85 // reparer spip_types_documents.id_type
86 // qui est parfois encore present
87 function maj_11778 () {
88 // si presence id_type
89 $s = sql_showtable('spip_types_documents');
90 if (isset($s['field']['id_type'])) {
91 sql_alter('TABLE spip_types_documents CHANGE id_type id_type BIGINT(21) NOT NULL');
92 sql_alter('TABLE spip_types_documents DROP id_type');
93 sql_alter('TABLE spip_types_documents ADD PRIMARY KEY (extension)');
94 }
95 }
96 $GLOBALS['maj'][11778] = array(array('maj_11778'));
97
98 // Optimisation des forums
99 function maj_11790 () {
100 # sql_alter('TABLE spip_forum DROP INDEX id_message id_message');
101 sql_alter('TABLE spip_forum ADD INDEX id_parent (id_parent)');
102 sql_alter('TABLE spip_forum ADD INDEX id_auteur (id_auteur)');
103 sql_alter('TABLE spip_forum ADD INDEX id_thread (id_thread)');
104 }
105
106 $GLOBALS['maj'][11790] = array(array('maj_11790'));
107
108 $GLOBALS['maj'][11794] = array(); // ajout de spip_documents_forum
109
110
111
112 $GLOBALS['maj'][11961] = array(
113 array('sql_alter',"TABLE spip_groupes_mots CHANGE `tables` tables_liees text DEFAULT '' NOT NULL AFTER obligatoire"), // si tables a ete cree on le renomme
114 array('sql_alter',"TABLE spip_groupes_mots ADD tables_liees text DEFAULT '' NOT NULL AFTER obligatoire"), // sinon on l'ajoute
115 array('sql_update','spip_groupes_mots',array('tables_liees'=>"''"),"articles REGEXP '.*'"), // si le champ articles est encore la, on reinit la conversion
116 array('sql_update','spip_groupes_mots',array('tables_liees'=>"concat(tables_liees,'articles,')"),"articles='oui'"), // sinon ces 4 requetes ne feront rien
117 array('sql_update','spip_groupes_mots',array('tables_liees'=>"concat(tables_liees,'breves,')"),"breves='oui'"),
118 array('sql_update','spip_groupes_mots',array('tables_liees'=>"concat(tables_liees,'rubriques,')"),"rubriques='oui'"),
119 array('sql_update','spip_groupes_mots',array('tables_liees'=>"concat(tables_liees,'syndic,')"),"syndic='oui'"),
120 );
121
122
123
124 // Reunir en une seule table les liens de documents
125 // spip_documents_articles et spip_documents_forum
126 function maj_12008 () {
127 // Creer spip_documents_liens
128 global $tables_auxiliaires;
129 include_spip('base/auxiliaires');
130 $v = $tables_auxiliaires[$k='spip_documents_liens'];
131 sql_create($k, $v['field'], $v['key'], false, false);
132
133 // Recopier les donnees
134 foreach (array('article', 'breve', 'rubrique', 'auteur', 'forum') as $l) {
135 if ($s = sql_select('*', 'spip_documents_'.$l.'s')
136 OR $s = sql_select('*', 'spip_documents_'.$l)) {
137 $tampon = array();
138 while ($t = sql_fetch($s)) {
139 // transformer id_xx=N en (id_objet=N, objet=xx)
140 $t['id_objet'] = $t["id_$l"];
141 $t['objet'] = $l;
142 unset($t["id_$l"]);
143 unset($t['maj']);
144 $tampon[] = $t;
145 if (count($tampon)>10000) {
146 sql_insertq_multi('spip_documents_liens',$tampon);
147 $tampon = array();
148 }
149 }
150 if (count($tampon)) {
151 sql_insertq_multi('spip_documents_liens', $tampon);
152 }
153 }
154 }
155 }
156
157 $GLOBALS['maj'][12008] = array(
158 //array('sql_drop_table',"spip_documents_liens"), // tant pis pour ceux qui ont joue a 11974
159 array('sql_alter',"TABLE spip_documents_liens DROP PRIMARY KEY"),
160 array('sql_alter',"TABLE spip_documents_liens ADD id_objet bigint(21) DEFAULT '0' NOT NULL AFTER id_document"),
161 array('sql_alter',"TABLE spip_documents_liens ADD objet VARCHAR (25) DEFAULT '' NOT NULL AFTER id_objet"),
162 array('sql_update','spip_documents_liens',array('id_objet'=>"id_article",'objet'=>"'article'"),"id_article IS NOT NULL AND id_article>0"),
163 array('sql_update','spip_documents_liens',array('id_objet'=>"id_rubrique",'objet'=>"'rubrique'"),"id_rubrique IS NOT NULL AND id_rubrique>0"),
164 array('sql_update','spip_documents_liens',array('id_objet'=>"id_breve",'objet'=>"'breve'"),"id_breve IS NOT NULL AND id_breve>0"),
165 array('sql_update','spip_documents_liens',array('id_objet'=>"id_auteur",'objet'=>"'auteur'"),"id_auteur IS NOT NULL AND id_auteur>0"),
166 array('sql_update','spip_documents_liens',array('id_objet'=>"id_forum",'objet'=>"'forum'"),"id_forum IS NOT NULL AND id_forum>0"),
167 array('sql_alter',"TABLE spip_documents_liens ADD PRIMARY KEY (id_document,id_objet,objet)"),
168 array('sql_alter',"TABLE spip_documents_liens DROP id_article"),
169 array('sql_alter',"TABLE spip_documents_liens DROP id_rubrique"),
170 array('sql_alter',"TABLE spip_documents_liens DROP id_breve"),
171 array('sql_alter',"TABLE spip_documents_liens DROP id_auteur"),
172 array('sql_alter',"TABLE spip_documents_liens DROP id_forum"),
173 array('maj_12008'),
174 );
175
176
177 // destruction des tables spip_documents_articles etc, cf. 12008
178 $GLOBALS['maj'][12009] = array(
179 array('sql_drop_table',"spip_documents_articles"),
180 array('sql_drop_table',"spip_documents_breves"),
181 array('sql_drop_table',"spip_documents_rubriques"),
182 array('sql_drop_table',"spip_documents_auteurs"), # plugin #FORMULAIRE_UPLOAD
183 array('sql_drop_table',"spip_documents_syndic") # plugin podcast_client
184 );
185
186 // destruction des champs articles breves rubriques et syndic, cf. 11961
187 $GLOBALS['maj'][12010] = array(
188 array('sql_alter',"TABLE spip_groupes_mots DROP articles"),
189 array('sql_alter',"TABLE spip_groupes_mots DROP breves"),
190 array('sql_alter',"TABLE spip_groupes_mots DROP rubriques"),
191 array('sql_alter',"TABLE spip_groupes_mots DROP syndic"),
192 );
193
194 function maj_13135 () {
195 include_spip('inc/rubriques');
196 calculer_prochain_postdate();
197
198 // supprimer les eventuels vieux cache plugin qui n'utilisaient pas _chemin
199 @spip_unlink(_CACHE_PLUGINS_OPT);
200 @spip_unlink(_CACHE_PLUGINS_FCT);
201 @spip_unlink(_CACHE_PLUGINS_VERIF);
202 }
203
204 $GLOBALS['maj'][13135] = array(array('maj_13135'));
205
206 // Type flac: http://flac.sourceforge.net
207 $GLOBALS['maj'][13333] = array(array('upgrade_types_documents'));
208
209 // http://archives.rezo.net/spip-zone.mbox/200903.mbox/%3Cbfc33ad70903141606q2e4c53f2k4fef6b45e611a04f@mail.gmail.com%3E
210
211 $GLOBALS['maj'][13833] = array(
212 array('sql_alter',"TABLE spip_documents_liens ADD INDEX objet(id_objet,objet)"))
213 ;
214
215 // Fin upgrade commun branche 2.0
216
217 include_spip('inc/autoriser');
218 $GLOBALS['maj'][13904] = array(
219 array('sql_alter',"TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"),
220 array('sql_update','spip_auteurs',array('webmestre'=>"'oui'"),sql_in("id_auteur",defined('_ID_WEBMESTRES')?explode(':',_ID_WEBMESTRES):(autoriser('configurer')?array($GLOBALS['visiteur_session']['id_auteur']):array(0)))) // le webmestre est celui qui fait l'upgrade si rien de defini
221 )
222 ;
223
224 // sites plantes en mode "'su" au lieu de "sus"
225 $GLOBALS['maj'][13929] = array(
226 array('sql_update',"spip_syndic",array('syndication'=>"'sus'"),"syndication LIKE '\\'%'")
227 );
228
229 // Types de fichiers m4a/m4b/m4p/m4u/m4v/dv
230 // Types de fichiers Open XML (cro$oft)
231 $GLOBALS['maj'][14558] = array(array('upgrade_types_documents'));
232
233 // refaire les upgrade dont les numeros sont inferieurs a ceux de la branche 2.0
234 // etre sur qu'ils sont bien unipotents(?)...
235 $GLOBALS['maj'][14559] = $GLOBALS['maj'][13904]+$GLOBALS['maj'][13929]+$GLOBALS['maj'][14558];
236
237 // Restauration correcte des types mime des fichiers Ogg
238 // http://trac.rezo.net/trac/spip/ticket/1941
239 // + Types de fichiers : f4a/f4b/f4p/f4v/mpc http://en.wikipedia.org/wiki/Flv#File_formats
240 $GLOBALS['maj'][15676] = array(array('upgrade_types_documents'));
241
242 // Type de fichiers : webm http://en.wikipedia.org/wiki/Flv#File_formats
243 $GLOBALS['maj'][15827] = array(array('upgrade_types_documents'));
244
245 // IP en 40 caracteres pour IP v6
246 $GLOBALS['maj'][15828] = array(array('sql_alter',"TABLE spip_forum CHANGE `ip` `ip` VARCHAR(40) DEFAULT '' NOT NULL"));
247
248 ?>