Merge "(bug 27395) Write PHPUnit test suite for CSSJanus"
[lhc/web/wiklou.git] / includes / installer / MysqlUpdater.php
index 286f144..e453b01 100644 (file)
@@ -2,6 +2,21 @@
 /**
  * MySQL-specific updater.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  * @ingroup Deployment
  */
@@ -66,7 +81,6 @@ class MysqlUpdater extends DatabaseUpdater {
                        array( 'addTable', 'user_newtalk',                      'patch-usernewtalk2.sql' ),
                        array( 'addTable', 'transcache',                        'patch-transcache.sql' ),
                        array( 'addField', 'interwiki',     'iw_trans',         'patch-interwiki-trans.sql' ),
-                       array( 'addTable', 'trackbacks',                        'patch-trackbacks.sql' ),
 
                        // 1.6
                        array( 'doWatchlistNull' ),
@@ -181,16 +195,24 @@ class MysqlUpdater extends DatabaseUpdater {
                        array( 'modifyField', 'user_properties', 'up_property', 'patch-up_property.sql' ),
                        array( 'addTable', 'uploadstash',                       'patch-uploadstash.sql' ),
                        array( 'addTable', 'user_former_groups',                'patch-user_former_groups.sql'),
-                       array( 'doRebuildLocalisationCache' ),
 
                        // 1.19
-                       array( 'addTable', 'config',                            'patch-config.sql' ),
                        array( 'addIndex', 'logging',       'type_action',      'patch-logging-type-action-index.sql'),
                        array( 'doMigrateUserOptions' ),
                        array( 'dropField', 'user',         'user_options', 'patch-drop-user_options.sql' ),
                        array( 'addField', 'revision',      'rev_sha1',         'patch-rev_sha1.sql' ),
                        array( 'addField', 'archive',       'ar_sha1',          'patch-ar_sha1.sql' ),
-                       array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' )
+                       array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ),
+                       array( 'modifyField', 'user_groups', 'ug_group', 'patch-ug_group-length-increase.sql' ),
+                       array( 'addField',      'uploadstash',  'us_chunk_inx',         'patch-uploadstash_chunk.sql' ),
+                       array( 'addfield', 'job',           'job_timestamp',    'patch-jobs-add-timestamp.sql' ),
+                       array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ufg_group-length-increase.sql' ),
+
+                       // 1.20
+                       array( 'addTable', 'config',                            'patch-config.sql' ),
+                       array( 'addIndex', 'revision', 'page_user_timestamp', 'patch-revision-user-page-index.sql' ),
+                       array( 'addField', 'ipblocks',      'ipb_parent_block_id',           'patch-ipb-parent-block-id.sql' ),
+                       array( 'addIndex', 'ipblocks',      'ipb_parent_block_id',           'patch-ipb-parent-block-id-index.sql' ),
                );
        }
 
@@ -229,12 +251,12 @@ class MysqlUpdater extends DatabaseUpdater {
                if ( $info ) {
                        foreach ( $info as $row ) {
                                if ( $row->Column_name == $field ) {
-                                       $this->output( "...index $index on table $table includes field $field\n" );
+                                       $this->output( "...index $index on table $table includes field $field.\n" );
                                        return true;
                                }
                        }
                }
-               $this->output( "...index $index on table $table has no field $field; adding\n" );
+               $this->output( "...index $index on table $table has no field $field; added.\n" );
                return false;
        }
 
@@ -251,7 +273,7 @@ class MysqlUpdater extends DatabaseUpdater {
 
                $this->output( 'Creating interwiki table...' );
                $this->applyPatch( 'patch-interwiki.sql' );
-               $this->output( "ok\n" );
+               $this->output( "done.\n" );
                $this->output( 'Adding default interwiki definitions...' );
                $this->applyPatch( "$IP/maintenance/interwiki.sql", true );
                $this->output( "done.\n" );
@@ -266,7 +288,7 @@ class MysqlUpdater extends DatabaseUpdater {
                        throw new MWException( 'Missing rc_timestamp field of recentchanges table. Should not happen.' );
                }
                if ( $meta->isMultipleKey() ) {
-                       $this->output( "...indexes seem up to 20031107 standards\n" );
+                       $this->output( "...indexes seem up to 20031107 standards.\n" );
                        return;
                }
 
@@ -300,7 +322,7 @@ class MysqlUpdater extends DatabaseUpdater {
                $talk = $this->db->selectField( 'watchlist', 'count(*)', 'wl_namespace & 1', __METHOD__ );
                $nontalk = $this->db->selectField( 'watchlist', 'count(*)', 'NOT (wl_namespace & 1)', __METHOD__ );
                if ( $talk == $nontalk ) {
-                       $this->output( "...watchlist talk page rows already present\n" );
+                       $this->output( "...watchlist talk page rows already present.\n" );
                        return;
                }
 
@@ -563,11 +585,11 @@ class MysqlUpdater extends DatabaseUpdater {
                                $newug = $this->db->tableName( 'user_groups_bogus' );
                                $this->output( "user_groups table exists but is in bogus intermediate format. Renaming to $newug... " );
                                $this->db->query( "ALTER TABLE $oldug RENAME TO $newug", __METHOD__ );
-                               $this->output( "ok\n" );
+                               $this->output( "done.\n" );
 
                                $this->output( "Re-adding fresh user_groups table... " );
                                $this->applyPatch( 'patch-user_groups.sql' );
-                               $this->output( "ok\n" );
+                               $this->output( "done.\n" );
 
                                $this->output( "***\n" );
                                $this->output( "*** WARNING: You will need to manually fix up user permissions in the user_groups\n" );
@@ -581,13 +603,13 @@ class MysqlUpdater extends DatabaseUpdater {
 
                $this->output( "Adding user_groups table... " );
                $this->applyPatch( 'patch-user_groups.sql' );
-               $this->output( "ok\n" );
+               $this->output( "done.\n" );
 
                if ( !$this->db->tableExists( 'user_rights', __METHOD__ ) ) {
                        if ( $this->db->fieldExists( 'user', 'user_rights', __METHOD__ ) ) {
                                $this->output( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." );
                                $this->db->applyPatch( 'patch-user_rights.sql' );
-                               $this->output( "ok\n" );
+                               $this->output( "done.\n" );
                        } else {
                                $this->output( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" );
                                $this->output( "*** You may need to manually configure some sysops by manipulating\n" );
@@ -758,7 +780,6 @@ class MysqlUpdater extends DatabaseUpdater {
 
                        $task = $this->maintenance->runChild( 'PopulateParentId' );
                        $task->execute();
-                       $this->insertUpdateRow( 'populate rev_parent_id' );
                }
        }