Follow-up to r51279
[lhc/web/wiklou.git] / maintenance / updaters.inc
index b404e9f..42be378 100644 (file)
@@ -38,6 +38,7 @@ $wgUpdates = array(
                array( 'add_table', 'categorylinks',                     'patch-categorylinks.sql' ),
                // do_linkscc_1_3_update obsolete
                array( 'do_old_links_update' ),
+               array( 'fix_ancient_imagelinks' ),
                array( 'add_field', 'recentchanges', 'rc_ip',            'patch-rc_ip.sql' ),
                
                // 1.4
@@ -156,6 +157,8 @@ $wgUpdates = array(
                array( 'add_table', 'tag_summary',                         'patch-change_tag.sql' ),
                array( 'add_table', 'valid_tag',                           'patch-change_tag.sql' ),
                array( 'add_table', 'user_properties',             'patch-user_properties.sql' ),
+               array( 'add_table', 'log_search',                          'patch-log_search.sql' ),
+               array( 'do_log_search_population' ),
        ),
 
        'sqlite' => array(
@@ -170,6 +173,8 @@ $wgUpdates = array(
                array( 'add_table', 'tag_summary',                         'patch-change_tag.sql' ),
                array( 'add_table', 'valid_tag',                           'patch-change_tag.sql' ),
                array( 'add_table', 'user_properties',             'patch-user_properties.sql' ),
+               array( 'add_table', 'log_search',                          'patch-log_search.sql' ),
+               array( 'do_log_search_population' ),
        ),
 );
 
@@ -783,6 +788,19 @@ function do_old_links_update() {
        }
 }
 
+function fix_ancient_imagelinks() {
+       global $wgDatabase;
+       $info = $wgDatabase->fieldInfo( 'imagelinks', 'il_from' );
+       if ( $info && $info->type() === 'string' ) {
+               wfOut( "Fixing ancient broken imagelinks table.\n" );
+               wfOut( "NOTE: you will have to run maintenance/refreshLinks.php after this.\n" );
+               dbsource( archive( 'patch-fix-il_from.sql' ) );
+               wfOut( "ok\n" );
+       } else {
+               wfOut( "...il_from OK\n" );
+       }
+}
+
 function do_user_unique_update() {
        global $wgDatabase;
        $duper = new UserDupes( $wgDatabase );
@@ -1290,6 +1308,21 @@ function do_unique_pl_tl_il() {
        }
 }
 
+function do_log_search_population() {
+       global $wgDatabase;
+       if( update_row_exists( 'populate log_search' ) ) {
+               wfOut( "...log_search table already populated.\n" );
+               return;
+       }
+       require_once( 'populateLogSearch.inc' );
+       wfOut(
+"Populating log_search table, printing progress markers. For large\n" .
+"databases, you may want to hit Ctrl-C and do this manually with\n" .
+"maintenance/populateLogSearch.php.\n" );
+       migrate_log_params( $wgDatabase );
+       wfOut( "Done populating log_search table.\n" );
+}
+
 /***********************************************************************
  * Start PG crap
  * TODO: merge with above
@@ -1506,6 +1539,7 @@ function do_postgres_updates() {
                array('tag_summary',       'patch-change_tag.sql'),
                array('valid_tag',         'patch-change_tag.sql'),
                array('user_properties',   'patch-user_properties.sql'),
+               array('log_search',        'patch-log_search.sql'),
        );
 
        $newcols = array(