Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 859 lines (747 sloc) 32.755 kb
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
1 <?php
780a345 @dbuytaert - Added some explanation to the top of the file and fixed a braino.
dbuytaert authored
2 /*
3 ** USAGE:
4 **
5 ** - Point your browser to "http://www.site.com/update.php" and follow
6 ** the instructions.
7 **
8 */
9
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
10 if (!get_cfg_var("safe_mode")) {
11 set_time_limit(180);
12 }
13
14 // Define the various updates in an array("date : comment" => "function");
15 $mysql_updates = array(
062e7d7 @dbuytaert - Added missing query to change the session field from VARCHAR(32) to TE...
dbuytaert authored
16 "2001-10-10: first update after Drupal 3.0.0 release" => "update_1",
17 "2001-10-12" => "update_2",
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
18 "2001-10-14" => "update_3",
19 "2001-10-16" => "update_4",
20 "2001-10-17" => "update_5",
21 "2001-10-22" => "update_6",
22 "2001-11-01" => "update_7",
23 "2001-11-02" => "update_8",
24 "2001-11-04" => "update_9",
062e7d7 @dbuytaert - Added missing query to change the session field from VARCHAR(32) to TE...
dbuytaert authored
25 "2001-11-17" => "update_10",
5ecedf7 @dbuytaert user.module:
dbuytaert authored
26 "2001-12-01" => "update_11",
20b4b71 @dbuytaert - book.module:
dbuytaert authored
27 "2001-12-06" => "update_12",
e1f21d2 @dbuytaert - Included the new documentation and renamed all "referer"s to
dbuytaert authored
28 "2001-12-09" => "update_13",
a0ddc1a @dbuytaert - Added new feature. Explanation will follow on the mailing list.
dbuytaert authored
29 "2001-12-16" => "update_14",
c5bb7c3 @dbuytaert - Fixed a problem with the expiration of news items. Requires a SQL
dbuytaert authored
30 "2001-12-24" => "update_15",
a95c2a6 @dbuytaert - import.module:
dbuytaert authored
31 "2001-12-30" => "update_16",
d85e45b @dbuytaert - Added "x new comments" feature. Requires a SQL update.
dbuytaert authored
32 "2001-12-31" => "update_17",
58152c4 @dbuytaert Integrated Marco's generic/improved cache into Drupal. Requires an
dbuytaert authored
33 "2002-01-05" => "update_18",
0683331 @dbuytaert - Added an 'data' column to the user table.
dbuytaert authored
34 "2002-01-17" => "update_19",
8678951 - nodes can now be set to static which will pin them to the front page a...
Kjartan Mannes authored
35 "2002-01-27" => "update_20",
3c8de3e @dbuytaert - Changed the size of the data-field in the cache table.
dbuytaert authored
36 "2002-01-30" => "update_21",
e3d2c46 - applied search patch.
Kjartan Mannes authored
37 "2002-02-19" => "update_22",
5d9a8e3 @dbuytaert - Made the cloud module a lot more configurable: both the update interva...
dbuytaert authored
38 "2002-03-05" => "update_23",
5592761 This is a major change to the system, needs more testing!
Kjartan Mannes authored
39 "2002-04-08" => "update_24",
062e7d7 @dbuytaert - Added missing query to change the session field from VARCHAR(32) to TE...
dbuytaert authored
40 "2002-04-14" => "update_25",
41 "2002-04-14" => "update_26",
0a966e1 Updated poll.module:
Steven Wittens authored
42 "2002-04-16" => "update_27",
ae263bf @dbuytaert - Rewrote role management, splitting the table in two. There are no
dbuytaert authored
43 "2002-04-20" => "update_28",
062e7d7 @dbuytaert - Added missing query to change the session field from VARCHAR(32) to TE...
dbuytaert authored
44 "2002-04-23" => "update_29",
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
45 "2002-05-02" => "update_30",
39373da @dbuytaert - Added some indices.
dbuytaert authored
46 "2002-05-15" => "update_31",
062e7d7 @dbuytaert - Added missing query to change the session field from VARCHAR(32) to TE...
dbuytaert authored
47 "2002-06-22: first update after Drupal 4.0.0 release" => "update_32",
ec59398 - feed table should have not null defined for refresh and timestamp.
Kjartan Mannes authored
48 "2002-07-07" => "update_33",
e035785 @dbuytaert - Added indices for the poll module. Patch by Marco.
dbuytaert authored
49 "2002-07-31" => "update_34",
e04f6d2 @dbuytaert - Made the rating module and its SQL table ASNI compliant. Patch by jaa...
dbuytaert authored
50 "2002-08-10" => "update_35",
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
51 "2002-08-16" => "update_36",
a28f818 @dbuytaert - Changed "$watchdog->message" from type "varchar(255)" to type "text".
dbuytaert authored
52 "2002-08-19" => "update_37",
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
53 "2002-08-26" => "update_38",
85c6e90 @dbuytaert - Made sure the sequence table is properly initialized for comments.
dbuytaert authored
54 "2002-09-15" => "update_39",
fcae703 @dbuytaert - Committed Jeremy's incarnation of the statistics module. Last minutes
dbuytaert authored
55 "2002-09-17" => "update_40",
b60b9ca - removed function module_rehash().
Kjartan Mannes authored
56 "2002-10-13" => "update_41",
8d103a0 @dbuytaert - Committed Marco's block rewrite:
dbuytaert authored
57 "2002-10-17" => "update_42",
b3abbc4 @dbuytaert Patch by Natrak:
dbuytaert authored
58 "2002-10-26" => "update_43",
56d72a9 @dbuytaert - Added Stefan's page module improvements.
dbuytaert authored
59 "2002-11-08" => "update_44",
b6b24c2 @dbuytaert Applied patch by Natrak:
dbuytaert authored
60 "2002-11-20" => "update_45",
22fa9ed @dbuytaert - Refactored the administration pages.
dbuytaert authored
61 "2002-12-10" => "update_46",
0475d4f @dbuytaert Patch by Marco:
dbuytaert authored
62 "2002-12-22" => "update_47",
8a63646 @dbuytaert - Added an extra parameter to watchdog() which lets you specifiy an "act...
dbuytaert authored
63 "2002-12-29" => "update_48",
89b2069 @dbuytaert - Clean URL patch.
dbuytaert authored
64 "2003-01-03" => "update_49",
65 "2003-01-05" => "update_50"
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
66 );
67
68 // Update functions
69 function update_1() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
70 update_sql("ALTER TABLE users DROP INDEX real_email");
71 update_sql("ALTER TABLE users DROP fake_email");
72 update_sql("ALTER TABLE users DROP nodes");
73 update_sql("ALTER TABLE users DROP bio");
74 update_sql("ALTER TABLE users DROP hash");
75 update_sql("ALTER TABLE users ADD jabber varchar(128) DEFAULT '' NULL");
76 update_sql("ALTER TABLE users ADD drupal varchar(128) DEFAULT '' NULL");
77 update_sql("ALTER TABLE users ADD init varchar(64) DEFAULT '' NULL");
78 update_sql("ALTER TABLE users CHANGE passwd pass varchar(32) DEFAULT '' NOT NULL");
79 update_sql("ALTER TABLE users CHANGE real_email mail varchar(64) DEFAULT '' NULL");
80 update_sql("ALTER TABLE users CHANGE id uid int(10) unsigned DEFAULT '0' NOT NULL auto_increment");
81 update_sql("ALTER TABLE users CHANGE url homepage varchar(128) DEFAULT '' NOT NULL");
82 update_sql("UPDATE users SET status = 1 WHERE status = 2");
83 update_sql("UPDATE users SET name = userid");
84 update_sql("ALTER TABLE users DROP userid");
85 update_sql("UPDATE users SET init = mail");
86 update_sql("DROP TABLE access");
87 update_sql("CREATE TABLE access (aid tinyint(10) DEFAULT '0' NOT NULL auto_increment, mask varchar(255) DEFAULT '' NOT NULL, type varchar(255) DEFAULT '' NOT NULL, status tinyint(2) DEFAULT '0' NOT NULL, UNIQUE mask (mask), PRIMARY KEY (aid))");
88 update_sql("CREATE TABLE moderate (cid int(10) DEFAULT '0' NOT NULL, nid int(10) DEFAULT '0' NOT NULL, uid int(10) DEFAULT '0' NOT NULL, score int(2) DEFAULT '0' NOT NULL, timestamp int(11) DEFAULT '0' NOT NULL, INDEX (cid), INDEX (nid) )");
89 update_sql("ALTER TABLE comments DROP score");
90 update_sql("ALTER TABLE comments DROP votes");
91 update_sql("ALTER TABLE comments DROP users");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
92 }
93
94 function update_2() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
95 update_sql("ALTER TABLE users CHANGE pass pass varchar(32) DEFAULT '' NOT NULL");
96 update_sql("ALTER TABLE rating CHANGE user userid int(10) DEFAULT '0' NOT NULL");
97 update_sql("ALTER TABLE layout CHANGE user userid int(10) DEFAULT '0' NOT NULL");
98 update_sql("ALTER TABLE blocks CHANGE offset delta tinyint(2) DEFAULT '0' NOT NULL");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
99 foreach (module_list() as $name) {
100 if (module_hook($name, "node", "name")) {
101 $output .= "$name ...";
102 db_query("DROP TABLE IF EXISTS ". $name ."_seq");
103 db_query("CREATE TABLE ". $name ."_seq (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY(id))");
4a28077 - adding descriptions to modules (thanks Joe + Scott).
Kjartan Mannes authored
104 $result = db_query("SELECT MAX(". ($name == "node" ? "nid" : "lid") .") FROM $name");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
105 $count = $result ? db_result($result, 0) : 0;
106 db_query("INSERT INTO ". $name ."_seq (id) VALUES ('$count')");
107 $output .= "done ($count)<br />";
108 }
109 }
110 print $output;
111 }
112
113 function update_3() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
114 update_sql("ALTER TABLE user RENAME users");
115 update_sql("ALTER TABLE locales CHANGE id lid int(10) DEFAULT '0' NOT NULL auto_increment");
116 update_sql("ALTER TABLE layout CHANGE userid uid int(10) DEFAULT '0' NOT NULL");
117 update_sql("ALTER TABLE rating CHANGE userid uid int(10) DEFAULT '0' NOT NULL");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
118 }
119
120 function update_4() {
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
121 print "remove the \"auto_increment\"s:<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
122 update_sql("ALTER TABLE story CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL");
123 update_sql("ALTER TABLE blog CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL");
124 update_sql("ALTER TABLE page CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL");
125 update_sql("ALTER TABLE forum CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL");
126 update_sql("ALTER TABLE book CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
127
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
128 print "drop the \"lid\"s:<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
129 update_sql("ALTER TABLE story DROP lid");
130 update_sql("ALTER TABLE blog DROP lid");
131 update_sql("ALTER TABLE page DROP lid");
132 update_sql("ALTER TABLE forum DROP lid");
133 update_sql("ALTER TABLE book DROP lid");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
134
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
135 print "rename \"author\" to \"uid\":<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
136 update_sql("ALTER TABLE comments CHANGE author uid int(10) DEFAULT '0' NOT NULL");
137 update_sql("ALTER TABLE node CHANGE author uid int(10) DEFAULT '0' NOT NULL");
138 update_sql("ALTER TABLE node DROP KEY author");
139 update_sql("ALTER TABLE node ADD KEY uid (uid)");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
140
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
141 print "resize some \"id\"s:<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
142 update_sql("ALTER TABLE feed CHANGE fid fid int(10) NOT NULL auto_increment");
143 update_sql("ALTER TABLE bundle CHANGE bid bid int(10) NOT NULL auto_increment");
144 update_sql("ALTER TABLE item CHANGE iid iid int(10) NOT NULL auto_increment");
145 update_sql("ALTER TABLE item CHANGE fid fid int(10) NOT NULL");
146 update_sql("ALTER TABLE comments CHANGE cid cid int(10) NOT NULL auto_increment");
147 update_sql("ALTER TABLE comments CHANGE pid pid int(10) NOT NULL");
148 update_sql("ALTER TABLE comments CHANGE lid lid int(10) NOT NULL");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
149 }
150
151 function update_5() {
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
152 print "add primary keys:<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
153 update_sql("ALTER TABLE story ADD PRIMARY KEY nid (nid)");
154 update_sql("ALTER TABLE blog ADD PRIMARY KEY nid (nid)");
155 update_sql("ALTER TABLE page ADD PRIMARY KEY nid (nid)");
156 update_sql("ALTER TABLE forum ADD PRIMARY KEY nid (nid)");
157 update_sql("ALTER TABLE book ADD PRIMARY KEY nid (nid)");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
158
159 }
160
161 function update_6() {
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
162 print "add new field to blocks:<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
163 update_sql("ALTER TABLE blocks ADD path varchar(255) NOT NULL DEFAULT ''");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
164 }
165
166 function update_7() {
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
167 print "updating the story table:<br />";
6fd5a8d @dbuytaert - update.php: discovered and fixed a small thinko in update function #7.
dbuytaert authored
168 update_sql("UPDATE story SET body = CONCAT(abstract, '\n\n', body)");
169
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
170 print "rename the body fields:<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
171 update_sql("ALTER TABLE story CHANGE body body_old TEXT DEFAULT '' NOT NULL");
172 update_sql("ALTER TABLE page CHANGE body body_old TEXT DEFAULT '' NOT NULL");
173 update_sql("ALTER TABLE blog CHANGE body body_old TEXT DEFAULT '' NOT NULL");
174 update_sql("ALTER TABLE forum CHANGE body body_old TEXT DEFAULT '' NOT NULL");
175 update_sql("ALTER TABLE book CHANGE body body_old TEXT DEFAULT '' NOT NULL");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
176
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
177 print "update the node table:<br />";
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
178 update_sql("ALTER TABLE node DROP lid");
179 update_sql("ALTER TABLE node ADD teaser TEXT DEFAULT '' NOT NULL");
180 update_sql("ALTER TABLE node ADD body TEXT DEFAULT '' NOT NULL");
181 update_sql("ALTER TABLE node ADD changed int(11) DEFAULT '0' NOT NULL");
182 update_sql("ALTER TABLE node CHANGE timestamp created int(11) DEFAULT '0' NOT NULL");
183 update_sql("ALTER TABLE node CHANGE comment comment int(2) DEFAULT '0' NOT NULL");
184 update_sql("ALTER TABLE node CHANGE promote promote int(2) DEFAULT '0' NOT NULL");
185 update_sql("ALTER TABLE node CHANGE moderate moderate int(2) DEFAULT '0' NOT NULL");
186 update_sql("ALTER TABLE node DROP timestamp_posted");
187 update_sql("ALTER TABLE node DROP timestamp_queued");
188 update_sql("ALTER TABLE node DROP timestamp_hidden");
189 update_sql("UPDATE node SET status = 0 WHERE status = 1");
190 update_sql("UPDATE node SET status = 0 WHERE status = 2");
191 update_sql("UPDATE node SET status = 1 WHERE status = 3");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
192
c71b15e - fixing the update script so it can cleanly update from 3.x to 4.0.0 as...
Kjartan Mannes authored
193 $result = db_query("SELECT nid,type FROM node WHERE type = 'story' OR type = 'page' OR type = 'blog' OR type = 'forum' OR type = 'book'");
194 include_once("modules/node.module");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
195
196 while ($object = db_fetch_object($result)) {
197
c71b15e - fixing the update script so it can cleanly update from 3.x to 4.0.0 as...
Kjartan Mannes authored
198 include_once("modules/$object->type.module");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
199 $node = node_load(array("nid" => $object->nid));
200
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
201 $old = db_fetch_object(db_query("SELECT * FROM $node->type WHERE nid = $node->nid"));
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
202
203 switch ($node->type) {
204 case "forum":
205 case "story":
206 case "book":
207 case "page":
208 case "blog":
c8d126b - bug fix
Kjartan Mannes authored
209 node_save($node, array("nid", "body" => $old->body_old, "teaser" => ($old->abstract ? $old->abstract : node_teaser($old->body_old))));
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
210 print "updated node $node->nid '$node->title' ($node->type)<br />";
211 break;
212 default:
213 print "unknown node $node->nid '$node->title' ($node->type)<br />";
214 }
215
216 unset($node);
217 unset($body);
218 }
219
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
220 update_sql("UPDATE node SET changed = created");
221 update_sql("ALTER TABLE story DROP abstract");
222 update_sql("ALTER TABLE book DROP section");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
223 }
224
225 function update_8() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
226 update_sql("ALTER TABLE node ADD revisions TEXT DEFAULT '' NOT NULL");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
227 }
228
229 function update_9() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
230 update_sql("ALTER TABLE book ADD revision int(2) DEFAULT '1' NOT NULL");
231 update_sql("ALTER TABLE book DROP log");
232 update_sql("ALTER TABLE book DROP pid");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
233
234 // remove book pages that used to be 'expired':
235 $result = db_query("SELECT n.nid, n.title FROM node n WHERE n.type = 'book' AND n.status = 0");
236 while ($node = db_fetch_object($result)) {
237 print "removing node $node->nid '$node->title' (dumped node)<br />";
238 db_query("DELETE FROM node WHERE nid = '$node->nid'");
239 db_query("DELETE FROM book WHERE nid = '$node->nid'");
240 db_query("DELETE FROM comments WHERE lid = '$node->nid'");
241 }
242 }
243
cd2df44 @dbuytaert - update.php:
dbuytaert authored
244 function update_10() {
245 // create a new table:
246 update_sql("CREATE TABLE authmap (
247 aid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
248 uid int(10) DEFAULT '' NOT NULL,
249 authname varchar(128) DEFAULT '' NOT NULL,
250 module varchar(128) DEFAULT '' NOT NULL,
251 UNIQUE authname (authname),
252 PRIMARY KEY (aid)
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
253 )");
cd2df44 @dbuytaert - update.php:
dbuytaert authored
254
255 // populate the new table:
256 $result = db_query("SELECT uid, name, jabber, drupal FROM users WHERE jabber != '' || drupal != ''");
257 while ($user = db_fetch_object($result)) {
258 if ($user->jabber) {
259 update_sql("INSERT INTO authmap (uid, authname, module) VALUES ('$user->uid', '$user->jabber', 'jabber')");
260 }
261 if ($user->drupal) {
262 update_sql("INSERT INTO authmap (uid, authname, module) VALUES ('$user->uid', '$user->drupal', 'drupal')");
263 }
264 }
265
266 // remove the old user-table leftovers:
267 update_sql("DELETE FROM variable WHERE name = 'user_jabber'");
268 update_sql("DELETE FROM variable WHERE name = 'user_drupal'");
269 update_sql("ALTER TABLE users DROP drupal");
270 update_sql("ALTER TABLE users DROP jabber");
271
272 // remove the old node-table leftovers:
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
273 update_sql("ALTER TABLE forum DROP body_old");
274 update_sql("ALTER TABLE story DROP body_old");
275 update_sql("ALTER TABLE book DROP body_old");
276 update_sql("ALTER TABLE page DROP body_old");
277 update_sql("ALTER TABLE blog DROP body_old");
cd2df44 @dbuytaert - update.php:
dbuytaert authored
278 }
279
5ecedf7 @dbuytaert user.module:
dbuytaert authored
280 function update_11() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
281 update_sql("ALTER TABLE users ADD session TEXT");
282 update_sql("ALTER TABLE users ADD sid varchar(32) DEFAULT '' NOT NULL");
5ecedf7 @dbuytaert user.module:
dbuytaert authored
283 }
284
20b4b71 @dbuytaert - book.module:
dbuytaert authored
285 function update_12() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
286 update_sql("ALTER TABLE book DROP revision");
287 update_sql("ALTER TABLE book ADD format tinyint(2) DEFAULT '0'");
20b4b71 @dbuytaert - book.module:
dbuytaert authored
288 }
289
780a345 @dbuytaert - Added some explanation to the top of the file and fixed a braino.
dbuytaert authored
290 function update_13() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
291 update_sql("ALTER TABLE referer RENAME AS referrer");
292 update_sql("DROP TABLE blog");
293 update_sql("DROP TABLE story");
294 update_sql("DROP TABLE forum");
780a345 @dbuytaert - Added some explanation to the top of the file and fixed a braino.
dbuytaert authored
295 }
296
a0ddc1a @dbuytaert - Added new feature. Explanation will follow on the mailing list.
dbuytaert authored
297 function update_14() {
298 update_sql("CREATE TABLE directory (
299 link varchar(255) DEFAULT '' NOT NULL,
300 name varchar(128) DEFAULT '' NOT NULL,
301 mail varchar(128) DEFAULT '' NOT NULL,
302 slogan text NOT NULL,
303 mission text NOT NULL,
304 timestamp int(11) DEFAULT '0' NOT NULL,
305 PRIMARY KEY (link)
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
306 )");
e1f21d2 @dbuytaert - Included the new documentation and renamed all "referer"s to
dbuytaert authored
307 }
308
c5bb7c3 @dbuytaert - Fixed a problem with the expiration of news items. Requires a SQL
dbuytaert authored
309 function update_15() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
310 update_sql("ALTER TABLE feed DROP uncache");
c5bb7c3 @dbuytaert - Fixed a problem with the expiration of news items. Requires a SQL
dbuytaert authored
311 }
312
a95c2a6 @dbuytaert - import.module:
dbuytaert authored
313 function update_16() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
314 update_sql("ALTER TABLE comments CHANGE lid nid int(10) NOT NULL");
a95c2a6 @dbuytaert - import.module:
dbuytaert authored
315 }
316
d85e45b @dbuytaert - Added "x new comments" feature. Requires a SQL update.
dbuytaert authored
317 function update_17() {
318 update_sql("CREATE TABLE history (
319 uid int(10) DEFAULT '0' NOT NULL,
320 nid int(10) DEFAULT '0' NOT NULL,
321 timestamp int(11) DEFAULT '0' NOT NULL,
322 PRIMARY KEY (uid, nid)
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
323 )");
d85e45b @dbuytaert - Added "x new comments" feature. Requires a SQL update.
dbuytaert authored
324 }
325
58152c4 @dbuytaert Integrated Marco's generic/improved cache into Drupal. Requires an
dbuytaert authored
326 function update_18() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
327 update_sql("ALTER TABLE cache CHANGE timestamp expire int(11) DEFAULT '0' NOT NULL");
328 update_sql("ALTER TABLE cache CHANGE url cid varchar(255) DEFAULT '' NOT NULL");
58152c4 @dbuytaert Integrated Marco's generic/improved cache into Drupal. Requires an
dbuytaert authored
329 }
330
0683331 @dbuytaert - Added an 'data' column to the user table.
dbuytaert authored
331 function update_19() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
332 update_sql("ALTER TABLE users ADD data TEXT");
0683331 @dbuytaert - Added an 'data' column to the user table.
dbuytaert authored
333 }
334
dc8f6be - added default value to enable user block to update.php
Kjartan Mannes authored
335 function update_20() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
336 update_sql("INSERT INTO blocks SET name='User information', module='user', delta='0', status='2', weight='0', region='1', remove='0', path=''");
dc8f6be - added default value to enable user block to update.php
Kjartan Mannes authored
337 }
338
8678951 - nodes can now be set to static which will pin them to the front page a...
Kjartan Mannes authored
339 function update_21() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
340 update_sql("ALTER TABLE node ADD static int(2) DEFAULT '0' NOT NULL");
8678951 - nodes can now be set to static which will pin them to the front page a...
Kjartan Mannes authored
341 }
342
3c8de3e @dbuytaert - Changed the size of the data-field in the cache table.
dbuytaert authored
343 function update_22() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
344 update_sql("ALTER TABLE cache MODIFY data MEDIUMTEXT");
3c8de3e @dbuytaert - Changed the size of the data-field in the cache table.
dbuytaert authored
345 }
346
e3d2c46 - applied search patch.
Kjartan Mannes authored
347 function update_23() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
348 update_sql("CREATE TABLE search_index (word varchar(50) default NOT NULL, lno int(10) unsigned default NOT NULL, type varchar(16) default NOT NULL, count int(10) unsigned default NOT NULL, KEY lno (lno), KEY word (word))");
e3d2c46 - applied search patch.
Kjartan Mannes authored
349 }
350
5d9a8e3 @dbuytaert - Made the cloud module a lot more configurable: both the update interva...
dbuytaert authored
351 function update_24() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
352 update_sql("ALTER TABLE site ADD refresh int(11) NOT NULL");
353 update_sql("ALTER TABLE site ADD threshold int(11) NOT NULL");
354 update_sql("UPDATE site SET refresh = '7200'");
355 update_sql("UPDATE site SET threshold = '60'");
5d9a8e3 @dbuytaert - Made the cloud module a lot more configurable: both the update interva...
dbuytaert authored
356 }
357
5592761 This is a major change to the system, needs more testing!
Kjartan Mannes authored
358 function update_25() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
359 update_sql("UPDATE users SET theme = LOWER(theme)");
d8cd549 @dbuytaert - Added Marco's long-awaited taxonmy module and patches - a replacement
dbuytaert authored
360 }
361
362 function update_26() {
363 update_sql("CREATE TABLE vocabulary (
364 vid int UNSIGNED NOT NULL PRIMARY KEY auto_increment,
365 name varchar(255) NOT NULL,
366 description TEXT,
367 relations TINYINT UNSIGNED NOT NULL,
368 hierarchy TINYINT UNSIGNED NOT NULL,
369 multiple TINYINT UNSIGNED NOT NULL,
370 required TINYINT UNSIGNED NOT NULL,
371 types TEXT,
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
372 weight TINYINT NOT NULL)");
d8cd549 @dbuytaert - Added Marco's long-awaited taxonmy module and patches - a replacement
dbuytaert authored
373
374 update_sql("CREATE TABLE term_data (
375 tid int UNSIGNED NOT NULL PRIMARY KEY auto_increment,
376 vid int UNSIGNED NOT NULL,
377 name varchar(255) NOT NULL,
378 description TEXT,
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
379 weight TINYINT NOT NULL)");
d8cd549 @dbuytaert - Added Marco's long-awaited taxonmy module and patches - a replacement
dbuytaert authored
380
381 update_sql("CREATE TABLE term_hierarchy (
382 tid int UNSIGNED NOT NULL,
383 parent int UNSIGNED NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
384 )");
d8cd549 @dbuytaert - Added Marco's long-awaited taxonmy module and patches - a replacement
dbuytaert authored
385
386 update_sql("CREATE TABLE term_relation (
387 tid1 int UNSIGNED NOT NULL,
388 tid2 int UNSIGNED NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
389 )");
d8cd549 @dbuytaert - Added Marco's long-awaited taxonmy module and patches - a replacement
dbuytaert authored
390
391 update_sql("CREATE TABLE term_synonym (
392 tid int UNSIGNED NOT NULL,
393 name varchar(255) NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
394 )");
d8cd549 @dbuytaert - Added Marco's long-awaited taxonmy module and patches - a replacement
dbuytaert authored
395
396 update_sql("CREATE TABLE term_node (
397 nid int UNSIGNED NOT NULL,
398 tid int UNSIGNED NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
399 )");
400
401 update_sql("ALTER TABLE term_data ADD INDEX (vid)");
402 update_sql("ALTER TABLE term_hierarchy ADD INDEX (tid)");
403 update_sql("ALTER TABLE term_hierarchy ADD INDEX (parent)");
404 update_sql("ALTER TABLE term_relation ADD INDEX (tid1)");
405 update_sql("ALTER TABLE term_relation ADD INDEX (tid2)");
406 update_sql("ALTER TABLE term_synonym ADD INDEX (tid)");
407 update_sql("ALTER TABLE term_synonym ADD INDEX (name(3))");
408 update_sql("ALTER TABLE term_node ADD INDEX (nid)");
409 update_sql("ALTER TABLE term_node ADD INDEX (tid)");
86552cb - changed block, module and theme config pages to use checkboxes.
Kjartan Mannes authored
410 update_sql("UPDATE node SET comment = 2 WHERE comment = 1");
5592761 This is a major change to the system, needs more testing!
Kjartan Mannes authored
411 }
412
1b573fb - book log is now saved and shown when necessary.
Kjartan Mannes authored
413 function update_27() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
414 update_sql("ALTER TABLE book ADD log TEXT");
1b573fb - book log is now saved and shown when necessary.
Kjartan Mannes authored
415 }
416
0a966e1 Updated poll.module:
Steven Wittens authored
417 function update_28() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
418 update_sql("ALTER TABLE poll DROP lid");
0a966e1 Updated poll.module:
Steven Wittens authored
419 }
420
ae263bf @dbuytaert - Rewrote role management, splitting the table in two. There are no
dbuytaert authored
421 function update_29() {
422 update_sql("INSERT INTO permission (rid, perm) SELECT rid, perm FROM role");
423
424 $result = db_query("SELECT rid, name FROM role");
425 while ($role = db_fetch_object($result)) {
f38860f - updated the updates.
Kjartan Mannes authored
426 update_sql("UPDATE users SET rid = ". $role->rid ." WHERE role = '". $role->name ."'");
ae263bf @dbuytaert - Rewrote role management, splitting the table in two. There are no
dbuytaert authored
427 }
428
429 update_sql("ALTER TABLE users DROP role");
430 update_sql("ALTER TABLE role DROP perm");
431 }
432
a4b5005 - merged block and box modules. modules/box.module should be removed
Kjartan Mannes authored
433 function update_30() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
434 update_sql("ALTER TABLE blocks ADD custom tinyint(2) not null");
435 update_sql("UPDATE blocks SET module = 'block' WHERE module = 'boxes'");
436 update_sql("UPDATE blocks SET status = 1, custom = 1 WHERE status = 1");
437 update_sql("UPDATE blocks SET status = 1, custom = 0 WHERE status = 2");
a4b5005 - merged block and box modules. modules/box.module should be removed
Kjartan Mannes authored
438 }
439
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
440 function update_31() {
441 include_once("modules/taxonomy.module");
f3c8757 @dbuytaert - Ran the code through 'scripts/code-clean.sh': removed trailing whitesp...
dbuytaert authored
442
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
443 print "Wiping tables.<br />";
367ae7a - tweaked password changes.
Kjartan Mannes authored
444 /*db_query("DELETE FROM vocabulary");
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
445 db_query("DELETE FROM term_data");
446 db_query("DELETE FROM term_node");
367ae7a - tweaked password changes.
Kjartan Mannes authored
447 db_query("DELETE FROM term_hierarchy");**/
f3c8757 @dbuytaert - Ran the code through 'scripts/code-clean.sh': removed trailing whitesp...
dbuytaert authored
448
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
449 print "Creating collections.<br />";
367ae7a - tweaked password changes.
Kjartan Mannes authored
450 $offset = db_result(db_query("SELECT MAX(vid) AS high FROM vocabulary"), 0);
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
451 $result = db_query("SELECT * FROM collection");
452 while ($c = db_fetch_object($result)) {
367ae7a - tweaked password changes.
Kjartan Mannes authored
453 $offset++;
454 $collections[$c->name] = $offset;
455 db_query("INSERT INTO vocabulary SET vid = '$offset', name = '$c->name', types = '". str_replace(" ", "", $c->types) ."'");
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
456 }
f3c8757 @dbuytaert - Ran the code through 'scripts/code-clean.sh': removed trailing whitesp...
dbuytaert authored
457
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
458 print "Creating terms.<br />";
459 $result = db_query("SELECT * FROM tag");
367ae7a - tweaked password changes.
Kjartan Mannes authored
460 $i = db_result(db_query("SELECT MAX(tid) AS high FROM term_data"), 0) + 1;
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
461 while ($t = db_fetch_object($result)) {
462 foreach (explode(", ", $t->collections) as $c) {
463 if ($collections[$c]) {
464 db_query("INSERT INTO term_data SET tid = '$i', vid = '$collections[$c]', name = '$t->name'");
465 db_query("INSERT INTO term_hierarchy SET tid = '$i', parent = '0'");
466 $terms[$t->name] = $i;
467 $i++;
468 }
469 }
470 }
f3c8757 @dbuytaert - Ran the code through 'scripts/code-clean.sh': removed trailing whitesp...
dbuytaert authored
471
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
472 print "Linking nodes with terms.<br />";
473 $result = db_query("SELECT nid,attributes FROM node WHERE attributes != ''");
474 while ($node = db_fetch_object($result)) {
87cdd89 - attempting to fix tag -> tax conversion.
Kjartan Mannes authored
475 $tag = db_fetch_object(db_query("SELECT name FROM tag WHERE attributes = '$node->attributes'"));
476 $tag = trim($tag->name);
477 if ($tag) {
478 if ($terms[$tag]) {
479 db_query("INSERT INTO term_node SET nid = '$node->nid', tid = '$terms[$tag]'");
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
480 }
87cdd89 - attempting to fix tag -> tax conversion.
Kjartan Mannes authored
481 else {
482 $errors[$tag] = "$tag";
483 }
484 }
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
485 }
f3c8757 @dbuytaert - Ran the code through 'scripts/code-clean.sh': removed trailing whitesp...
dbuytaert authored
486
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
487 if (count($errors)) {
488 asort($errors);
489 print "<br /><br />Terms not found:<br /><pre> ". implode("\n ", $errors) ."</pre>";
490 }
f3c8757 @dbuytaert - Ran the code through 'scripts/code-clean.sh': removed trailing whitesp...
dbuytaert authored
491
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
492 // Clean up meta tag system
4a28077 - adding descriptions to modules (thanks Joe + Scott).
Kjartan Mannes authored
493 update_sql("DROP TABLE collection");
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
494 update_sql("DROP TABLE tag");
4a28077 - adding descriptions to modules (thanks Joe + Scott).
Kjartan Mannes authored
495 update_sql("ALTER TABLE node DROP attributes");
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
496 }
497
39373da @dbuytaert - Added some indices.
dbuytaert authored
498 function update_32() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
499 update_sql("ALTER TABLE users ADD index (sid(4))");
500 update_sql("ALTER TABLE users ADD index (timestamp)");
76b47f2 @dbuytaert - Make sure user names are unique.
dbuytaert authored
501 update_sql("ALTER TABLE users ADD UNIQUE KEY name (name)");
39373da @dbuytaert - Added some indices.
dbuytaert authored
502 }
503
e1e75f5 @dbuytaert - Update the existing variables.
dbuytaert authored
504 function update_33() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
505 $result = db_query("SELECT * FROM variable WHERE value NOT LIKE 's:%;'");
ec59398 - feed table should have not null defined for refresh and timestamp.
Kjartan Mannes authored
506 // NOTE: the "WHERE"-part of the query above avoids variables to get serialized twice.
e1e75f5 @dbuytaert - Update the existing variables.
dbuytaert authored
507 while ($variable = db_fetch_object($result)) {
508 variable_set($variable->name, $variable->value);
509 }
510 }
511
ec59398 - feed table should have not null defined for refresh and timestamp.
Kjartan Mannes authored
512 function update_34() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
513 update_sql("ALTER TABLE feed MODIFY refresh int(10) NOT NULL default '0'");
514 update_sql("ALTER TABLE feed MODIFY timestamp int (10) NOT NULL default '0'");
062e7d7 @dbuytaert - Added missing query to change the session field from VARCHAR(32) to TE...
dbuytaert authored
515 update_sql("ALTER TABLE users CHANGE session session TEXT");
ec59398 - feed table should have not null defined for refresh and timestamp.
Kjartan Mannes authored
516 }
517
e035785 @dbuytaert - Added indices for the poll module. Patch by Marco.
dbuytaert authored
518 function update_35() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
519 update_sql("ALTER TABLE poll_choices ADD INDEX (nid)");
e035785 @dbuytaert - Added indices for the poll module. Patch by Marco.
dbuytaert authored
520 }
521
e04f6d2 @dbuytaert - Made the rating module and its SQL table ASNI compliant. Patch by jaa...
dbuytaert authored
522 function update_36() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
523 update_sql("ALTER TABLE rating CHANGE old previous int(6) NOT NULL default '0'");
524 update_sql("ALTER TABLE rating CHANGE new current int(6) NOT NULL default '0'");
e04f6d2 @dbuytaert - Made the rating module and its SQL table ASNI compliant. Patch by jaa...
dbuytaert authored
525 }
526
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
527 function update_37() {
528
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
529 update_sql("DROP TABLE IF EXISTS sequences");
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
530
531 update_sql("CREATE TABLE sequences (
a28f818 @dbuytaert - Changed "$watchdog->message" from type "varchar(255)" to type "text".
dbuytaert authored
532 name VARCHAR(255) NOT NULL PRIMARY KEY,
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
533 id INT UNSIGNED NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
534 ) TYPE=MyISAM");
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
535
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
536 if ($max = db_result(db_query("SELECT MAX(nid) FROM node"))) {
537 update_sql("REPLACE INTO sequences VALUES ('node', $max)");
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
538 }
539
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
540 if ($max = db_result(db_query("SELECT MAX(cid) FROM comments"))) {
541 update_sql("REPLACE INTO sequences VALUES ('comments', $max)");
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
542 }
543 // NOTE: move the comments bit down as soon as we switched to use the new comment module!
544
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
545 if ($max = db_result(db_query("SELECT MAX(tid) FROM term_data"))) {
546 update_sql("REPLACE INTO sequences VALUES ('term_data', $max)");
bfe5b85 @dbuytaert - Applied a (modified) version of Marco's SQL sequence patch.
dbuytaert authored
547 }
548 }
549
a28f818 @dbuytaert - Changed "$watchdog->message" from type "varchar(255)" to type "text".
dbuytaert authored
550 function update_38() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
551 update_sql("ALTER TABLE watchdog CHANGE message message text NOT NULL default ''");
a28f818 @dbuytaert - Changed "$watchdog->message" from type "varchar(255)" to type "text".
dbuytaert authored
552 }
553
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
554 function update_39() {
555 update_sql("DROP TABLE moderate");
556
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
557 update_sql("ALTER TABLE comments ADD score MEDIUMINT NOT NULL");
558 update_sql("ALTER TABLE comments ADD status TINYINT UNSIGNED NOT NULL");
559 update_sql("ALTER TABLE comments ADD users MEDIUMTEXT");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
560
561 update_sql("CREATE TABLE moderation_votes (
562 mid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
563 vote VARCHAR(255),
564 weight TINYINT NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
565 )");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
566
567 update_sql("CREATE TABLE moderation_roles (
568 rid INT UNSIGNED NOT NULL,
569 mid INT UNSIGNED NOT NULL,
570 value TINYINT NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
571 )");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
572
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
573 update_sql("ALTER TABLE moderation_roles ADD INDEX (rid)");
574 update_sql("ALTER TABLE moderation_roles ADD INDEX (mid)");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
575
576 update_sql("CREATE TABLE moderation_filters (
577 fid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
578 filter VARCHAR(255) NOT NULL,
579 minimum SMALLINT NOT NULL
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
580 )");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
581
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
582 update_sql("DELETE FROM moderation_votes");
583 update_sql("INSERT INTO moderation_votes VALUES (1, '+1', 0)");
584 update_sql("INSERT INTO moderation_votes VALUES (2, '-1', 1)");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
585
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
586 update_sql("DELETE FROM moderation_roles");
587 update_sql("INSERT INTO moderation_roles VALUES (2, 1, 1)");
588 update_sql("INSERT INTO moderation_roles VALUES (2, 2, -1)");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
589
590 update_sql("CREATE TABLE forum (
591 nid int unsigned not null primary key,
592 icon varchar(255) not null,
593 shadow int unsigned not null
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
594 )");
9232626 @dbuytaert - Commited Marco's new comment module and forum module!!!
dbuytaert authored
595 }
596
85c6e90 @dbuytaert - Made sure the sequence table is properly initialized for comments.
dbuytaert authored
597 function update_40() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
598 if ($max = db_result(db_query("SELECT MAX(cid) FROM comments"))) {
599 update_sql("REPLACE INTO sequences VALUES ('comments', $max)");
85c6e90 @dbuytaert - Made sure the sequence table is properly initialized for comments.
dbuytaert authored
600 }
601 }
602
fcae703 @dbuytaert - Committed Jeremy's incarnation of the statistics module. Last minutes
dbuytaert authored
603 function update_41() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
604 update_sql("CREATE TABLE statistics (
605 nid int(11) NOT NULL,
606 totalcount bigint UNSIGNED DEFAULT '0' NOT NULL,
607 daycount mediumint UNSIGNED DEFAULT '0' NOT NULL,
608 timestamp int(11) UNSIGNED DEFAULT '0' NOT NULL,
609 PRIMARY KEY (nid),
610 INDEX (totalcount),
611 INDEX (daycount),
612 INDEX (timestamp)
613 )");
614
615 update_sql("CREATE TABLE accesslog (
616 nid int(11) UNSIGNED DEFAULT '0',
617 url varchar(255),
618 hostname varchar(128),
619 uid int(10) UNSIGNED DEFAULT '0',
620 timestamp int(11) UNSIGNED NOT NULL
621 )");
fcae703 @dbuytaert - Committed Jeremy's incarnation of the statistics module. Last minutes
dbuytaert authored
622 }
623
b60b9ca - removed function module_rehash().
Kjartan Mannes authored
624 function update_42() {
625 update_sql("DROP TABLE modules");
626 update_sql("DROP TABLE layout");
627 update_sql("DROP TABLE referrer");
628 }
629
8d103a0 @dbuytaert - Committed Marco's block rewrite:
dbuytaert authored
630 function update_43() {
631 update_sql("ALTER TABLE blocks DROP remove");
632 update_sql("ALTER TABLE blocks DROP name");
acd0cb0 - blocks != boxes. Sorry :)
Kjartan Mannes authored
633 update_sql("UPDATE boxes SET type = 0 WHERE type = 1");
634 update_sql("UPDATE boxes SET type = 1 WHERE type = 2");
8d103a0 @dbuytaert - Committed Marco's block rewrite:
dbuytaert authored
635 }
636
b3abbc4 @dbuytaert Patch by Natrak:
dbuytaert authored
637 function update_44() {
638 update_sql("UPDATE system SET filename = CONCAT('modules/', filename) WHERE type = 'module'");
639 }
640
56d72a9 @dbuytaert - Added Stefan's page module improvements.
dbuytaert authored
641 function update_45() {
642 update_sql("ALTER TABLE page ADD description varchar(128) NOT NULL default ''");
643 }
644
b6b24c2 @dbuytaert Applied patch by Natrak:
dbuytaert authored
645 function update_46() {
646 update_sql("ALTER TABLE cache ADD created int(11) NOT NULL default '0'");
647 }
648
22fa9ed @dbuytaert - Refactored the administration pages.
dbuytaert authored
649 function update_47() {
650 update_sql("CREATE TABLE menu (
651 name varchar(255) NOT NULL default '',
652 link varchar(255) NOT NULL default '',
653 help TEXT default '',
654 title varchar(255) NOT NULL default '',
655 parent varchar(255) NOT NULL default '',
656 weight tinyint(4) DEFAULT '0' NOT NULL,
657 overview tinyint(1) DEFAULT '0' NOT NULL
658 );");
659 }
660
0475d4f @dbuytaert Patch by Marco:
dbuytaert authored
661 function update_48() {
3c7d0f9 @dbuytaert - Fixed typo. Patch by Marco.
dbuytaert authored
662 if ($max = db_result(db_query("SELECT MAX(vid) FROM vocabulary"))) {
0475d4f @dbuytaert Patch by Marco:
dbuytaert authored
663 update_sql("REPLACE INTO sequences VALUES ('vocabulary', $max)");
664 }
665 }
666
8a63646 @dbuytaert - Added an extra parameter to watchdog() which lets you specifiy an "act...
dbuytaert authored
667 function update_49() {
668 update_sql("ALTER TABLE watchdog ADD link varchar(255) DEFAULT '' NULL");
669 }
670
89b2069 @dbuytaert - Clean URL patch.
dbuytaert authored
671 function update_50() {
672 update_content("%admin.php%");
673 update_content("%module.php%");
674 update_content("%node.php%");
675 }
676
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
677 function update_upgrade3() {
1e97129 - fixing SQL queries. Do not append ; to SQL queries in PHP.
Kjartan Mannes authored
678 update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1)");
679 update_sql("INSERT INTO system VALUES ('block.module','block','module','',1)");
680 update_sql("INSERT INTO system VALUES ('blog.module','blog','module','',1)");
681 update_sql("INSERT INTO system VALUES ('book.module','book','module','',1)");
682 update_sql("INSERT INTO system VALUES ('cloud.module','cloud','module','',1)");
683 update_sql("INSERT INTO system VALUES ('comment.module','comment','module','',1)");
684 update_sql("INSERT INTO system VALUES ('forum.module','forum','module','',1)");
685 update_sql("INSERT INTO system VALUES ('help.module','help','module','',1)");
686 update_sql("INSERT INTO system VALUES ('import.module','import','module','',1)");
687 update_sql("INSERT INTO system VALUES ('locale.module','locale','module','',1)");
688 update_sql("INSERT INTO system VALUES ('node.module','node','module','',1)");
689 update_sql("INSERT INTO system VALUES ('page.module','page','module','',1)");
690 update_sql("INSERT INTO system VALUES ('poll.module','poll','module','',1)");
691 update_sql("INSERT INTO system VALUES ('queue.module','queue','module','',1)");
692 update_sql("INSERT INTO system VALUES ('rating.module','rating','module','',1)");
693 update_sql("INSERT INTO system VALUES ('search.module','search','module','',1)");
694 update_sql("INSERT INTO system VALUES ('statistics.module','statistics','module','',1)");
695 update_sql("INSERT INTO system VALUES ('story.module','story','module','',1)");
696 update_sql("INSERT INTO system VALUES ('taxonomy.module','taxonomy','module','',1)");
697 update_sql("INSERT INTO system VALUES ('themes/example/example.theme','example','theme','Internet explorer, Netscape, Opera, Lynx',1)");
698 update_sql("INSERT INTO system VALUES ('themes/goofy/goofy.theme','goofy','theme','Internetexplorer, Netscape, Opera',1)");
699 update_sql("INSERT INTO system VALUES ('themes/marvin/marvin.theme','marvin','theme','Internet explorer, Netscape, Opera',1)");
700 update_sql("INSERT INTO system VALUES ('themes/unconed/unconed.theme','unconed','theme','Internet explorer, Netscape, Opera',1)");
701 update_sql("INSERT INTO system VALUES ('tracker.module','tracker','module','',1)");
702 update_sql("REPLACE variable SET value = 'marvin', name = 'theme_default'");
703 update_sql("REPLACE blocks SET name = 'User information', module = 'user', delta = '0', status = '1'");
704 update_sql("REPLACE blocks SET name = 'Log in', module = 'user', delta = '1', status = '1'");
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
705 }
706
58152c4 @dbuytaert Integrated Marco's generic/improved cache into Drupal. Requires an
dbuytaert authored
707 /*
708 ** System functions
709 */
710
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
711 function update_sql($sql) {
712 global $edit;
f38860f - updated the updates.
Kjartan Mannes authored
713 print nl2br(htmlentities($sql)) ." ";
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
714 $result = db_query($sql);
715 if ($result) {
716 print "<font color=\"green\">OK</font>\n";
717 return 1;
718 }
719 else {
720 print "<font color=\"red\">FAILED</font>\n";
721 if ($edit["bail"]) {
722 die("Fatal error. Bailing");
723 }
724 return 0;
725 }
726 }
727
728 function update_data($start) {
729 global $mysql_updates;
730 $mysql_updates = array_slice($mysql_updates, ($start-- ? $start : 0));
86552cb - changed block, module and theme config pages to use checkboxes.
Kjartan Mannes authored
731 foreach ($mysql_updates as $date => $func) {
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
732 print "<b>$date</b><br />\n<pre>\n";
733 $func();
734 variable_set("update_start", $date);
735 print "</pre>\n";
736 }
737 }
738
739 function update_page() {
740 global $op, $edit, $user, $mysql_updates;
741
742 switch ($op) {
743 case "Update":
744 // make sure we have updates to run.
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
745 print "<html><h1>Drupal database update</h1>";
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
746 print "<b>&raquo; <a href=\"index.php\">home</a></b><br />\n";
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored
747 print "<b>&raquo; ". l("administer", "admin"). "</b><br />\n";
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
748 if ($edit["start"] == -1) {
749 print "No updates to perform.";
750 }
751 else {
752 update_data($edit["start"]);
753 }
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored
754 print "<br />Updates were attempted. If you see no failures above, you may proceed happily to the ". l("admin pages", "admin"). ".";
755 print " Otherwise, you may need to update your database manually.";
497ab79 - added notes to update.php which you will see before you can perform up...
Kjartan Mannes authored
756 print "</html>";
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
757 break;
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
758 case "upgrade3":
759 // make sure we have updates to run.
760 print "<html><h1>Drupal upgrade</h1>";
761 print "<b>&raquo; <a href=\"index.php\">home</a></b><br />\n";
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored
762 print "<b>&raquo; ". l("admin pages", "admin"). "</b><br /><br />\n";
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
763 if ($edit["start"] == -1) {
764 print "No updates to perform.";
765 }
766 else {
767 update_data($edit["start"]);
768 }
769 print "<pre>\n";
770 update_upgrade3();
771 print "</pre>\n";
772 print "</html>";
773 break;
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
774 case "upgrade4":
775 variable_set("update_start", "2002-05-15");
776 // fall through:
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
777 default:
778 $start = variable_get("update_start", 0);
779 $dates[] = "All";
780 $i = 1;
86552cb - changed block, module and theme config pages to use checkboxes.
Kjartan Mannes authored
781 foreach ($mysql_updates as $date => $sql) {
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
782 $dates[$i++] = $date;
783 if ($date == $start) {
784 $selected = $i;
785 }
786 }
062e7d7 @dbuytaert - Added missing query to change the session field from VARCHAR(32) to TE...
dbuytaert authored
787 $dates[$i] = "No updates available";
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
788
789 // make update form and output it.
790 $form .= form_select("Perform updates since", "start", (isset($selected) ? $selected : -1), $dates);
f38860f - updated the updates.
Kjartan Mannes authored
791 $form .= form_select("Stop on errors", "bail", 0, array("Disabled", "Enabled"), "Don't forget to backup your database before performing an update.");
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
792 $form .= form_submit("Update");
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
793 print "<html><h1>Drupal database update</h1>";
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
794 print form($form);
497ab79 - added notes to update.php which you will see before you can perform up...
Kjartan Mannes authored
795 print "</html>";
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
796 break;
797 }
798 }
799
89b2069 @dbuytaert - Clean URL patch.
dbuytaert authored
800 function update_content($pattern) {
801
802 $result = db_query("SELECT n.nid, c.cid, c.subject FROM node n LEFT JOIN comments c ON n.nid = c.nid WHERE c.comment LIKE '%s'", $pattern);
803 while ($comment = db_fetch_object($result)) {
804 watchdog("special", "upgrade possibly affects comment '$comment->subject'", "<a href=\"node.php?id=$comment->nid&cid=$comment->cid#$comment->cid\">view post</a>");
805 }
806
807 $result = db_query("SELECT nid, title FROM node WHERE teaser LIKE '%s' OR body LIKE '%s'", $pattern, $pattern);
808 while ($node = db_fetch_object($result)) {
809 watchdog("special", "upgrade possibly affects node '$node->title'", "<a href=\"node.php?id=$node->nid\">view post</a>");
810 }
811 }
812
497ab79 - added notes to update.php which you will see before you can perform up...
Kjartan Mannes authored
813 function update_info() {
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
814
815 print "<html><h1>Drupal database update</h1>";
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
816 print "<ol>\n";
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
817 print "<li>Use this script to <b>upgrade an existing Drupal installation</b>. You don't need this script when installing Drupal from scratch.</li>";
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored
818 print "<li>Before doing anything, backup your database. This process will change your database and its values, and some things might get lost.</li>\n";
819 print "<li>Don't run this script twice as it may cause problems.</p></li>\n";
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
820 print "<li>";
821 print "Click the proper link below:<br />";
822 print "<p><b>&raquo; <a href=\"update.php?op=upgrade4\">Upgrade 4.0.x to 4.1.x</a></b></p>\n";
823 print "<p><b>&raquo; <a href=\"update.php?op=update\">Upgrade to CVS</a></b></p>\n";
824 print "<p><b>&raquo; <a href=\"update.php?op=upgrade3\">Upgrade 3.0.x to 4.0.0</a></b> (Warning: clicking this link will update your database without confirmation.)</p>\n";
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored
825 print "<p>If you are upgrading from <b>Drupal 3.0.x</b>, you'll want to run these queries manually <b>before proceeding to step 5</b>:</p>\n";
497ab79 - added notes to update.php which you will see before you can perform up...
Kjartan Mannes authored
826 print "<pre>\n";
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
827 print " ALTER TABLE watchdog CHANGE user uid int(10) DEFAULT '0' NOT NULL;\n";
828 print " ALTER TABLE watchdog CHANGE id wid int(5) DEFAULT '0' NOT NULL auto_increment;\n";
829 print " ALTER TABLE users ADD sid varchar(32) DEFAULT '' NOT NULL;\n";
830 print " ALTER TABLE users ADD session TEXT;\n";
831 print " ALTER TABLE users CHANGE last_host hostname varchar(128) DEFAULT '' NOT NULL;\n";
832 print " ALTER TABLE users CHANGE last_access timestamp int(11) DEFAULT '0' NOT NULL;\n";
833 print " CREATE TABLE system (filename varchar(255) NOT NULL default '', name varchar(255) NOT NULL default '', type varchar(255) NOT NULL default '', description varchar(255) NOT NULL default '', status int(2) NOT NULL default '0', PRIMARY KEY (filename));\n";
834 print " CREATE TABLE permission (rid INT UNSIGNED NOT NULL, perm TEXT, tid INT UNSIGNED NOT NULL, KEY (rid));\n";
835 print " INSERT INTO permission (rid, perm) SELECT rid, perm FROM role;\n";
836 print " ALTER TABLE users ADD rid INT UNSIGNED NOT NULL;\n";
837 print "</pre>\n";
838 print "</li>";
839 print "<li>Go through the various administration pages to change the existing and new settings to your liking.</li>\n";
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
840 print "</ol>";
497ab79 - added notes to update.php which you will see before you can perform up...
Kjartan Mannes authored
841 print "</html>";
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
842 }
497ab79 - added notes to update.php which you will see before you can perform up...
Kjartan Mannes authored
843
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
844 if ($op) {
845 include_once "includes/common.inc";
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored
846
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
847 // Access check:
848 if ($user->uid == 1) {
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored
849
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
850 update_page();
851 }
852 else {
286871d @dbuytaert - Some changes to the update.php script: revised the instructions a bit,
dbuytaert authored
853 print "Access denied. You are not authorized to access to this page. Please log in as the user with user ID #1 or edit <code>update.php</code> to by-pass this access check; search for <code>\$user->uid == 1</code> near the bottom of the file.";
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored
854 }
855 }
856 else {
857 update_info();
0a4f99e - added update.php to replace the updates/* files to make future upgrade...
Kjartan Mannes authored
858 }
859 ?>
Something went wrong with that request. Please try again.