[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / maj / vieille_base / 13000 / auxiliaires.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_auxiliaires
17 function base_auxiliaires_13000(&$tables_auxiliaires){
18 $spip_petitions = array(
19 "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
20 "email_unique" => "CHAR (3) DEFAULT '' NOT NULL",
21 "site_obli" => "CHAR (3) DEFAULT '' NOT NULL",
22 "site_unique" => "CHAR (3) DEFAULT '' NOT NULL",
23 "message" => "CHAR (3) DEFAULT '' NOT NULL",
24 "texte" => "LONGTEXT DEFAULT '' NOT NULL",
25 "maj" => "TIMESTAMP");
26
27 $spip_petitions_key = array(
28 "PRIMARY KEY" => "id_article");
29
30 $spip_visites = array(
31 "date" => "DATE NOT NULL",
32 "visites" => "int UNSIGNED DEFAULT '0' NOT NULL",
33 "maj" => "TIMESTAMP");
34
35 $spip_visites_key = array(
36 "PRIMARY KEY" => "date");
37
38 $spip_visites_articles = array(
39 "date" => "DATE NOT NULL",
40 "id_article" => "int UNSIGNED NOT NULL",
41 "visites" => "int UNSIGNED DEFAULT '0' NOT NULL",
42 "maj" => "TIMESTAMP");
43
44 $spip_visites_articles_key = array(
45 "PRIMARY KEY" => "date, id_article");
46
47 $spip_resultats = array(
48 "recherche" => "char(16) not null default ''",
49 "id" => "INT UNSIGNED NOT NULL",
50 "points" => "INT UNSIGNED DEFAULT '0' NOT NULL",
51 "maj" => "TIMESTAMP" );
52
53 $spip_resultats_key = array(
54 // pas de cle ni index, ca fait des insertions plus rapides et les requetes jointes utilisees en recheche ne sont pas plus lentes ...
55 );
56
57 $spip_referers = array(
58 "referer_md5" => "bigint UNSIGNED NOT NULL",
59 "date" => "DATE NOT NULL",
60 "referer" => "VARCHAR (255)",
61 "visites" => "int UNSIGNED NOT NULL",
62 "visites_jour" => "int UNSIGNED NOT NULL",
63 "visites_veille"=> "int UNSIGNED NOT NULL",
64 "maj" => "TIMESTAMP");
65
66 $spip_referers_key = array(
67 "PRIMARY KEY" => "referer_md5");
68
69 $spip_referers_articles = array(
70 "id_article" => "int UNSIGNED NOT NULL",
71 "referer_md5" => "bigint UNSIGNED NOT NULL",
72 "referer" => "VARCHAR (255) DEFAULT '' NOT NULL",
73 "visites" => "int UNSIGNED NOT NULL",
74 "maj" => "TIMESTAMP");
75
76 $spip_referers_articles_key = array(
77 "PRIMARY KEY" => "id_article, referer_md5",
78 "KEY referer_md5" => "referer_md5");
79
80 $spip_auteurs_articles = array(
81 "id_auteur" => "bigint(21) DEFAULT '0' NOT NULL",
82 "id_article" => "bigint(21) DEFAULT '0' NOT NULL");
83
84 $spip_auteurs_articles_key = array(
85 "PRIMARY KEY" => "id_auteur, id_article",
86 "KEY id_article" => "id_article");
87
88 $spip_auteurs_rubriques = array(
89 "id_auteur" => "bigint(21) DEFAULT '0' NOT NULL",
90 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL");
91
92 $spip_auteurs_rubriques_key = array(
93 "PRIMARY KEY" => "id_auteur, id_rubrique",
94 "KEY id_rubrique" => "id_rubrique");
95
96 $spip_auteurs_messages = array(
97 "id_auteur" => "bigint(21) DEFAULT '0' NOT NULL",
98 "id_message" => "bigint(21) DEFAULT '0' NOT NULL",
99 "vu" => "CHAR (3)");
100
101 $spip_auteurs_messages_key = array(
102 "PRIMARY KEY" => "id_auteur, id_message",
103 "KEY id_message" => "id_message");
104
105 $spip_documents_liens = array(
106 "id_document" => "bigint(21) DEFAULT '0' NOT NULL",
107 "id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
108 "objet" => "VARCHAR (25) DEFAULT '' NOT NULL",
109 "vu" => "ENUM('non', 'oui') DEFAULT 'non' NOT NULL");
110
111 $spip_documents_liens_key = array(
112 "PRIMARY KEY" => "id_document,id_objet,objet",
113 "KEY id_document" => "id_document");
114
115 /*
116 $spip_documents_articles = array(
117 "id_document" => "bigint(21) DEFAULT '0' NOT NULL",
118 "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
119 "vu" => "ENUM('non', 'oui') DEFAULT 'non' NOT NULL");
120
121 $spip_documents_articles_key = array(
122 "PRIMARY KEY" => "id_article, id_document",
123 "KEY id_document" => "id_document");
124
125 $spip_documents_rubriques = array(
126 "id_document" => "bigint(21) DEFAULT '0' NOT NULL",
127 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL",
128 "vu" => "ENUM('non', 'oui') DEFAULT 'non' NOT NULL");
129
130 $spip_documents_rubriques_key = array(
131 "PRIMARY KEY" => "id_rubrique, id_document",
132 "KEY id_document" => "id_document");
133
134 $spip_documents_breves = array(
135 "id_document" => "bigint(21) DEFAULT '0' NOT NULL",
136 "id_breve" => "bigint(21) DEFAULT '0' NOT NULL",
137 "vu" => "ENUM('non', 'oui') DEFAULT 'non' NOT NULL");
138
139 $spip_documents_breves_key = array(
140 "PRIMARY KEY" => "id_breve, id_document",
141 "KEY id_document" => "id_document");
142
143 $spip_documents_forum = array(
144 "id_document" => "bigint(21) DEFAULT '0' NOT NULL",
145 "id_forum" => "bigint(21) DEFAULT '0' NOT NULL",
146 "vu" => "ENUM('non', 'oui') DEFAULT 'non' NOT NULL");
147
148 $spip_documents_forum_key = array(
149 "PRIMARY KEY" => "id_forum, id_document",
150 "KEY id_document" => "id_document");
151 */
152
153 $spip_mots_articles = array(
154 "id_mot" => "bigint(21) DEFAULT '0' NOT NULL",
155 "id_article" => "bigint(21) DEFAULT '0' NOT NULL");
156
157 $spip_mots_articles_key = array(
158 "PRIMARY KEY" => "id_article, id_mot",
159 "KEY id_mot" => "id_mot");
160
161 $spip_mots_breves = array(
162 "id_mot" => "bigint(21) DEFAULT '0' NOT NULL",
163 "id_breve" => "bigint(21) DEFAULT '0' NOT NULL");
164
165 $spip_mots_breves_key = array(
166 "PRIMARY KEY" => "id_breve, id_mot",
167 "KEY id_mot" => "id_mot");
168
169 $spip_mots_rubriques = array(
170 "id_mot" => "bigint(21) DEFAULT '0' NOT NULL",
171 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL");
172
173 $spip_mots_rubriques_key = array(
174 "PRIMARY KEY" => "id_rubrique, id_mot",
175 "KEY id_mot" => "id_mot");
176
177 $spip_mots_syndic = array(
178 "id_mot" => "bigint(21) DEFAULT '0' NOT NULL",
179 "id_syndic" => "bigint(21) DEFAULT '0' NOT NULL");
180
181 $spip_mots_syndic_key = array(
182 "PRIMARY KEY" => "id_syndic, id_mot",
183 "KEY id_mot" => "id_mot");
184
185 $spip_mots_forum = array(
186 "id_mot" => "bigint(21) DEFAULT '0' NOT NULL",
187 "id_forum" => "bigint(21) DEFAULT '0' NOT NULL");
188
189 $spip_mots_forum_key = array(
190 "PRIMARY KEY" => "id_forum, id_mot",
191 "KEY id_mot" => "id_mot");
192
193 $spip_mots_documents = array(
194 "id_mot" => "bigint(21) DEFAULT '0' NOT NULL",
195 "id_document" => "bigint(21) DEFAULT '0' NOT NULL");
196
197 $spip_mots_documents_key = array(
198 "PRIMARY KEY" => "id_document, id_mot",
199 "KEY id_mot" => "id_mot");
200
201 $spip_meta = array(
202 "nom" => "VARCHAR (255) NOT NULL",
203 "valeur" => "text DEFAULT ''",
204 "impt" => "ENUM('non', 'oui') DEFAULT 'oui' NOT NULL",
205 "maj" => "TIMESTAMP");
206
207 $spip_meta_key = array(
208 "PRIMARY KEY" => "nom");
209
210 $spip_versions = array (
211 "id_article" => "bigint(21) NOT NULL",
212 "id_version" => "bigint(21) DEFAULT 0 NOT NULL",
213 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
214 "id_auteur" => "VARCHAR(23) DEFAULT '' NOT NULL", # stocke aussi IP(v6)
215 "titre_version" => "text DEFAULT '' NOT NULL",
216 "permanent" => "char(3)",
217 "champs" => "text");
218
219 $spip_versions_key = array (
220 "PRIMARY KEY" => "id_article, id_version");
221
222 $spip_versions_fragments = array(
223 "id_fragment" => "int unsigned DEFAULT '0' NOT NULL",
224 "version_min" => "int unsigned DEFAULT '0' NOT NULL",
225 "version_max" => "int unsigned DEFAULT '0' NOT NULL",
226 "id_article" => "bigint(21) NOT NULL",
227 "compress" => "tinyint NOT NULL",
228 "fragment" => "longblob" # ici c'est VRAIMENT un blob (on y stocke du gzip)
229 );
230
231 $spip_versions_fragments_key = array(
232 "PRIMARY KEY" => "id_article, id_fragment, version_min");
233
234
235 $spip_urls = array(
236 "url" => "VARCHAR(255) NOT NULL",
237 // la table cible
238 "type" => "varchar(15) DEFAULT 'article' NOT NULL",
239 // l'id dans la table
240 "id_objet" => "bigint(21) NOT NULL",
241 // pour connaitre la plus recente.
242 // ATTENTION, pas on update CURRENT_TIMESTAMP implicite
243 // et pas le nom maj, surinterprete par inc/import_1_3
244 "date" => "DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL");
245
246 $spip_urls_key = array(
247 "PRIMARY KEY" => "url",
248 "KEY type" => "type, id_objet");
249
250 $tables_auxiliaires['spip_petitions'] = array(
251 'field' => &$spip_petitions,
252 'key' => &$spip_petitions_key
253 );
254 $tables_auxiliaires['spip_visites'] = array(
255 'field' => &$spip_visites,
256 'key' => &$spip_visites_key);
257 $tables_auxiliaires['spip_visites_articles'] = array(
258 'field' => &$spip_visites_articles,
259 'key' => &$spip_visites_articles_key);
260 $tables_auxiliaires['spip_referers'] = array(
261 'field' => &$spip_referers,
262 'key' => &$spip_referers_key);
263 $tables_auxiliaires['spip_referers_articles'] = array(
264 'field' => &$spip_referers_articles,
265 'key' => &$spip_referers_articles_key);
266 $tables_auxiliaires['spip_auteurs_articles'] = array(
267 'field' => &$spip_auteurs_articles,
268 'key' => &$spip_auteurs_articles_key);
269 $tables_auxiliaires['spip_auteurs_rubriques'] = array(
270 'field' => &$spip_auteurs_rubriques,
271 'key' => &$spip_auteurs_rubriques_key);
272 $tables_auxiliaires['spip_auteurs_messages'] = array(
273 'field' => &$spip_auteurs_messages,
274 'key' => &$spip_auteurs_messages_key);
275 $tables_auxiliaires['spip_documents_liens'] = array(
276 'field' => &$spip_documents_liens,
277 'key' => &$spip_documents_liens_key);
278 /*
279 $tables_auxiliaires['spip_documents_articles'] = array(
280 'field' => &$spip_documents_articles,
281 'key' => &$spip_documents_articles_key);
282 $tables_auxiliaires['spip_documents_rubriques'] = array(
283 'field' => &$spip_documents_rubriques,
284 'key' => &$spip_documents_rubriques_key);
285 $tables_auxiliaires['spip_documents_breves'] = array(
286 'field' => &$spip_documents_breves,
287 'key' => &$spip_documents_breves_key);
288 $tables_auxiliaires['spip_documents_forum'] = array(
289 'field' => &$spip_documents_forum,
290 'key' => &$spip_documents_forum_key);
291 */
292 $tables_auxiliaires['spip_mots_articles'] = array(
293 'field' => &$spip_mots_articles,
294 'key' => &$spip_mots_articles_key);
295 $tables_auxiliaires['spip_mots_breves'] = array(
296 'field' => &$spip_mots_breves,
297 'key' => &$spip_mots_breves_key);
298 $tables_auxiliaires['spip_mots_rubriques'] = array(
299 'field' => &$spip_mots_rubriques,
300 'key' => &$spip_mots_rubriques_key);
301 $tables_auxiliaires['spip_mots_syndic'] = array(
302 'field' => &$spip_mots_syndic,
303 'key' => &$spip_mots_syndic_key);
304 $tables_auxiliaires['spip_mots_forum'] = array(
305 'field' => &$spip_mots_forum,
306 'key' => &$spip_mots_forum_key);
307 $tables_auxiliaires['spip_mots_documents'] = array(
308 'field' => &$spip_mots_documents,
309 'key' => &$spip_mots_documents_key);
310 $tables_auxiliaires['spip_meta'] = array(
311 'field' => &$spip_meta,
312 'key' => &$spip_meta_key);
313 $tables_auxiliaires['spip_resultats'] = array(
314 'field' => &$spip_resultats,
315 'key' => &$spip_resultats_key);
316 $tables_auxiliaires['spip_versions'] = array(
317 'field' => &$spip_versions,
318 'key' => &$spip_versions_key);
319 $tables_auxiliaires['spip_versions_fragments'] = array(
320 'field' => &$spip_versions_fragments,
321 'key' => &$spip_versions_fragments_key);
322 $tables_auxiliaires['spip_urls'] = array(
323 'field' => &$spip_urls,
324 'key' => &$spip_urls_key);
325
326 $tables_auxiliaires = pipeline('declarer_tables_auxiliaires',$tables_auxiliaires);
327 }
328
329 global $tables_auxiliaires;
330 base_auxiliaires_13000($tables_auxiliaires);
331 ?>