r75347 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75346‎ | r75347 | r75348 >
Date:11:07, 25 October 2010
Author:freakolowsky
Status:resolved
Tags:
Comment:
* Installer for Oracle fixes
* added Main Page creation within install
* added MEDIAWIKI_INSTALL constant; some scripts still use it
* started OracleUpgrader scripts for upgrade from 1.16
* fixed some not null defaults that comply with mysql data type default on not null fields
* FKs made defferable
Modified paths:
  • /trunk/phase3/config/new-index.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/OracleInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/OracleUpdater.php (modified) (history)
  • /trunk/phase3/maintenance/oracle/archives (added) (history)
  • /trunk/phase3/maintenance/oracle/archives/patch_namespace_defaults.sql (added) (history)
  • /trunk/phase3/maintenance/oracle/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/oracle/archives/patch_namespace_defaults.sql
@@ -0,0 +1,17 @@
 2+define mw_prefix='{$wgDBprefix}';
 3+
 4+ALTER TABLE &mw_prefix.page MODIFY page_namespace DEFAULT 0;
 5+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
 6+ALTER TABLE &mw_prefix.pagelinks MODIFY pl_namespace DEFAULT 0;
 7+ALTER TABLE &mw_prefix.templatelinks MODIFY tl_namespace DEFAULT 0;
 8+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_namespace DEFAULT 0;
 9+ALTER TABLE &mw_prefix.querycache MODIFY qc_namespace DEFAULT 0;
 10+ALTER TABLE &mw_prefix.logging MODIFY log_namespace DEFAULT 0;
 11+ALTER TABLE &mw_prefix.job MODIFY job_namespace DEFAULT 0;
 12+ALTER TABLE &mw_prefix.redirect MODIFY rd_namespace DEFAULT 0;
 13+ALTER TABLE &mw_prefix.protected_titles MODIFY pt_namespace DEFAULT 0;
 14+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
 15+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
 16+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
 17+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
 18+
Property changes on: trunk/phase3/maintenance/oracle/archives/patch_namespace_defaults.sql
___________________________________________________________________
Added: svn:eol-style
119 + native
Index: trunk/phase3/maintenance/oracle/tables.sql
@@ -29,14 +29,14 @@
3030 VALUES (user_user_id_seq.nextval,'Anonymous','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0);
3131
3232 CREATE TABLE &mw_prefix.user_groups (
33 - ug_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 33+ ug_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
3434 ug_group VARCHAR2(16) NOT NULL
3535 );
3636 CREATE UNIQUE INDEX &mw_prefix.user_groups_u01 ON &mw_prefix.user_groups (ug_user,ug_group);
3737 CREATE INDEX &mw_prefix.user_groups_i01 ON &mw_prefix.user_groups (ug_group);
3838
3939 CREATE TABLE &mw_prefix.user_newtalk (
40 - user_id NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 40+ user_id NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
4141 user_ip VARCHAR2(40) NULL,
4242 user_last_timestamp TIMESTAMP(6) WITH TIME ZONE
4343 );
@@ -51,20 +51,19 @@
5252 CREATE UNIQUE INDEX &mw_prefix.user_properties_u01 on &mw_prefix.user_properties (up_user,up_property);
5353 CREATE INDEX &mw_prefix.user_properties_i01 on &mw_prefix.user_properties (up_property);
5454
55 -
5655 CREATE SEQUENCE page_page_id_seq;
5756 CREATE TABLE &mw_prefix.page (
5857 page_id NUMBER NOT NULL,
59 - page_namespace NUMBER NOT NULL,
 58+ page_namespace NUMBER DEFAULT 0 NOT NULL,
6059 page_title VARCHAR2(255) NOT NULL,
6160 page_restrictions VARCHAR2(255),
6261 page_counter NUMBER DEFAULT 0 NOT NULL,
63 - page_is_redirect CHAR(1) DEFAULT 0 NOT NULL,
64 - page_is_new CHAR(1) DEFAULT 0 NOT NULL,
 62+ page_is_redirect CHAR(1) DEFAULT '0' NOT NULL,
 63+ page_is_new CHAR(1) DEFAULT '0' NOT NULL,
6564 page_random NUMBER(15,14) NOT NULL,
6665 page_touched TIMESTAMP(6) WITH TIME ZONE,
67 - page_latest NUMBER NOT NULL, -- FK?
68 - page_len NUMBER NOT NULL
 66+ page_latest NUMBER DEFAULT 0 NOT NULL, -- FK?
 67+ page_len NUMBER DEFAULT 0 NOT NULL
6968 );
7069 ALTER TABLE &mw_prefix.page ADD CONSTRAINT &mw_prefix.page_pk PRIMARY KEY (page_id);
7170 CREATE UNIQUE INDEX &mw_prefix.page_u01 ON &mw_prefix.page (page_namespace,page_title);
@@ -82,10 +81,10 @@
8382 CREATE SEQUENCE revision_rev_id_seq;
8483 CREATE TABLE &mw_prefix.revision (
8584 rev_id NUMBER NOT NULL,
86 - rev_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,
 85+ rev_page NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
8786 rev_text_id NUMBER NULL,
8887 rev_comment VARCHAR2(255),
89 - rev_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id),
 88+ rev_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) DEFERRABLE INITIALLY DEFERRED,
