From 4db9cff5b72e4062cb13b94391a571bc39f404cd Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 11 Sep 2010 09:49:57 +0000 Subject: [PATCH] Moved SQLite specific functions to SqliteUpdater --- includes/installer/SqliteUpdater.php | 31 ++++++++++++++++++++++++++-- maintenance/updaters.inc | 29 -------------------------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index 19003b6839..ce88f0e6f4 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -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" ); + } + } } diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index def353088d..f74c015229 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -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' ); -- 2.20.1