Moved SQLite specific functions to SqliteUpdater
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 11 Sep 2010 09:49:57 +0000 (09:49 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 11 Sep 2010 09:49:57 +0000 (09:49 +0000)
includes/installer/SqliteUpdater.php
maintenance/updaters.inc

index 19003b6..ce88f0e 100644 (file)
@@ -20,7 +20,7 @@ class SqliteUpdater extends DatabaseUpdater {
                        array( 'addField', 'site_stats',    'ss_active_users',  'patch-ss_active_users.sql' ),
                        array( 'do_active_users_init' ),
                        array( 'addField', 'ipblocks',      'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
-                       array( 'sqlite_initial_indexes' ),
+                       array( 'sqliteInitialIndexes' ),
 
                        // 1.15
                        array( 'addTable', 'change_tag',                        'patch-change_tag.sql' ),
@@ -38,7 +38,7 @@ class SqliteUpdater extends DatabaseUpdater {
                        array( 'addIndex', 'change_tag',    'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
                        array( 'addField', 'redirect',      'rd_interwiki',     'patch-rd_interwiki.sql' ),
                        array( 'do_update_transcache_field' ),
-                       array( 'sqlite_setup_searchindex' ),
+                       array( 'sqliteSetupSearchindex' ),
 
                        // 1.17
                        array( 'addTable', 'iwlinks',                            'patch-iwlinks.sql' ),
@@ -51,4 +51,31 @@ class SqliteUpdater extends DatabaseUpdater {
                        array( 'addTable', 'module_deps',                       'patch-module_deps.sql' ),
                );
        }
+
+       protected function sqliteInitialIndexes() {
+               // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
+               if ( update_row_exists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name' ) ) {
+                       wfOut( "...have initial indexes\n" );
+                       return;
+               }
+               wfOut( "Adding initial indexes..." );
+               $this->applyPatch( 'initial-indexes.sql' );
+               wfOut( "done\n" );
+       }
+
+       protected function sqliteSetupSearchindex() {
+               $module = $this->db->getFulltextSearchModule();
+               $fts3tTable = update_row_exists( 'fts3' );
+               if ( $fts3tTable &&  !$module ) {
+                       wfOut( '...PHP is missing FTS3 support, downgrading tables...' );
+                       $this->applyPatch( 'searchindex-no-fts.sql' );
+                       wfOut( "done\n" );
+               } elseif ( !$fts3tTable && $module == 'FTS3' ) {
+                       wfOut( '...adding FTS3 search capabilities...' );
+                       $this->applyPatch( 'searchindex-fts3.sql' );
+                       wfOut( "done\n" );
+               } else {
+                       wfOut( "...fulltext search table appears to be in order.\n" );
+               }
+       }
 }
index def3530..f74c015 100644 (file)
@@ -757,35 +757,6 @@ function do_collation_update() {
        $task->execute();
 }
 
-function sqlite_initial_indexes() {
-       $dbw = wfGetDB( DB_MASTER );
-       // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
-       if ( update_row_exists( 'initial_indexes' ) || $dbw->indexExists( 'user', 'user_name' ) ) {
-               wfOut( "...have initial indexes\n" );
-               return;
-       }
-       wfOut( "Adding initial indexes..." );
-       $dbw->sourceFile( archive( 'initial-indexes.sql' ) );
-       wfOut( "done\n" );
-}
-
-function sqlite_setup_searchindex() {
-       $dbw = wfGetDB( DB_MASTER );
-       $module = $dbw->getFulltextSearchModule();
-       $fts3tTable = update_row_exists( 'fts3' );
-       if ( $fts3tTable &&  !$module ) {
-               wfOut( '...PHP is missing FTS3 support, downgrading tables...' );
-               $dbw->sourceFile( archive( 'searchindex-no-fts.sql' ) );
-               wfOut( "done\n" );
-       } elseif ( !$fts3tTable && $module == 'FTS3' ) {
-               wfOut( '...adding FTS3 search capabilities...' );
-               $dbw->sourceFile( archive( 'searchindex-fts3.sql' ) );
-               wfOut( "done\n" );
-       } else {
-               wfOut( "...fulltext search table appears to be in order.\n" );
-       }
-}
-
 function do_unique_pl_tl_il() {
        $dbw = wfGetDB( DB_MASTER );
        $info = $dbw->indexInfo( 'pagelinks', 'pl_namespace' );