9089 rev_user_text VARCHAR2(255) NOT NULL,
9190 rev_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
9291 rev_minor_edit CHAR(1) DEFAULT '0' NOT NULL,
@@ -109,18 +108,18 @@
110109 ALTER TABLE &mw_prefix.pagecontent ADD CONSTRAINT &mw_prefix.pagecontent_pk PRIMARY KEY (old_id);
111110
112111 CREATE TABLE &mw_prefix.archive (
113 - ar_namespace NUMBER NOT NULL,
 112+ ar_namespace NUMBER DEFAULT 0 NOT NULL,
114113 ar_title VARCHAR2(255) NOT NULL,
115114 ar_text CLOB,
116115 ar_comment VARCHAR2(255),
117 - ar_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 116+ ar_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
118117 ar_user_text VARCHAR2(255) NOT NULL,
119118 ar_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
120119 ar_minor_edit CHAR(1) DEFAULT '0' NOT NULL,
121120 ar_flags VARCHAR2(255),
122121 ar_rev_id NUMBER,
123122 ar_text_id NUMBER,
124 - ar_deleted NUMBER DEFAULT '0' NOT NULL,
 123+ ar_deleted CHAR(1) DEFAULT '0' NOT NULL,
125124 ar_len NUMBER,
126125 ar_page_id NUMBER,
127126 ar_parent_id NUMBER
@@ -130,23 +129,23 @@
131130 CREATE INDEX &mw_prefix.archive_i03 ON &mw_prefix.archive (ar_namespace, ar_title, ar_rev_id);
132131
133132 CREATE TABLE &mw_prefix.pagelinks (
134 - pl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
135 - pl_namespace NUMBER NOT NULL,
 133+ pl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
 134+ pl_namespace NUMBER DEFAULT 0 NOT NULL,
136135 pl_title VARCHAR2(255) NOT NULL
137136 );
138137 CREATE UNIQUE INDEX &mw_prefix.pagelinks_u01 ON &mw_prefix.pagelinks (pl_from,pl_namespace,pl_title);
139138 CREATE UNIQUE INDEX &mw_prefix.pagelinks_u02 ON &mw_prefix.pagelinks (pl_namespace,pl_title,pl_from);
140139
141140 CREATE TABLE &mw_prefix.templatelinks (
142 - tl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
143 - tl_namespace NUMBER NOT NULL,
 141+ tl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
 142+ tl_namespace NUMBER DEFAULT 0 NOT NULL,
144143 tl_title VARCHAR2(255) NOT NULL
145144 );
146145 CREATE UNIQUE INDEX &mw_prefix.templatelinks_u01 ON &mw_prefix.templatelinks (tl_from,tl_namespace,tl_title);
147146 CREATE UNIQUE INDEX &mw_prefix.templatelinks_u02 ON &mw_prefix.templatelinks (tl_namespace,tl_title,tl_from);
148147
149148 CREATE TABLE &mw_prefix.imagelinks (
150 - il_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 149+ il_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
151150 il_to VARCHAR2(255) NOT NULL
152151 );
153152 CREATE UNIQUE INDEX &mw_prefix.imagelinks_u01 ON &mw_prefix.imagelinks (il_from,il_to);
@@ -154,7 +153,7 @@
155154
156155
157156 CREATE TABLE &mw_prefix.categorylinks (
158 - cl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 157+ cl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
159158 cl_to VARCHAR2(255) NOT NULL,
160159 cl_sortkey VARCHAR2(230),
161160 cl_sortkey_prefix VARCHAR2(255) DEFAULT '' NOT NULL,
@@ -181,7 +180,7 @@
182181 CREATE INDEX &mw_prefix.category_i01 ON &mw_prefix.category (cat_pages);
183182
184183 CREATE TABLE &mw_prefix.externallinks (
185 - el_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 184+ el_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
186185 el_to VARCHAR2(2048) NOT NULL,
187186 el_index VARCHAR2(2048) NOT NULL
188187 );
@@ -197,7 +196,7 @@
198197 CREATE UNIQUE INDEX &mw_prefix.external_user_u01 ON &mw_prefix.external_user (eu_external_id);
199198
200199 CREATE TABLE &mw_prefix.langlinks (
201 - ll_from NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,
 200+ ll_from NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
202201 ll_lang VARCHAR2(20),
203202 ll_title VARCHAR2(255)
204203 );
@@ -233,8 +232,8 @@
234233 CREATE TABLE &mw_prefix.ipblocks (
235234 ipb_id NUMBER NOT NULL,
236235 ipb_address VARCHAR2(255) NULL,
237 - ipb_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
238 - ipb_by NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 236+ ipb_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
 237+ ipb_by NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
239238 ipb_by_text VARCHAR2(255) NOT NULL,
240239 ipb_reason VARCHAR2(255) NOT NULL,
241240 ipb_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
@@ -258,19 +257,19 @@
259258
260259 CREATE TABLE &mw_prefix.image (
261260 img_name VARCHAR2(255) NOT NULL,
262 - img_size NUMBER NOT NULL,
263 - img_width NUMBER NOT NULL,
264 - img_height NUMBER NOT NULL,
 261+ img_size NUMBER DEFAULT 0 NOT NULL,
 262+ img_width NUMBER DEFAULT 0 NOT NULL,
 263+ img_height NUMBER DEFAULT 0 NOT NULL,
265264 img_metadata CLOB,
266 - img_bits NUMBER,
 265+ img_bits NUMBER DEFAULT 0 NOT NULL,
267266 img_media_type VARCHAR2(32),
268267 img_major_mime VARCHAR2(32) DEFAULT 'unknown',
269268 img_minor_mime VARCHAR2(100) DEFAULT 'unknown',
270269 img_description VARCHAR2(255),
271 - img_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 270+ img_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
272271 img_user_text VARCHAR2(255) NOT NULL,
273272 img_timestamp TIMESTAMP(6) WITH TIME ZONE,
274 - img_sha1 VARCHAR2(32)
 273+ img_sha1 VARCHAR2(32)
275274 );
276275 ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.image_pk PRIMARY KEY (img_name);
277276 CREATE INDEX &mw_prefix.image_i01 ON &mw_prefix.image (img_user_text,img_timestamp);
@@ -280,14 +279,14 @@
281280
282281
283282 CREATE TABLE &mw_prefix.oldimage (
284 - oi_name VARCHAR2(255) NOT NULL REFERENCES &mw_prefix.image(img_name),
 283+ oi_name VARCHAR2(255) DEFAULT 0 NOT NULL REFERENCES &mw_prefix.image(img_name) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
285284 oi_archive_name VARCHAR2(255),
286 - oi_size NUMBER NOT NULL,
287 - oi_width NUMBER NOT NULL,
288 - oi_height NUMBER NOT NULL,
289 - oi_bits NUMBER NOT NULL,
 285+ oi_size NUMBER DEFAULT 0 NOT NULL,
 286+ oi_width NUMBER DEFAULT 0 NOT NULL,
 287+ oi_height NUMBER DEFAULT 0 NOT NULL,
 288+ oi_bits NUMBER DEFAULT 0 NOT NULL,
290289 oi_description VARCHAR2(255),
291 - oi_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 290+ oi_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
292291 oi_user_text VARCHAR2(255) NOT NULL,
293292 oi_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
294293 oi_metadata CLOB,
@@ -310,22 +309,22 @@
311310 fa_archive_name VARCHAR2(255),
312311 fa_storage_group VARCHAR2(16),
313312 fa_storage_key VARCHAR2(64),
314 - fa_deleted_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 313+ fa_deleted_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
315314 fa_deleted_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
316315 fa_deleted_reason CLOB,
317 - fa_size NUMBER NOT NULL,
318 - fa_width NUMBER NOT NULL,
319 - fa_height NUMBER NOT NULL,
 316+ fa_size NUMBER DEFAULT 0 NOT NULL,
 317+ fa_width NUMBER DEFAULT 0 NOT NULL,
 318+ fa_height NUMBER DEFAULT 0 NOT NULL,
320319 fa_metadata CLOB,
321 - fa_bits NUMBER,
 320+ fa_bits NUMBER DEFAULT 0 NOT NULL,
322321 fa_media_type VARCHAR2(32) DEFAULT NULL,
323322 fa_major_mime VARCHAR2(32) DEFAULT 'unknown',
324323 fa_minor_mime VARCHAR2(100) DEFAULT 'unknown',
325324 fa_description VARCHAR2(255),
326 - fa_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 325+ fa_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
327326 fa_user_text VARCHAR2(255) NOT NULL,
328327 fa_timestamp TIMESTAMP(6) WITH TIME ZONE,
329 - fa_deleted NUMBER DEFAULT '0' NOT NULL
 328+ fa_deleted NUMBER DEFAULT 0 NOT NULL
330329 );
331330 ALTER TABLE &mw_prefix.filearchive ADD CONSTRAINT &mw_prefix.filearchive_pk PRIMARY KEY (fa_id);
332331 CREATE INDEX &mw_prefix.filearchive_i01 ON &mw_prefix.filearchive (fa_name, fa_timestamp);
@@ -338,26 +337,26 @@
339338 rc_id NUMBER NOT NULL,
340339 rc_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
341340 rc_cur_time TIMESTAMP(6) WITH TIME ZONE NOT NULL,
342 - rc_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 341+ rc_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
343342 rc_user_text VARCHAR2(255) NOT NULL,
344 - rc_namespace NUMBER NOT NULL,
 343+ rc_namespace NUMBER DEFAULT 0 NOT NULL,
345344 rc_title VARCHAR2(255) NOT NULL,
346345 rc_comment VARCHAR2(255),
347346 rc_minor CHAR(1) DEFAULT '0' NOT NULL,
348347 rc_bot CHAR(1) DEFAULT '0' NOT NULL,
349348 rc_new CHAR(1) DEFAULT '0' NOT NULL,
350 - rc_cur_id NUMBER NULL REFERENCES &mw_prefix.page(page_id) ON DELETE SET NULL,
351 - rc_this_oldid NUMBER NOT NULL,
352 - rc_last_oldid NUMBER NOT NULL,
 349+ rc_cur_id NUMBER DEFAULT 0 NOT NULL,
 350+ rc_this_oldid NUMBER DEFAULT 0 NOT NULL,
 351+ rc_last_oldid NUMBER DEFAULT 0 NOT NULL,
353352 rc_type CHAR(1) DEFAULT '0' NOT NULL,
354 - rc_moved_to_ns NUMBER,
 353+ rc_moved_to_ns NUMBER DEFAULT 0 NOT NULL,
355354 rc_moved_to_title VARCHAR2(255),
356355 rc_patrolled CHAR(1) DEFAULT '0' NOT NULL,
357356 rc_ip VARCHAR2(15),
358357 rc_old_len NUMBER,
359358 rc_new_len NUMBER,
360 - rc_deleted NUMBER DEFAULT '0' NOT NULL,
361 - rc_logid NUMBER DEFAULT '0' NOT NULL,
 359+ rc_deleted CHAR(1) DEFAULT '0' NOT NULL,
 360+ rc_logid NUMBER DEFAULT 0 NOT NULL,
362361 rc_log_type VARCHAR2(255),
363362 rc_log_action VARCHAR2(255),
364363 rc_params CLOB
@@ -372,7 +371,7 @@
373372 CREATE INDEX &mw_prefix.recentchanges_i07 ON &mw_prefix.recentchanges (rc_user_text, rc_timestamp);
374373
375374 CREATE TABLE &mw_prefix.watchlist (
376 - wl_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 375+ wl_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
377376 wl_namespace NUMBER DEFAULT 0 NOT NULL,
378377 wl_title VARCHAR2(255) NOT NULL,
379378 wl_notificationtimestamp TIMESTAMP(6) WITH TIME ZONE
@@ -409,8 +408,8 @@
410409
411410 CREATE TABLE &mw_prefix.querycache (
412411 qc_type VARCHAR2(32) NOT NULL,
413 - qc_value NUMBER NOT NULL,
414 - qc_namespace NUMBER NOT NULL,
 412+ qc_value NUMBER DEFAULT 0 NOT NULL,
 413+ qc_namespace NUMBER DEFAULT 0 NOT NULL,
415414 qc_title VARCHAR2(255) NOT NULL
416415 );
417416 CREATE INDEX &mw_prefix.querycache_u01 ON &mw_prefix.querycache (qc_type,qc_value);
@@ -436,14 +435,14 @@
437436 log_type VARCHAR2(10) NOT NULL,
438437 log_action VARCHAR2(10) NOT NULL,
439438 log_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
440 - log_user NUMBER REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 439+ log_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
441440 log_user_text VARCHAR2(255),
442 - log_namespace NUMBER NOT NULL,
 441+ log_namespace NUMBER DEFAULT 0 NOT NULL,
443442 log_title VARCHAR2(255) NOT NULL,
444443 log_page NUMBER,
445444 log_comment VARCHAR2(255),
446445 log_params CLOB,
447 - log_deleted NUMBER DEFAULT '0' NOT NULL
 446+ log_deleted CHAR(1) DEFAULT '0' NOT NULL
448447 );
449448 ALTER TABLE &mw_prefix.logging ADD CONSTRAINT &mw_prefix.logging_pk PRIMARY KEY (log_id);
450449 CREATE INDEX &mw_prefix.logging_i01 ON &mw_prefix.logging (log_type, log_timestamp);
@@ -462,7 +461,7 @@
463462 CREATE SEQUENCE trackbacks_tb_id_seq;
464463 CREATE TABLE &mw_prefix.trackbacks (
465464 tb_id NUMBER NOT NULL,
466 - tb_page NUMBER REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 465+ tb_page NUMBER REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
467466 tb_title VARCHAR2(255) NOT NULL,
468467 tb_url VARCHAR2(255) NOT NULL,
469468 tb_ex CLOB,
@@ -475,7 +474,7 @@
476475 CREATE TABLE &mw_prefix.job (
477476 job_id NUMBER NOT NULL,
478477 job_cmd VARCHAR2(60) NOT NULL,
479 - job_namespace NUMBER NOT NULL,
 478+ job_namespace NUMBER DEFAULT 0 NOT NULL,
480479 job_title VARCHAR2(255) NOT NULL,
481480 job_params CLOB NOT NULL
482481 );
@@ -489,8 +488,8 @@
490489 CREATE UNIQUE INDEX &mw_prefix.querycache_info_u01 ON &mw_prefix.querycache_info (qci_type);
491490
492491 CREATE TABLE &mw_prefix.redirect (
493 - rd_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
494 - rd_namespace NUMBER NOT NULL,
 492+ rd_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
 493+ rd_namespace NUMBER DEFAULT 0 NOT NULL,
495494 rd_title VARCHAR2(255) NOT NULL,
496495 rd_interwiki VARCHAR2(32),
497496 rd_fragment VARCHAR2(255)
@@ -512,7 +511,7 @@
513512 CREATE SEQUENCE page_restrictions_pr_id_seq;
514513 CREATE TABLE &mw_prefix.page_restrictions (
515514 pr_id NUMBER NOT NULL,
516 - pr_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,
 515+ pr_page NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
517516 pr_type VARCHAR2(255) NOT NULL,
518517 pr_level VARCHAR2(255) NOT NULL,
519518 pr_cascade NUMBER NOT NULL,
@@ -525,7 +524,7 @@
526525 CREATE INDEX &mw_prefix.page_restrictions_i03 ON &mw_prefix.page_restrictions (pr_cascade);
527526
528527 CREATE TABLE &mw_prefix.protected_titles (
529 - pt_namespace NUMBER NOT NULL,
 528+ pt_namespace NUMBER DEFAULT 0 NOT NULL,
530529 pt_title VARCHAR2(255) NOT NULL,
531530 pt_user NUMBER NOT NULL,
532531 pt_reason VARCHAR2(255),
@@ -689,6 +688,7 @@
690689 p_temporary IN BOOLEAN) IS
691690 e_table_not_exist EXCEPTION;
692691 PRAGMA EXCEPTION_INIT(e_table_not_exist, -00942);
 692+ l_temp_ei_sql VARCHAR2(2000);
693693 BEGIN
694694 BEGIN
695695 EXECUTE IMMEDIATE 'DROP TABLE ' || p_newprefix || p_tabname ||
@@ -712,7 +712,7 @@
713713 AND data_default IS NOT NULL) LOOP
714714 EXECUTE IMMEDIATE 'ALTER TABLE ' || p_newprefix || p_tabname ||
715715 ' MODIFY ' || rc.column_name || ' DEFAULT ' ||
716 - substr(rc.data_default, 1, 2000);
 716+ SUBSTR(rc.data_default, 1, 2000);
717717 END LOOP;
718718 FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('CONSTRAINT',
719719 constraint_name),
@@ -726,11 +726,11 @@
727727 FROM user_constraints uc
728728 WHERE table_name = p_oldprefix || p_tabname
729729 AND constraint_type = 'P') LOOP
730 - dbms_output.put_line(SUBSTR(rc.ddlvc2,
731 - 1,
732 - INSTR(rc.ddlvc2, 'PCTFREE') - 1));
733 - EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
 730+ l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
 731+ l_temp_ei_sql := SUBSTR(l_temp_ei_sql, 1, INSTR(l_temp_ei_sql, ')', INSTR(l_temp_ei_sql, 'PRIMARY KEY')+1)+1);
 732+ EXECUTE IMMEDIATE l_temp_ei_sql;
734733 END LOOP;
 734+ IF (NOT p_temporary) THEN
735735 FOR rc IN (SELECT REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('REF_CONSTRAINT',
736736 constraint_name),
737737 32767,
@@ -743,6 +743,7 @@
744744 AND constraint_type = 'R') LOOP
745745 EXECUTE IMMEDIATE rc.ddlvc2;
746746 END LOOP;
 747+ END IF;
747748 FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('INDEX',
748749 index_name),
749750 32767,
@@ -751,16 +752,19 @@
752753 USER || '"."' || p_newprefix),
753754 '"' || index_name || '"',
754755 '"' || p_newprefix || index_name || '"') DDLVC2,
755 - index_name
 756+ index_name,
 757+ index_type
756758 FROM user_indexes ui
757759 WHERE table_name = p_oldprefix || p_tabname
758 - AND index_type != 'LOB'
 760+ AND index_type NOT IN ('LOB', 'DOMAIN')
759761 AND NOT EXISTS
760762 (SELECT NULL
761763 FROM user_constraints
762764 WHERE table_name = ui.table_name
763765 AND constraint_name = ui.index_name)) LOOP
764 - EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
 766+ l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
 767+ l_temp_ei_sql := SUBSTR(l_temp_ei_sql, 1, INSTR(l_temp_ei_sql, ')', INSTR(l_temp_ei_sql, '"' || USER || '"."' || p_newprefix || '"')+1)+1);
 768+ EXECUTE IMMEDIATE l_temp_ei_sql;
765769 END LOOP;
766770 FOR rc IN (SELECT REPLACE(REPLACE(UPPER(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('TRIGGER',
767771 trigger_name),
@@ -773,18 +777,14 @@
774778 trigger_name
775779 FROM user_triggers
776780 WHERE table_name = p_oldprefix || p_tabname) LOOP
777 - EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'ALTER ') - 1);
 781+ l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'ALTER ') - 1);
 782+ dbms_output.put_line(l_temp_ei_sql);
 783+ EXECUTE IMMEDIATE l_temp_ei_sql;
