* insert page 0 (for FK) if updating
authorJure Kajzer <freakolowsky@users.mediawiki.org>
Fri, 22 Apr 2011 14:23:10 +0000 (14:23 +0000)
committerJure Kajzer <freakolowsky@users.mediawiki.org>
Fri, 22 Apr 2011 14:23:10 +0000 (14:23 +0000)
includes/installer/OracleUpdater.php

index 331c798..85b3e40 100644 (file)
@@ -20,6 +20,7 @@ class OracleUpdater extends DatabaseUpdater {
                        array( 'doFKRenameDeferr' ),
                        array( 'doFunctions17' ),
                        array( 'doSchemaUpgrade17' ),
+                       array( 'doInserPage0' ),
                );
        }
 
@@ -72,7 +73,7 @@ class OracleUpdater extends DatabaseUpdater {
        protected function doSchemaUpgrade17() {
                $this->output( "Updating schema to 17 ... " );
                // check if iwlinks table exists which was added in 1.17
-               if ( $this->db->tableExists( trim( $this->db->tableName( 'iwlinks' ) ) ) ) {
+               if ( $this->db->tableExists( $this->db->tableName( 'iwlinks' ) ) ) {
                        $this->output( "schema seem to be up to date.\n" );
                        return;
                }
@@ -80,6 +81,24 @@ class OracleUpdater extends DatabaseUpdater {
                $this->output( "ok\n" );
        }
 
+       protected function doInserPage0() {
+               $this->output( "Inserting page 0 if missing ... " );
+               $row = array(
+                       'page_id' => 0,
+                       'page_namespace' => 0,
+                       'page_title' => ' ',
+                       'page_counter' => 0,
+                       'page_is_redirect' => 0,
+                       'page_is_new' => 0,
+                       'page_random' => 0,
+                       'page_touched' => $this->db->timestamp(),
+                       'page_latest' => 0,
+                       'page_len' => 0
+               );
+               $this->db->insert( 'page', $row, 'OracleUpdater:doInserPage0', array( 'IGNORE' ) );
+               $this->output( "ok\n" );
+       }
+
        /**
         * Overload: after this action field info table has to be rebuilt
         */