[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / maj / vieille_base / 13000 / serial.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2014 *
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 if (!defined('_ECRIRE_INC_VERSION')) return;
15
16 // http://doc.spip.org/@base_serial
17 function base_serial_13000(&$tables_principales){
18 $spip_articles = array(
19 "id_article" => "bigint(21) NOT NULL",
20 "surtitre" => "text DEFAULT '' NOT NULL",
21 "titre" => "text DEFAULT '' NOT NULL",
22 "soustitre" => "text DEFAULT '' NOT NULL",
23 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL",
24 "descriptif" => "text DEFAULT '' NOT NULL",
25 "chapo" => "mediumtext DEFAULT '' NOT NULL",
26 "texte" => "longtext DEFAULT '' NOT NULL",
27 "ps" => "mediumtext DEFAULT '' NOT NULL",
28 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
29 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
30 "id_secteur" => "bigint(21) DEFAULT '0' NOT NULL",
31 "maj" => "TIMESTAMP",
32 "export" => "VARCHAR(10) DEFAULT 'oui'",
33 "date_redac" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
34 "visites" => "integer DEFAULT '0' NOT NULL",
35 "referers" => "integer DEFAULT '0' NOT NULL",
36 "popularite" => "DOUBLE DEFAULT '0' NOT NULL",
37 "accepter_forum" => "CHAR(3) DEFAULT '' NOT NULL",
38 "date_modif" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
39 "lang" => "VARCHAR(10) DEFAULT '' NOT NULL",
40 "langue_choisie" => "VARCHAR(3) DEFAULT 'non'",
41 "id_trad" => "bigint(21) DEFAULT '0' NOT NULL",
42 "extra" => "longtext NULL",
43 "id_version" => "int unsigned DEFAULT '0' NOT NULL",
44 "nom_site" => "tinytext DEFAULT '' NOT NULL",
45 "url_site" => "VARCHAR(255) DEFAULT '' NOT NULL",
46 # "url_propre" => "VARCHAR(255) DEFAULT '' NOT NULL"
47 );
48
49 $spip_articles_key = array(
50 "PRIMARY KEY" => "id_article",
51 "KEY id_rubrique" => "id_rubrique",
52 "KEY id_secteur" => "id_secteur",
53 "KEY id_trad" => "id_trad",
54 "KEY lang" => "lang",
55 "KEY statut" => "statut, date",
56 # "KEY url_propre" => "url_propre"
57 );
58 $spip_articles_join = array(
59 "id_article"=>"id_article",
60 "id_rubrique"=>"id_rubrique");
61
62 $spip_auteurs = array(
63 "id_auteur" => "bigint(21) NOT NULL",
64 "nom" => "text DEFAULT '' NOT NULL",
65 "bio" => "text DEFAULT '' NOT NULL",
66 "email" => "tinytext DEFAULT '' NOT NULL",
67 "nom_site" => "tinytext DEFAULT '' NOT NULL",
68 "url_site" => "text DEFAULT '' NOT NULL",
69 "login" => "VARCHAR(255) BINARY",
70 "pass" => "tinytext DEFAULT '' NOT NULL",
71 "low_sec" => "tinytext DEFAULT '' NOT NULL",
72 "statut" => "varchar(255) DEFAULT '0' NOT NULL",
73 "maj" => "TIMESTAMP",
74 "pgp" => "TEXT DEFAULT '' NOT NULL",
75 "htpass" => "tinytext DEFAULT '' NOT NULL",
76 "en_ligne" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
77 "imessage" => "VARCHAR(3)",
78 "messagerie" => "VARCHAR(3)",
79 "alea_actuel" => "tinytext",
80 "alea_futur" => "tinytext",
81 "prefs" => "tinytext",
82 "cookie_oubli" => "tinytext",
83 "source" => "VARCHAR(10) DEFAULT 'spip' NOT NULL",
84 "lang" => "VARCHAR(10) DEFAULT '' NOT NULL",
85 # "url_propre" => "VARCHAR(255)",
86 "extra" => "longtext NULL");
87
88 $spip_auteurs_key = array(
89 "PRIMARY KEY" => "id_auteur",
90 "KEY login" => "login",
91 "KEY statut" => "statut",
92 "KEY en_ligne" => "en_ligne",
93 # "KEY url_propre" => "url_propre"
94 );
95 $spip_auteurs_join = array(
96 "id_auteur"=>"id_auteur",
97 "login"=>"login");
98
99
100 $spip_breves = array(
101 "id_breve" => "bigint(21) NOT NULL",
102 "date_heure" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
103 "titre" => "text DEFAULT '' NOT NULL",
104 "texte" => "longtext DEFAULT '' NOT NULL",
105 "lien_titre" => "text DEFAULT '' NOT NULL",
106 "lien_url" => "text DEFAULT '' NOT NULL",
107 "statut" => "varchar(6) DEFAULT '0' NOT NULL",
108 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL",
109 "lang" => "VARCHAR(10) DEFAULT '' NOT NULL",
110 "langue_choisie" => "VARCHAR(3) DEFAULT 'non'",
111 "maj" => "TIMESTAMP",
112 "extra" => "longtext NULL",
113 # "url_propre" => "VARCHAR(255) DEFAULT '' NOT NULL"
114 );
115
116 $spip_breves_key = array(
117 "PRIMARY KEY" => "id_breve",
118 "KEY id_rubrique" => "id_rubrique",
119 # "KEY url_propre" => "url_propre"
120 );
121 $spip_breves_join = array(
122 "id_breve"=>"id_breve",
123 "id_rubrique"=>"id_rubrique");
124
125 $spip_messages = array(
126 "id_message" => "bigint(21) NOT NULL",
127 "titre" => "text DEFAULT '' NOT NULL",
128 "texte" => "longtext DEFAULT '' NOT NULL",
129 "type" => "varchar(6) DEFAULT '' NOT NULL",
130 "date_heure" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
131 "date_fin" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
132 "rv" => "varchar(3) DEFAULT '' NOT NULL",
133 "statut" => "varchar(6) DEFAULT '0' NOT NULL",
134 "id_auteur" => "bigint(21) NOT NULL",
135 "maj" => "TIMESTAMP");
136
137 $spip_messages_key = array(
138 "PRIMARY KEY" => "id_message",
139 "KEY id_auteur" => "id_auteur");
140
141 $spip_mots = array(
142 "id_mot" => "bigint(21) NOT NULL",
143 "titre" => "text DEFAULT '' NOT NULL",
144 "descriptif" => "text DEFAULT '' NOT NULL",
145 "texte" => "longtext DEFAULT '' NOT NULL",
146 "id_groupe" => "bigint(21) DEFAULT 0 NOT NULL",
147 "type" => "text DEFAULT '' NOT NULL",
148 "extra" => "longtext NULL",
149 # "url_propre" => "VARCHAR(255) DEFAULT '' NOT NULL",
150 "maj" => "TIMESTAMP");
151
152 $spip_mots_key = array(
153 "PRIMARY KEY" => "id_mot",
154 # "KEY url_propre" => "url_propre"
155 );
156
157 $spip_groupes_mots = array(
158 "id_groupe" => "bigint(21) NOT NULL",
159 "titre" => "text DEFAULT '' NOT NULL",
160 "descriptif" => "text DEFAULT '' NOT NULL",
161 "texte" => "longtext DEFAULT '' NOT NULL",
162 "unseul" => "varchar(3) DEFAULT '' NOT NULL",
163 "obligatoire" => "varchar(3) DEFAULT '' NOT NULL",
164 "tables_liees" => "text DEFAULT '' NOT NULL",
165 # suppression des champs a faire dans la maj
166 #"articles" => "varchar(3) DEFAULT '' NOT NULL",
167 #"breves" => "varchar(3) DEFAULT '' NOT NULL",
168 #"rubriques" => "varchar(3) DEFAULT '' NOT NULL",
169 #"syndic" => "varchar(3) DEFAULT '' NOT NULL",
170 "minirezo" => "varchar(3) DEFAULT '' NOT NULL",
171 "comite" => "varchar(3) DEFAULT '' NOT NULL",
172 "forum" => "varchar(3) DEFAULT '' NOT NULL",
173 "maj" => "TIMESTAMP");
174
175 $spip_groupes_mots_key = array(
176 "PRIMARY KEY" => "id_groupe");
177
178 $spip_rubriques = array(
179 "id_rubrique" => "bigint(21) NOT NULL",
180 "id_parent" => "bigint(21) DEFAULT '0' NOT NULL",
181 "titre" => "text DEFAULT '' NOT NULL",
182 "descriptif" => "text DEFAULT '' NOT NULL",
183 "texte" => "longtext DEFAULT '' NOT NULL",
184 "id_secteur" => "bigint(21) DEFAULT '0' NOT NULL",
185 "maj" => "TIMESTAMP",
186 "export" => "VARCHAR(10) DEFAULT 'oui'",
187 "id_import" => "bigint DEFAULT '0'",
188 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
189 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
190 "lang" => "VARCHAR(10) DEFAULT '' NOT NULL",
191 "langue_choisie" => "VARCHAR(3) DEFAULT 'non'",
192 "extra" => "longtext NULL",
193 # "url_propre" => "VARCHAR(255) DEFAULT '' NOT NULL",
194 "statut_tmp" => "varchar(10) DEFAULT '0' NOT NULL",
195 "date_tmp" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL"
196 );
197
198 $spip_rubriques_key = array(
199 "PRIMARY KEY" => "id_rubrique",
200 "KEY lang" => "lang",
201 "KEY id_parent" => "id_parent",
202 # "KEY url_propre" => "url_propre"
203 );
204
205 $spip_documents = array(
206 "id_document" => "bigint(21) NOT NULL",
207 "id_vignette" => "bigint(21) DEFAULT '0' NOT NULL",
208 "extension" => "VARCHAR(10) DEFAULT '' NOT NULL",
209 "titre" => "text DEFAULT '' NOT NULL",
210 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
211 "descriptif" => "text DEFAULT '' NOT NULL",
212 "fichier" => "varchar(255) DEFAULT '' NOT NULL",
213 "taille" => "integer",
214 "largeur" => "integer",
215 "hauteur" => "integer",
216 "mode" => "ENUM('vignette', 'image', 'document') DEFAULT 'document' NOT NULL",
217 "distant" => "VARCHAR(3) DEFAULT 'non'",
218 "maj" => "TIMESTAMP");
219
220 $spip_documents_key = array(
221 "PRIMARY KEY" => "id_document",
222 "KEY id_vignette" => "id_vignette",
223 "KEY mode" => "mode",
224 "KEY extension" => "extension");
225 $spip_documents_join = array(
226 "id_document"=>"id_document",
227 "extension"=>"extension");
228
229 $spip_types_documents = array(
230 "extension" => "varchar(10) DEFAULT '' NOT NULL",
231 "titre" => "text DEFAULT '' NOT NULL",
232 "descriptif" => "text DEFAULT '' NOT NULL",
233 "mime_type" => "varchar(100) DEFAULT '' NOT NULL",
234 "inclus" => "ENUM('non', 'image', 'embed') NOT NULL DEFAULT 'non'",
235 "upload" => "ENUM('oui', 'non') NOT NULL DEFAULT 'oui'",
236 "maj" => "TIMESTAMP");
237
238 $spip_types_documents_key = array(
239 "PRIMARY KEY" => "extension",
240 "KEY inclus" => "inclus");
241
242 $spip_syndic = array(
243 "id_syndic" => "bigint(21) NOT NULL",
244 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL",
245 "id_secteur" => "bigint(21) DEFAULT '0' NOT NULL",
246 "nom_site" => "text DEFAULT '' NOT NULL",
247 "url_site" => "text DEFAULT '' NOT NULL",
248 "url_syndic" => "text DEFAULT '' NOT NULL",
249 "descriptif" => "text DEFAULT '' NOT NULL",
250 # "url_propre" => "VARCHAR(255) DEFAULT '' NOT NULL",
251 "maj" => "TIMESTAMP",
252 "syndication" => "VARCHAR(3) DEFAULT '' NOT NULL",
253 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
254 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
255 "date_syndic" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
256 "date_index" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
257 "extra" => "longtext NULL",
258 "moderation" => "VARCHAR(3) DEFAULT 'non'",
259 "miroir" => "VARCHAR(3) DEFAULT 'non'",
260 "oubli" => "VARCHAR(3) DEFAULT 'non'",
261 "resume" => "VARCHAR(3) DEFAULT 'oui'"
262 );
263
264 $spip_syndic_key = array(
265 "PRIMARY KEY" => "id_syndic",
266 "KEY id_rubrique" => "id_rubrique",
267 "KEY id_secteur" => "id_secteur",
268 "KEY statut" => "statut, date_syndic",
269 # "KEY url_propre" => "url_propre"
270 );
271 $spip_syndic_join = array(
272 "id_syndic"=>"id_syndic",
273 "id_rubrique"=>"id_rubrique");
274
275 $spip_syndic_articles = array(
276 "id_syndic_article" => "bigint(21) NOT NULL",
277 "id_syndic" => "bigint(21) DEFAULT '0' NOT NULL",
278 "titre" => "text DEFAULT '' NOT NULL",
279 "url" => "VARCHAR(255) DEFAULT '' NOT NULL",
280 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
281 "lesauteurs" => "text DEFAULT '' NOT NULL",
282 "maj" => "TIMESTAMP",
283 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
284 "descriptif" => "text DEFAULT '' NOT NULL",
285 "lang" => "VARCHAR(10) DEFAULT '' NOT NULL",
286 "url_source" => "TINYTEXT DEFAULT '' NOT NULL",
287 "source" => "TINYTEXT DEFAULT '' NOT NULL",
288 "tags" => "TEXT DEFAULT '' NOT NULL");
289
290 $spip_syndic_articles_key = array(
291 "PRIMARY KEY" => "id_syndic_article",
292 "KEY id_syndic" => "id_syndic",
293 "KEY statut" => "statut",
294 "KEY url" => "url");
295 $spip_syndic_articles_join = array(
296 "id_syndic_article"=>"id_syndic_article",
297 "id_syndic"=>"id_syndic");
298
299 $spip_forum = array(
300 "id_forum" => "bigint(21) NOT NULL",
301 "id_parent" => "bigint(21) DEFAULT '0' NOT NULL",
302 "id_thread" => "bigint(21) DEFAULT '0' NOT NULL",
303 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL",
304 "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
305 "id_breve" => "bigint(21) DEFAULT '0' NOT NULL",
306 "date_heure" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
307 "date_thread" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
308 "titre" => "text DEFAULT '' NOT NULL",
309 "texte" => "mediumtext DEFAULT '' NOT NULL",
310 "auteur" => "text DEFAULT '' NOT NULL",
311 "email_auteur" => "text DEFAULT '' NOT NULL",
312 "nom_site" => "text DEFAULT '' NOT NULL",
313 "url_site" => "text DEFAULT '' NOT NULL",
314 "statut" => "varchar(8) DEFAULT '0' NOT NULL",
315 "ip" => "varchar(16) DEFAULT '' NOT NULL",
316 "maj" => "TIMESTAMP",
317 "id_auteur" => "bigint DEFAULT '0' NOT NULL",
318 "id_message" => "bigint(21) DEFAULT '0' NOT NULL",
319 "id_syndic" => "bigint(21) DEFAULT '0' NOT NULL");
320
321 $spip_forum_key = array(
322 "PRIMARY KEY" => "id_forum",
323 "KEY id_auteur" => "id_auteur",
324 "KEY id_parent" => "id_parent",
325 "KEY id_thread" => "id_thread",
326 "KEY optimal" => "statut,id_parent,id_article,date_heure,id_breve,id_syndic,id_rubrique");
327
328 $spip_forum_join = array(
329 "id_forum"=>"id_forum",
330 "id_parent"=>"id_parent",
331 "id_article"=>"id_article",
332 "id_breve"=>"id_breve",
333 "id_message"=>"id_message",
334 "id_syndic"=>"id_syndic",
335 "id_rubrique"=>"id_rubrique");
336
337 $spip_signatures = array(
338 "id_signature" => "bigint(21) NOT NULL",
339 "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
340 "date_time" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
341 "nom_email" => "text DEFAULT '' NOT NULL",
342 "ad_email" => "text DEFAULT '' NOT NULL",
343 "nom_site" => "text DEFAULT '' NOT NULL",
344 "url_site" => "text DEFAULT '' NOT NULL",
345 "message" => "mediumtext DEFAULT '' NOT NULL",
346 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
347 "maj" => "TIMESTAMP");
348
349 $spip_signatures_key = array(
350 "PRIMARY KEY" => "id_signature",
351 "KEY id_article" => "id_article",
352 "KEY statut" => "statut");
353 $spip_signatures_join = array(
354 "id_signature"=>"id_signature",
355 "id_article"=>"id_article");
356
357 /// Attention: mes_fonctions peut avoir deja defini cette variable
358 /// il faut donc rajouter, mais pas reinitialiser
359
360 $tables_principales['spip_articles'] =
361 array('field' => &$spip_articles, 'key' => &$spip_articles_key, 'join' => &$spip_articles_join);
362 $tables_principales['spip_auteurs'] =
363 array('field' => &$spip_auteurs, 'key' => &$spip_auteurs_key,'join' => &$spip_auteurs_join);
364 $tables_principales['spip_breves'] =
365 array('field' => &$spip_breves, 'key' => &$spip_breves_key,'join' => &$spip_breves_join);
366 $tables_principales['spip_messages'] =
367 array('field' => &$spip_messages, 'key' => &$spip_messages_key);
368 $tables_principales['spip_mots'] =
369 array('field' => &$spip_mots, 'key' => &$spip_mots_key);
370 $tables_principales['spip_groupes_mots'] =
371 array('field' => &$spip_groupes_mots, 'key' => &$spip_groupes_mots_key);
372 $tables_principales['spip_rubriques'] =
373 array('field' => &$spip_rubriques, 'key' => &$spip_rubriques_key);
374 $tables_principales['spip_documents'] =
375 array('field' => &$spip_documents, 'key' => &$spip_documents_key, 'join' => &$spip_documents_join);
376 $tables_principales['spip_types_documents'] =
377 array('field' => &$spip_types_documents, 'key' => &$spip_types_documents_key);
378 $tables_principales['spip_syndic'] =
379 array('field' => &$spip_syndic, 'key' => &$spip_syndic_key, 'join' => &$spip_syndic_join);
380 $tables_principales['spip_syndic_articles'] =
381 array('field' => &$spip_syndic_articles, 'key' => &$spip_syndic_articles_key, 'join' => &$spip_syndic_articles_join);
382 $tables_principales['spip_forum'] =
383 array('field' => &$spip_forum, 'key' => &$spip_forum_key, 'join' => &$spip_forum_join);
384 $tables_principales['spip_signatures'] =
385 array('field' => &$spip_signatures, 'key' => &$spip_signatures_key, 'join' => &$spip_signatures_join);
386
387 $tables_principales = pipeline('declarer_tables_principales',$tables_principales);
388 }
389
390 global $tables_principales;
391 base_serial_13000($tables_principales);
392
393 ?>