778784 END LOOP;
779785 END;
780786 /*$mw$*/
781787
782788 /*$mw$*/
783 -BEGIN
784 - fill_wiki_info;
785 -END;
786 -/*$mw$*/
787 -
788 -/*$mw$*/
789789 CREATE OR REPLACE FUNCTION BITOR (x IN NUMBER, y IN NUMBER) RETURN NUMBER AS
790790 BEGIN
791791 RETURN (x + y - BITAND(x, y));
Index: trunk/phase3/includes/installer/OracleUpdater.php
@@ -14,6 +14,37 @@
1515 */
1616 class OracleUpdater extends DatabaseUpdater {
1717 protected function getCoreUpdateList() {
18 - return array();
 18+ return array(
 19+ // 1.16
 20+ array( 'doNamespaceDefaults' ),
 21+ );
1922 }
 23+
 24+
 25+ /**
 26+ * MySQL uses datatype defaults for NULL inserted into NOT NULL fields
 27+ * In namespace case that results into insert of 0 which is default namespace
 28+ * Oracle inserts NULL, so namespace fields should have a default value
 29+ */
 30+ protected function doNamespaceDefaults() {
 31+ $meta = $this->db->fieldInfo( 'page', 'page_namespace' );
 32+ if ( $meta->defaultValue() != null ) {
 33+ $this->output( "... defaults seem to present on namespace fields\n" );
 34+ return;
 35+ }
 36+
 37+ $this->output( "Altering namespace fields with default value ..." );
 38+ $this->applyPatch( 'patch_namespace_defaults.sql', false );
 39+ $this->output( "ok\n" );
 40+ }
 41+
 42+ /**
 43+ * Overload: after this action field info table has to be rebuilt
 44+ */
 45+ public function doUpdates( $purge = true ) {
 46+ parent::doUpdates();
 47+
 48+ $this->db->doQuery( 'BEGIN fill_wiki_info; END;' );
 49+ }
 50+
2051 }
Index: trunk/phase3/includes/installer/Installer.php
@@ -358,6 +358,20 @@
359359 LBFactory::enableBackend();
360360 }
361361
 362+
 363+ $titleobj = Title::newFromText( wfMsgNoDB( "mainpage" ) );
 364+ $article = new Article( $titleobj );
 365+ $newid = $article->insertOn( $installer->db );
 366+ $revision = new Revision( array(
 367+ 'page' => $newid,
 368+ 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
 369+ 'comment' => '',
 370+ 'user' => 0,
 371+ 'user_text' => 'MediaWiki default',
 372+ ) );
 373+ $revid = $revision->insertOn( $installer->db );
 374+ $article->updateRevisionOn( $installer->db, $revision );
 375+
