r72791 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72790‎ | r72791 | r72792 >
Date:09:49, 11 September 2010
Author:ialex
Status:ok
Tags:
Comment:
Moved SQLite specific functions to SqliteUpdater
Modified paths:
  • /trunk/phase3/includes/installer/SqliteUpdater.php (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updaters.inc
@@ -757,35 +757,6 @@
758758 $task->execute();
759759 }
760760
761 -function sqlite_initial_indexes() {
762 - $dbw = wfGetDB( DB_MASTER );
763 - // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
764 - if ( update_row_exists( 'initial_indexes' ) || $dbw->indexExists( 'user', 'user_name' ) ) {
765 - wfOut( "...have initial indexes\n" );
766 - return;
767 - }
768 - wfOut( "Adding initial indexes..." );
769 - $dbw->sourceFile( archive( 'initial-indexes.sql' ) );
770 - wfOut( "done\n" );
771 -}
772 -
773 -function sqlite_setup_searchindex() {
774 - $dbw = wfGetDB( DB_MASTER );
775 - $module = $dbw->getFulltextSearchModule();
776 - $fts3tTable = update_row_exists( 'fts3' );
777 - if ( $fts3tTable && !$module ) {
778 - wfOut( '...PHP is missing FTS3 support, downgrading tables...' );
779 - $dbw->sourceFile( archive( 'searchindex-no-fts.sql' ) );
780 - wfOut( "done\n" );
781 - } elseif ( !$fts3tTable && $module == 'FTS3' ) {
782 - wfOut( '...adding FTS3 search capabilities...' );
783 - $dbw->sourceFile( archive( 'searchindex-fts3.sql' ) );
784 - wfOut( "done\n" );
785 - } else {
786 - wfOut( "...fulltext search table appears to be in order.\n" );
787 - }
788 -}
789 -
790761 function do_unique_pl_tl_il() {
791762 $dbw = wfGetDB( DB_MASTER );
792763 $info = $dbw->indexInfo( 'pagelinks', 'pl_namespace' );
Index: trunk/phase3/includes/installer/SqliteUpdater.php
@@ -20,7 +20,7 @@
2121 array( 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
2222 array( 'do_active_users_init' ),
2323 array( 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
24 - array( 'sqlite_initial_indexes' ),
 24+ array( 'sqliteInitialIndexes' ),
2525
2626 // 1.15
2727 array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),
@@ -38,7 +38,7 @@
3939 array( 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
4040 array( 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ),
4141 array( 'do_update_transcache_field' ),
42 - array( 'sqlite_setup_searchindex' ),
 42+ array( 'sqliteSetupSearchindex' ),
4343
4444 // 1.17
4545 array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
@@ -51,4 +51,31 @@
5252 array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
5353 );
5454 }
 55+
 56+ protected function sqliteInitialIndexes() {
 57+ // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
 58+ if ( update_row_exists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name' ) ) {
 59+ wfOut( "...have initial indexes\n" );
 60+ return;
 61+ }
 62+ wfOut( "Adding initial indexes..." );
 63+ $this->applyPatch( 'initial-indexes.sql' );
 64+ wfOut( "done\n" );
 65+ }
 66+
 67+ protected function sqliteSetupSearchindex() {
 68+ $module = $this->db->getFulltextSearchModule();
 69+ $fts3tTable = update_row_exists( 'fts3' );
 70+ if ( $fts3tTable && !$module ) {
 71+ wfOut( '...PHP is missing FTS3 support, downgrading tables...' );
 72+ $this->applyPatch( 'searchindex-no-fts.sql' );
 73+ wfOut( "done\n" );
 74+ } elseif ( !$fts3tTable && $module == 'FTS3' ) {
 75+ wfOut( '...adding FTS3 search capabilities...' );
 76+ $this->applyPatch( 'searchindex-fts3.sql' );
 77+ wfOut( "done\n" );
 78+ } else {
 79+ wfOut( "...fulltext search table appears to be in order.\n" );
 80+ }
 81+ }
5582 }

Status & tagging log