MediaWiki  REL1_19
SqliteUpdater.php
Go to the documentation of this file.
00001 <?php
00015 class SqliteUpdater extends DatabaseUpdater {
00016 
00017         protected function getCoreUpdateList() {
00018                 return array(
00019                         // 1.14
00020                         array( 'addField', 'site_stats',    'ss_active_users',  'patch-ss_active_users.sql' ),
00021                         array( 'doActiveUsersInit' ),
00022                         array( 'addField', 'ipblocks',      'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
00023                         array( 'sqliteInitialIndexes' ),
00024 
00025                         // 1.15
00026                         array( 'addTable', 'change_tag',                        'patch-change_tag.sql' ),
00027                         array( 'addTable', 'tag_summary',                       'patch-change_tag.sql' ),
00028                         array( 'addTable', 'valid_tag',                         'patch-change_tag.sql' ),
00029 
00030                         // 1.16
00031                         array( 'addTable', 'user_properties',                   'patch-user_properties.sql' ),
00032                         array( 'addTable', 'log_search',                        'patch-log_search.sql' ),
00033                         array( 'addField', 'logging',       'log_user_text',    'patch-log_user_text.sql' ),
00034                         array( 'doLogUsertextPopulation' ), # listed separately from the previous update because 1.16 was released without this update
00035                         array( 'doLogSearchPopulation' ),
00036                         array( 'addTable', 'l10n_cache',                        'patch-l10n_cache.sql' ),
00037                         array( 'addTable', 'external_user',                     'patch-external_user.sql' ),
00038                         array( 'addIndex', 'log_search',    'ls_field_val',     'patch-log_search-rename-index.sql' ),
00039                         array( 'addIndex', 'change_tag',    'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
00040                         array( 'addField', 'redirect',      'rd_interwiki',     'patch-rd_interwiki.sql' ),
00041                         array( 'doUpdateTranscacheField' ),
00042                         array( 'sqliteSetupSearchindex' ),
00043 
00044                         // 1.17
00045                         array( 'addTable', 'iwlinks',                           'patch-iwlinks.sql' ),
00046                         array( 'addIndex', 'iwlinks',   'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ),
00047                         array( 'addField', 'updatelog', 'ul_value',             'patch-ul_value.sql' ),
00048                         array( 'addField', 'interwiki',     'iw_api',           'patch-iw_api_and_wikiid.sql' ),
00049                         array( 'dropIndex', 'iwlinks', 'iwl_prefix',            'patch-kill-iwl_prefix.sql' ),
00050                         array( 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ),
00051                         array( 'addField', 'categorylinks', 'cl_collation',     'patch-categorylinks-better-collation.sql' ),
00052                         array( 'doCollationUpdate' ),
00053                         array( 'addTable', 'msg_resource',                      'patch-msg_resource.sql' ),
00054                         array( 'addTable', 'module_deps',                       'patch-module_deps.sql' ),
00055                         array( 'dropIndex', 'archive', 'ar_page_revid',         'patch-archive_kill_ar_page_revid.sql' ),
00056                         array( 'addIndex', 'archive', 'ar_revid',               'patch-archive_ar_revid.sql' ),
00057 
00058                         // 1.18
00059                         array( 'addIndex', 'user',          'user_email',       'patch-user_email_index.sql' ),
00060                         array( 'addTable', 'uploadstash',                       'patch-uploadstash.sql' ),
00061                         array( 'addTable', 'user_former_groups',                'patch-user_former_groups.sql'),
00062 
00063                         // 1.19
00064                         array( 'addIndex', 'logging',       'type_action',      'patch-logging-type-action-index.sql'),
00065                         array( 'doMigrateUserOptions' ),
00066                         array( 'dropField', 'user',         'user_options', 'patch-drop-user_options.sql' ),
00067                         array( 'addField', 'revision',      'rev_sha1',         'patch-rev_sha1.sql' ),
00068                         array( 'addField', 'archive',       'ar_sha1',          'patch-ar_sha1.sql' ),
00069                         array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ),
00070                         array( 'modifyField', 'user_groups', 'ug_group', 'patch-ug_group-length-increase.sql' ),
00071                         array( 'addField',      'uploadstash',  'us_chunk_inx',         'patch-uploadstash_chunk.sql' ),
00072                         array( 'addfield', 'job',           'job_timestamp',    'patch-jobs-add-timestamp.sql' ),
00073                         array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ug_group-length-increase.sql' ),
00074                 );
00075         }
00076 
00077         protected function sqliteInitialIndexes() {
00078                 // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
00079                 if ( $this->updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name', __METHOD__ ) ) {
00080                         $this->output( "...have initial indexes\n" );
00081                         return;
00082                 }
00083                 $this->output( "Adding initial indexes..." );
00084                 $this->applyPatch( 'initial-indexes.sql' );
00085                 $this->output( "done\n" );
00086         }
00087 
00088         protected function sqliteSetupSearchindex() {
00089                 $module = DatabaseSqlite::getFulltextSearchModule();
00090                 $fts3tTable = $this->updateRowExists( 'fts3' );
00091                 if ( $fts3tTable &&  !$module ) {
00092                         $this->output( '...PHP is missing FTS3 support, downgrading tables...' );
00093                         $this->applyPatch( 'searchindex-no-fts.sql' );
00094                         $this->output( "done\n" );
00095                 } elseif ( !$fts3tTable && $module == 'FTS3' ) {
00096                         $this->output( '...adding FTS3 search capabilities...' );
00097                         $this->applyPatch( 'searchindex-fts3.sql' );
00098                         $this->output( "done\n" );
00099                 } else {
00100                         $this->output( "...fulltext search table appears to be in order.\n" );
00101                 }
00102         }
00103 }