362376 return $status;
363377 }
364378
Index: trunk/phase3/includes/installer/OracleInstaller.php
@@ -189,16 +189,25 @@
190190
191191 return $status;
192192 }
 193+
 194+ /**
 195+ * Overload: after this action field info table has to be rebuilt
 196+ */
 197+ public function createTables() {
 198+ $status = parent::createTables();
 199+
 200+ $this->db->doQuery( 'BEGIN fill_wiki_info; END;' );
 201+
 202+ return $status;
 203+ }
 204+
193205
194206 public function getLocalSettings() {
195207 $prefix = $this->getVar( 'wgDBprefix' );
196208 return
197209 "# Oracle specific settings
198 -\$wgDBprefix = \"{$prefix}\";";
 210+\$wgDBprefix = \"{$prefix}\";
 211+";
199212 }
200213
201 - public function doUpgrade() {
202 - // TODO
203 - return false;
204 - }
205214 }
Index: trunk/phase3/config/new-index.php
@@ -6,6 +6,7 @@
77 */
88
99 define( 'MW_CONFIG_CALLBACK', 'CoreInstaller::overrideConfig' );
 10+define( 'MEDIAWIKI_INSTALL', true );
1011
1112 chdir( ".." );
1213 require( './includes/WebStart.php' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r75354Revert mainpage part of r75347. Should go in its own method, with messages, p...demon14:41, 25 October 2010

Status & tagging log