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