Merge "Fix doc error in new incr test"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 23 Oct 2013 17:01:14 +0000 (17:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 23 Oct 2013 17:01:14 +0000 (17:01 +0000)
32 files changed:
includes/Linker.php
includes/Revision.php
includes/installer/DatabaseInstaller.php
includes/installer/DatabaseUpdater.php
includes/installer/InstallDocFormatter.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php
includes/installer/MysqlInstaller.php
includes/installer/MysqlUpdater.php
includes/installer/OracleInstaller.php
includes/installer/OracleUpdater.php
includes/installer/PostgresInstaller.php
includes/installer/PostgresUpdater.php
includes/installer/SqliteInstaller.php
includes/installer/SqliteUpdater.php
includes/installer/WebInstaller.php
includes/installer/WebInstallerPage.php
includes/parser/LinkHolderArray.php
includes/parser/Parser.php
resources/jquery/jquery.tablesorter.js
resources/mediawiki.api/mediawiki.api.js
tests/TestsAutoLoader.php
tests/parser/parserTest.inc
tests/parser/parserTests.txt
tests/phpunit/includes/Providers.php [deleted file]
tests/phpunit/includes/libs/CSSJanusTest.php
tests/phpunit/includes/parser/MagicVariableTest.php
tests/phpunit/includes/parser/NewParserTest.php
tests/phpunit/includes/parser/ParserMethodsTest.php
tests/phpunit/includes/parser/ParserOutputTest.php
tests/phpunit/includes/parser/ParserPreloadTest.php
tests/phpunit/includes/parser/PreprocessorTest.php

index 5bb9230..23ece75 100644 (file)
@@ -1960,6 +1960,7 @@ class Linker {
         * @return String: HTML output
         */
        public static function formatTemplates( $templates, $preview = false, $section = false, $more = null ) {
+               global $wgLang;
                wfProfileIn( __METHOD__ );
 
                $outText = '';
@@ -1987,13 +1988,28 @@ class Linker {
 
                        usort( $templates, 'Title::compare' );
                        foreach ( $templates as $titleObj ) {
-                               $r = $titleObj->getRestrictions( 'edit' );
-                               if ( in_array( 'sysop', $r ) ) {
-                                       $protected = wfMessage( 'template-protected' )->parse();
-                               } elseif ( in_array( 'autoconfirmed', $r ) ) {
-                                       $protected = wfMessage( 'template-semiprotected' )->parse();
-                               } else {
-                                       $protected = '';
+                               $protected = '';
+                               $restrictions = $titleObj->getRestrictions( 'edit' );
+                               if ( $restrictions ) {
+                                       // Check backwards-compatible messages
+                                       $msg = null;
+                                       if ( $restrictions === array( 'sysop' ) ) {
+                                               $msg = wfMessage( 'template-protected' );
+                                       } elseif ( $restrictions === array( 'autoconfirmed' ) ) {
+                                               $msg = wfMessage( 'template-semiprotected' );
+                                       }
+                                       if ( $msg && !$msg->isDisabled() ) {
+                                               $protected = $msg->parse();
+                                       } else {
+                                               // Construct the message from restriction-level-*
+                                               // e.g. restriction-level-sysop, restriction-level-autoconfirmed
+                                               $msgs = array();
+                                               foreach ( $restrictions as $r ) {
+                                                       $msgs[] = wfMessage( "restriction-level-$r" )->parse();
+                                               }
+                                               $protected = wfMessage( 'parentheses' )
+                                                       ->rawParams( $wgLang->commaList( $msgs ) )->escaped();
+                                       }
                                }
                                if ( $titleObj->quickUserCan( 'edit' ) ) {
                                        $editLink = self::link(
index 305c8ff..233eac0 100644 (file)
@@ -116,11 +116,13 @@ class Revision implements IDBAccessObject {
                if ( $id ) {
                        // Use the specified ID
                        $conds['rev_id'] = $id;
+                       return self::newFromConds( $conds, (int)$flags );
                } else {
                        // Use a join to get the latest revision
                        $conds[] = 'rev_id=page_latest';
+                       $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_SLAVE );
+                       return self::loadFromConds( $db, $conds, $flags );
                }
-               return self::newFromConds( $conds, (int)$flags );
        }
 
        /**
index 8bb7826..0110ac5 100644 (file)
@@ -32,7 +32,7 @@ abstract class DatabaseInstaller {
        /**
         * The Installer object.
         *
-        * TODO: naming this parent is confusing, 'installer' would be clearer.
+        * @todo Naming this parent is confusing, 'installer' would be clearer.
         *
         * @var WebInstaller
         */
@@ -505,7 +505,8 @@ abstract class DatabaseInstaller {
                        return false;
                }
 
-               return $this->db->tableExists( 'cur', __METHOD__ ) || $this->db->tableExists( 'revision', __METHOD__ );
+               return $this->db->tableExists( 'cur', __METHOD__ ) ||
+                       $this->db->tableExists( 'revision', __METHOD__ );
        }
 
        /**
@@ -516,8 +517,18 @@ abstract class DatabaseInstaller {
        public function getInstallUserBox() {
                return Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMessage( 'config-db-install-account' )->text() ) .
-                       $this->getTextBox( '_InstallUser', 'config-db-username', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-install-username' ) ) .
-                       $this->getPasswordBox( '_InstallPassword', 'config-db-password', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-install-password' ) ) .
+                       $this->getTextBox(
+                               '_InstallUser',
+                               'config-db-username',
+                               array( 'dir' => 'ltr' ),
+                               $this->parent->getHelpBox( 'config-db-install-username' )
+                       ) .
+                       $this->getPasswordBox(
+                               '_InstallPassword',
+                               'config-db-password',
+                               array( 'dir' => 'ltr' ),
+                               $this->parent->getHelpBox( 'config-db-install-password' )
+                       ) .
                        Html::closeElement( 'fieldset' );
        }
 
index fdd34d4..267b6c5 100644 (file)
@@ -130,7 +130,8 @@ abstract class DatabaseUpdater {
        }
 
        /**
-        * Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook
+        * Loads LocalSettings.php, if needed, and initialises everything needed for
+        * LoadExtensionSchemaUpdates hook.
         */
        private function loadExtensions() {
                if ( !defined( 'MEDIAWIKI_INSTALL' ) ) {
@@ -289,11 +290,22 @@ abstract class DatabaseUpdater {
         * @param string $tableName The table name
         * @param string $oldIndexName The old index name
         * @param string $newIndexName The new index name
-        * @param $skipBothIndexExistWarning Boolean: Whether to warn if both the old and the new indexes exist. [facultative; by default, false]
+        * @param $skipBothIndexExistWarning Boolean: Whether to warn if both the old
+        * and the new indexes exist. [facultative; by default, false]
         * @param string $sqlPath The path to the SQL change path
         */
-       public function renameExtensionIndex( $tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning = false ) {
-               $this->extensionUpdates[] = array( 'renameIndex', $tableName, $oldIndexName, $newIndexName, $skipBothIndexExistWarning, $sqlPath, true );
+       public function renameExtensionIndex( $tableName, $oldIndexName, $newIndexName,
+               $sqlPath, $skipBothIndexExistWarning = false
+       ) {
+               $this->extensionUpdates[] = array(
+                       'renameIndex',
+                       $tableName,
+                       $oldIndexName,
+                       $newIndexName,
+                       $skipBothIndexExistWarning,
+                       $sqlPath,
+                       true
+               );
        }
 
        /**
@@ -758,12 +770,15 @@ abstract class DatabaseUpdater {
         * @param string $table Name of the table to modify
         * @param string $oldIndex Old name of the index
         * @param string $newIndex New name of the index
-        * @param $skipBothIndexExistWarning Boolean: Whether to warn if both the old and the new indexes exist.
+        * @param $skipBothIndexExistWarning Boolean: Whether to warn if both the
+        * old and the new indexes exist.
         * @param string $patch Path to the patch file
         * @param $fullpath Boolean: Whether to treat $patch path as a relative or not
         * @return Boolean false if this was skipped because schema changes are skipped
         */
-       protected function renameIndex( $table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath = false ) {
+       protected function renameIndex( $table, $oldIndex, $newIndex,
+               $skipBothIndexExistWarning, $patch, $fullpath = false
+       ) {
                if ( !$this->doTable( $table ) ) {
                        return true;
                }
@@ -778,8 +793,11 @@ abstract class DatabaseUpdater {
                // Second requirement: the new index must be missing
                if ( $this->db->indexExists( $table, $newIndex, __METHOD__ ) ) {
                        $this->output( "...index $newIndex already set on $table table.\n" );
-                       if ( !$skipBothIndexExistWarning && $this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) {
-                               $this->output( "...WARNING: $oldIndex still exists, despite it has been renamed into $newIndex (which also exists).\n" .
+                       if ( !$skipBothIndexExistWarning &&
+                               $this->db->indexExists( $table, $oldIndex, __METHOD__ )
+                       ) {
+                               $this->output( "...WARNING: $oldIndex still exists, despite it has " .
+                                       "been renamed into $newIndex (which also exists).\n" .
                                        "            $oldIndex should be manually removed if not needed anymore.\n" );
                        }
 
@@ -794,7 +812,11 @@ abstract class DatabaseUpdater {
                }
 
                // Requirements have been satisfied, patch can be applied
-               return $this->applyPatch( $patch, $fullpath, "Renaming index $oldIndex into $newIndex to table $table" );
+               return $this->applyPatch(
+                       $patch,
+                       $fullpath,
+                       "Renaming index $oldIndex into $newIndex to table $table"
+               );
        }
 
        /**
@@ -848,7 +870,8 @@ abstract class DatabaseUpdater {
                if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
                        $this->output( "...$table table does not exist, skipping modify field patch.\n" );
                } elseif ( !$this->db->fieldExists( $table, $field, __METHOD__ ) ) {
-                       $this->output( "...$field field does not exist in $table table, skipping modify field patch.\n" );
+                       $this->output( "...$field field does not exist in $table table, " .
+                               "skipping modify field patch.\n" );
                } elseif ( $this->updateRowExists( $updateKey ) ) {
                        $this->output( "...$field in table $table already modified by patch $patch.\n" );
                } else {
index 0042089..6d3819c 100644 (file)
@@ -47,7 +47,11 @@ class InstallDocFormatter {
                // turn (bug nnnn) into links
                $text = preg_replace_callback( '/bug (\d+)/', array( $this, 'replaceBugLinks' ), $text );
                // add links to manual to every global variable mentioned
-               $text = preg_replace_callback( '/(\$wg[a-z0-9_]+)/i', array( $this, 'replaceConfigLinks' ), $text );
+               $text = preg_replace_callback(
+                       '/(\$wg[a-z0-9_]+)/i',
+                       array( $this, 'replaceConfigLinks' ),
+                       $text
+               );
 
                return $text;
        }
index 5eaacf8..276c572 100644 (file)
@@ -302,7 +302,8 @@ abstract class Installer {
        /**
         * URL to mediawiki-announce subscription
         */
-       protected $mediaWikiAnnounceUrl = 'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
+       protected $mediaWikiAnnounceUrl =
+               'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
 
        /**
         * Supported language codes for Mailman
@@ -983,6 +984,7 @@ abstract class Installer {
                        $this->showMessage( 'config-using-server', $server );
                        $this->setVar( 'wgServer', $server );
                }
+
                return true;
        }
 
@@ -1001,7 +1003,11 @@ abstract class Installer {
                $IP = dirname( dirname( __DIR__ ) );
                $this->setVar( 'IP', $IP );
 
-               $this->showMessage( 'config-using-uri', $this->getVar( 'wgServer' ), $this->getVar( 'wgScriptPath' ) );
+               $this->showMessage(
+                       'config-using-uri',
+                       $this->getVar( 'wgServer' ),
+                       $this->getVar( 'wgScriptPath' )
+               );
 
                return true;
        }
@@ -1195,7 +1201,8 @@ abstract class Installer {
                        }
                }
 
-               // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8', 'config-unicode-using-intl'
+               // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8',
+               // 'config-unicode-using-intl'
                if ( $useNormalizer === 'php' ) {
                        $this->showMessage( 'config-unicode-pure-php-warning' );
                } else {
index 858fbee..56d8353 100644 (file)
@@ -202,7 +202,7 @@ class LocalSettingsGenerator {
                        $locale = '';
                }
 
-               //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // TODO: Fixme, I'm unused!
+               //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // @todo FIXME: I'm unused!
                $hashedUploads = $this->safeMode ? '' : '#';
                $metaNamespace = '';
                if ( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
index 5e420b6..5f76972 100644 (file)
@@ -64,10 +64,6 @@ class MysqlInstaller extends DatabaseInstaller {
                return 'mysql';
        }
 
-       public function __construct( $parent ) {
-               parent::__construct( $parent );
-       }
-
        /**
         * @return Bool
         */
@@ -86,7 +82,12 @@ class MysqlInstaller extends DatabaseInstaller {
         * @return string
         */
        public function getConnectForm() {
-               return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
+               return $this->getTextBox(
+                       'wgDBserver',
+                       'config-db-host',
+                       array(),
+                       $this->parent->getHelpBox( 'config-db-host-help' )
+               ) .
                        Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
                        $this->getTextBox( 'wgDBname', 'config-db-name', array( 'dir' => 'ltr' ),
@@ -481,7 +482,10 @@ class MysqlInstaller extends DatabaseInstaller {
                $conn = $status->value;
                $dbName = $this->getVar( 'wgDBname' );
                if ( !$conn->selectDB( $dbName ) ) {
-                       $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ) . "CHARACTER SET utf8", __METHOD__ );
+                       $conn->query(
+                               "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ) . "CHARACTER SET utf8",
+                               __METHOD__
+                       );
                        $conn->selectDB( $dbName );
                }
                $this->setupSchemaVars();
index 93ea773..6ff7af0 100644 (file)
@@ -32,207 +32,213 @@ class MysqlUpdater extends DatabaseUpdater {
        protected function getCoreUpdateList() {
                return array(
                        // 1.2
-                       array( 'addField', 'ipblocks',      'ipb_id',           'patch-ipblocks.sql' ),
-                       array( 'addField', 'ipblocks',      'ipb_expiry',       'patch-ipb_expiry.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_id', 'patch-ipblocks.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_expiry', 'patch-ipb_expiry.sql' ),
                        array( 'doInterwikiUpdate' ),
                        array( 'doIndexUpdate' ),
-                       array( 'addTable', 'hitcounter',                        'patch-hitcounter.sql' ),
-                       array( 'addField', 'recentchanges', 'rc_type',          'patch-rc_type.sql' ),
+                       array( 'addTable', 'hitcounter', 'patch-hitcounter.sql' ),
+                       array( 'addField', 'recentchanges', 'rc_type', 'patch-rc_type.sql' ),
 
                        // 1.3
-                       array( 'addField', 'user',          'user_real_name',   'patch-user-realname.sql' ),
-                       array( 'addTable', 'querycache',                        'patch-querycache.sql' ),
-                       array( 'addTable', 'objectcache',                       'patch-objectcache.sql' ),
-                       array( 'addTable', 'categorylinks',                     'patch-categorylinks.sql' ),
+                       array( 'addField', 'user', 'user_real_name', 'patch-user-realname.sql' ),
+                       array( 'addTable', 'querycache', 'patch-querycache.sql' ),
+                       array( 'addTable', 'objectcache', 'patch-objectcache.sql' ),
+                       array( 'addTable', 'categorylinks', 'patch-categorylinks.sql' ),
                        array( 'doOldLinksUpdate' ),
                        array( 'doFixAncientImagelinks' ),
-                       array( 'addField', 'recentchanges', 'rc_ip',            'patch-rc_ip.sql' ),
+                       array( 'addField', 'recentchanges', 'rc_ip', 'patch-rc_ip.sql' ),
 
                        // 1.4
-                       array( 'addIndex', 'image',         'PRIMARY',          'patch-image_name_primary.sql' ),
-                       array( 'addField', 'recentchanges', 'rc_id',            'patch-rc_id.sql' ),
-                       array( 'addField', 'recentchanges', 'rc_patrolled',     'patch-rc-patrol.sql' ),
-                       array( 'addTable', 'logging',                           'patch-logging.sql' ),
-                       array( 'addField', 'user',          'user_token',       'patch-user_token.sql' ),
-                       array( 'addField', 'watchlist',     'wl_notificationtimestamp', 'patch-email-notification.sql' ),
+                       array( 'addIndex', 'image', 'PRIMARY', 'patch-image_name_primary.sql' ),
+                       array( 'addField', 'recentchanges', 'rc_id', 'patch-rc_id.sql' ),
+                       array( 'addField', 'recentchanges', 'rc_patrolled', 'patch-rc-patrol.sql' ),
+                       array( 'addTable', 'logging', 'patch-logging.sql' ),
+                       array( 'addField', 'user', 'user_token', 'patch-user_token.sql' ),
+                       array( 'addField', 'watchlist', 'wl_notificationtimestamp', 'patch-email-notification.sql' ),
                        array( 'doWatchlistUpdate' ),
-                       array( 'dropField', 'user',         'user_emailauthenticationtimestamp', 'patch-email-authentication.sql' ),
+                       array( 'dropField', 'user', 'user_emailauthenticationtimestamp',
+                               'patch-email-authentication.sql' ),
 
                        // 1.5
                        array( 'doSchemaRestructuring' ),
-                       array( 'addField', 'logging',       'log_params',       'patch-log_params.sql' ),
-                       array( 'checkBin', 'logging',       'log_title',        'patch-logging-title.sql', ),
-                       array( 'addField', 'archive',       'ar_rev_id',        'patch-archive-rev_id.sql' ),
-                       array( 'addField', 'page',          'page_len',         'patch-page_len.sql' ),
-                       array( 'dropField', 'revision',     'inverse_timestamp', 'patch-inverse_timestamp.sql' ),
-                       array( 'addField', 'revision',      'rev_text_id',      'patch-rev_text_id.sql' ),
-                       array( 'addField', 'revision',      'rev_deleted',      'patch-rev_deleted.sql' ),
-                       array( 'addField', 'image',         'img_width',        'patch-img_width.sql' ),
-                       array( 'addField', 'image',         'img_metadata',     'patch-img_metadata.sql' ),
-                       array( 'addField', 'user',          'user_email_token', 'patch-user_email_token.sql' ),
-                       array( 'addField', 'archive',       'ar_text_id',       'patch-archive-text_id.sql' ),
+                       array( 'addField', 'logging', 'log_params', 'patch-log_params.sql' ),
+                       array( 'checkBin', 'logging', 'log_title', 'patch-logging-title.sql', ),
+                       array( 'addField', 'archive', 'ar_rev_id', 'patch-archive-rev_id.sql' ),
+                       array( 'addField', 'page', 'page_len', 'patch-page_len.sql' ),
+                       array( 'dropField', 'revision', 'inverse_timestamp', 'patch-inverse_timestamp.sql' ),
+                       array( 'addField', 'revision', 'rev_text_id', 'patch-rev_text_id.sql' ),
+                       array( 'addField', 'revision', 'rev_deleted', 'patch-rev_deleted.sql' ),
+                       array( 'addField', 'image', 'img_width', 'patch-img_width.sql' ),
+                       array( 'addField', 'image', 'img_metadata', 'patch-img_metadata.sql' ),
+                       array( 'addField', 'user', 'user_email_token', 'patch-user_email_token.sql' ),
+                       array( 'addField', 'archive', 'ar_text_id', 'patch-archive-text_id.sql' ),
                        array( 'doNamespaceSize' ),
-                       array( 'addField', 'image',         'img_media_type',   'patch-img_media_type.sql' ),
+                       array( 'addField', 'image', 'img_media_type', 'patch-img_media_type.sql' ),
                        array( 'doPagelinksUpdate' ),
-                       array( 'dropField', 'image',        'img_type',         'patch-drop_img_type.sql' ),
+                       array( 'dropField', 'image', 'img_type', 'patch-drop_img_type.sql' ),
                        array( 'doUserUniqueUpdate' ),
                        array( 'doUserGroupsUpdate' ),
-                       array( 'addField', 'site_stats',    'ss_total_pages',   'patch-ss_total_articles.sql' ),
-                       array( 'addTable', 'user_newtalk',                      'patch-usernewtalk2.sql' ),
-                       array( 'addTable', 'transcache',                        'patch-transcache.sql' ),
-                       array( 'addField', 'interwiki',     'iw_trans',         'patch-interwiki-trans.sql' ),
+                       array( 'addField', 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ),
+                       array( 'addTable', 'user_newtalk', 'patch-usernewtalk2.sql' ),
+                       array( 'addTable', 'transcache', 'patch-transcache.sql' ),
+                       array( 'addField', 'interwiki', 'iw_trans', 'patch-interwiki-trans.sql' ),
 
                        // 1.6
                        array( 'doWatchlistNull' ),
-                       array( 'addIndex', 'logging',         'times',            'patch-logging-times-index.sql' ),
-                       array( 'addField', 'ipblocks',        'ipb_range_start',  'patch-ipb_range_start.sql' ),
+                       array( 'addIndex', 'logging', 'times', 'patch-logging-times-index.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_range_start', 'patch-ipb_range_start.sql' ),
                        array( 'doPageRandomUpdate' ),
-                       array( 'addField', 'user',            'user_registration', 'patch-user_registration.sql' ),
+                       array( 'addField', 'user', 'user_registration', 'patch-user_registration.sql' ),
                        array( 'doTemplatelinksUpdate' ),
-                       array( 'addTable', 'externallinks',                       'patch-externallinks.sql' ),
-                       array( 'addTable', 'job',                                 'patch-job.sql' ),
-                       array( 'addField', 'site_stats',      'ss_images',        'patch-ss_images.sql' ),
-                       array( 'addTable', 'langlinks',                           'patch-langlinks.sql' ),
-                       array( 'addTable', 'querycache_info',                     'patch-querycacheinfo.sql' ),
-                       array( 'addTable', 'filearchive',                         'patch-filearchive.sql' ),
-                       array( 'addField', 'ipblocks',        'ipb_anon_only',    'patch-ipb_anon_only.sql' ),
-                       array( 'addIndex', 'recentchanges',   'rc_ns_usertext',   'patch-recentchanges-utindex.sql' ),
-                       array( 'addIndex', 'recentchanges',   'rc_user_text',     'patch-rc_user_text-index.sql' ),
+                       array( 'addTable', 'externallinks', 'patch-externallinks.sql' ),
+                       array( 'addTable', 'job', 'patch-job.sql' ),
+                       array( 'addField', 'site_stats', 'ss_images', 'patch-ss_images.sql' ),
+                       array( 'addTable', 'langlinks', 'patch-langlinks.sql' ),
+                       array( 'addTable', 'querycache_info', 'patch-querycacheinfo.sql' ),
+                       array( 'addTable', 'filearchive', 'patch-filearchive.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_anon_only', 'patch-ipb_anon_only.sql' ),
+                       array( 'addIndex', 'recentchanges', 'rc_ns_usertext', 'patch-recentchanges-utindex.sql' ),
+                       array( 'addIndex', 'recentchanges', 'rc_user_text', 'patch-rc_user_text-index.sql' ),
 
                        // 1.9
-                       array( 'addField', 'user',          'user_newpass_time', 'patch-user_newpass_time.sql' ),
-                       array( 'addTable', 'redirect',                           'patch-redirect.sql' ),
-                       array( 'addTable', 'querycachetwo',                      'patch-querycachetwo.sql' ),
-                       array( 'addField', 'ipblocks',      'ipb_enable_autoblock', 'patch-ipb_optional_autoblock.sql' ),
+                       array( 'addField', 'user', 'user_newpass_time', 'patch-user_newpass_time.sql' ),
+                       array( 'addTable', 'redirect', 'patch-redirect.sql' ),
+                       array( 'addTable', 'querycachetwo', 'patch-querycachetwo.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_enable_autoblock', 'patch-ipb_optional_autoblock.sql' ),
                        array( 'doBacklinkingIndicesUpdate' ),
-                       array( 'addField', 'recentchanges', 'rc_old_len',        'patch-rc_len.sql' ),
-                       array( 'addField', 'user',          'user_editcount',    'patch-user_editcount.sql' ),
+                       array( 'addField', 'recentchanges', 'rc_old_len', 'patch-rc_len.sql' ),
+                       array( 'addField', 'user', 'user_editcount', 'patch-user_editcount.sql' ),
 
                        // 1.10
                        array( 'doRestrictionsUpdate' ),
-                       array( 'addField', 'logging',       'log_id',           'patch-log_id.sql' ),
-                       array( 'addField', 'revision',      'rev_parent_id',    'patch-rev_parent_id.sql' ),
-                       array( 'addField', 'page_restrictions', 'pr_id',        'patch-page_restrictions_sortkey.sql' ),
-                       array( 'addField', 'revision',      'rev_len',          'patch-rev_len.sql' ),
-                       array( 'addField', 'recentchanges', 'rc_deleted',       'patch-rc_deleted.sql' ),
-                       array( 'addField', 'logging',       'log_deleted',      'patch-log_deleted.sql' ),
-                       array( 'addField', 'archive',       'ar_deleted',       'patch-ar_deleted.sql' ),
-                       array( 'addField', 'ipblocks',      'ipb_deleted',      'patch-ipb_deleted.sql' ),
-                       array( 'addField', 'filearchive',   'fa_deleted',       'patch-fa_deleted.sql' ),
-                       array( 'addField', 'archive',       'ar_len',           'patch-ar_len.sql' ),
+                       array( 'addField', 'logging', 'log_id', 'patch-log_id.sql' ),
+                       array( 'addField', 'revision', 'rev_parent_id', 'patch-rev_parent_id.sql' ),
+                       array( 'addField', 'page_restrictions', 'pr_id', 'patch-page_restrictions_sortkey.sql' ),
+                       array( 'addField', 'revision', 'rev_len', 'patch-rev_len.sql' ),
+                       array( 'addField', 'recentchanges', 'rc_deleted', 'patch-rc_deleted.sql' ),
+                       array( 'addField', 'logging', 'log_deleted', 'patch-log_deleted.sql' ),
+                       array( 'addField', 'archive', 'ar_deleted', 'patch-ar_deleted.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_deleted', 'patch-ipb_deleted.sql' ),
+                       array( 'addField', 'filearchive', 'fa_deleted', 'patch-fa_deleted.sql' ),
+                       array( 'addField', 'archive', 'ar_len', 'patch-ar_len.sql' ),
 
                        // 1.11
-                       array( 'addField', 'ipblocks',      'ipb_block_email',  'patch-ipb_emailban.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_block_email', 'patch-ipb_emailban.sql' ),
                        array( 'doCategorylinksIndicesUpdate' ),
-                       array( 'addField', 'oldimage',      'oi_metadata',      'patch-oi_metadata.sql' ),
-                       array( 'addIndex', 'archive',       'usertext_timestamp', 'patch-archive-user-index.sql' ),
-                       array( 'addIndex', 'image',         'img_usertext_timestamp', 'patch-image-user-index.sql' ),
-                       array( 'addIndex', 'oldimage',      'oi_usertext_timestamp', 'patch-oldimage-user-index.sql' ),
-                       array( 'addField', 'archive',       'ar_page_id',       'patch-archive-page_id.sql' ),
-                       array( 'addField', 'image',         'img_sha1',         'patch-img_sha1.sql' ),
+                       array( 'addField', 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql' ),
+                       array( 'addIndex', 'archive', 'usertext_timestamp', 'patch-archive-user-index.sql' ),
+                       array( 'addIndex', 'image', 'img_usertext_timestamp', 'patch-image-user-index.sql' ),
+                       array( 'addIndex', 'oldimage', 'oi_usertext_timestamp', 'patch-oldimage-user-index.sql' ),
+                       array( 'addField', 'archive', 'ar_page_id', 'patch-archive-page_id.sql' ),
+                       array( 'addField', 'image', 'img_sha1', 'patch-img_sha1.sql' ),
 
                        // 1.12
-                       array( 'addTable', 'protected_titles',                  'patch-protected_titles.sql' ),
+                       array( 'addTable', 'protected_titles', 'patch-protected_titles.sql' ),
 
                        // 1.13
-                       array( 'addField', 'ipblocks',      'ipb_by_text',      'patch-ipb_by_text.sql' ),
-                       array( 'addTable', 'page_props',                        'patch-page_props.sql' ),
-                       array( 'addTable', 'updatelog',                         'patch-updatelog.sql' ),
-                       array( 'addTable', 'category',                          'patch-category.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_by_text', 'patch-ipb_by_text.sql' ),
+                       array( 'addTable', 'page_props', 'patch-page_props.sql' ),
+                       array( 'addTable', 'updatelog', 'patch-updatelog.sql' ),
+                       array( 'addTable', 'category', 'patch-category.sql' ),
                        array( 'doCategoryPopulation' ),
-                       array( 'addField', 'archive',       'ar_parent_id',     'patch-ar_parent_id.sql' ),
-                       array( 'addField', 'user_newtalk',  'user_last_timestamp', 'patch-user_last_timestamp.sql' ),
+                       array( 'addField', 'archive', 'ar_parent_id', 'patch-ar_parent_id.sql' ),
+                       array( 'addField', 'user_newtalk', 'user_last_timestamp', 'patch-user_last_timestamp.sql' ),
                        array( 'doPopulateParentId' ),
-                       array( 'checkBin', 'protected_titles', 'pt_title',      'patch-pt_title-encoding.sql', ),
+                       array( 'checkBin', 'protected_titles', 'pt_title', 'patch-pt_title-encoding.sql', ),
                        array( 'doMaybeProfilingMemoryUpdate' ),
                        array( 'doFilearchiveIndicesUpdate' ),
 
                        // 1.14
-                       array( 'addField', 'site_stats',    'ss_active_users',  'patch-ss_active_users.sql' ),
+                       array( 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
                        array( 'doActiveUsersInit' ),
-                       array( 'addField', 'ipblocks',      'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
 
                        // 1.15
                        array( 'doUniquePlTlIl' ),
-                       array( 'addTable', 'change_tag',                        'patch-change_tag.sql' ),
-                       array( 'addTable', 'tag_summary',                       'patch-tag_summary.sql' ),
-                       array( 'addTable', 'valid_tag',                         'patch-valid_tag.sql' ),
+                       array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),
+                       array( 'addTable', 'tag_summary', 'patch-tag_summary.sql' ),
+                       array( 'addTable', 'valid_tag', 'patch-valid_tag.sql' ),
 
                        // 1.16
-                       array( 'addTable', 'user_properties',                   'patch-user_properties.sql' ),
-                       array( 'addTable', 'log_search',                        'patch-log_search.sql' ),
-                       array( 'addField', 'logging',       'log_user_text',    'patch-log_user_text.sql' ),
-                       array( 'doLogUsertextPopulation' ), # listed separately from the previous update because 1.16 was released without this update
+                       array( 'addTable', 'user_properties', 'patch-user_properties.sql' ),
+                       array( 'addTable', 'log_search', 'patch-log_search.sql' ),
+                       array( 'addField', 'logging', 'log_user_text', 'patch-log_user_text.sql' ),
+                       # listed separately from the previous update because 1.16 was released without this update
+                       array( 'doLogUsertextPopulation' ),
                        array( 'doLogSearchPopulation' ),
-                       array( 'addTable', 'l10n_cache',                        'patch-l10n_cache.sql' ),
-                       array( 'addIndex', 'log_search',    'ls_field_val',     'patch-log_search-rename-index.sql' ),
-                       array( 'addIndex', 'change_tag',    'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
-                       array( 'addField', 'redirect',      'rd_interwiki',     'patch-rd_interwiki.sql' ),
+                       array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ),
+                       array( 'addIndex', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ),
+                       array( 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
+                       array( 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ),
                        array( 'doUpdateTranscacheField' ),
                        array( 'doUpdateMimeMinorField' ),
 
                        // 1.17
-                       array( 'addTable', 'iwlinks',                           'patch-iwlinks.sql' ),
-                       array( 'addIndex', 'iwlinks', 'iwl_prefix_title_from',  'patch-rename-iwl_prefix.sql' ),
-                       array( 'addField', 'updatelog',     'ul_value',         'patch-ul_value.sql' ),
-                       array( 'addField', 'interwiki',     'iw_api',           'patch-iw_api_and_wikiid.sql' ),
-                       array( 'dropIndex', 'iwlinks',      'iwl_prefix',       'patch-kill-iwl_prefix.sql' ),
-                       array( 'addField', 'categorylinks', 'cl_collation',     'patch-categorylinks-better-collation.sql' ),
+                       array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
+                       array( 'addIndex', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ),
+                       array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
+                       array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
+                       array( 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ),
+                       array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),
                        array( 'doClFieldsUpdate' ),
                        array( 'doCollationUpdate' ),
-                       array( 'addTable', 'msg_resource',                      'patch-msg_resource.sql' ),
-                       array( 'addTable', 'module_deps',                       'patch-module_deps.sql' ),
-                       array( 'dropIndex', 'archive',      'ar_page_revid',    'patch-archive_kill_ar_page_revid.sql' ),
-                       array( 'addIndex', 'archive',       'ar_revid',         'patch-archive_ar_revid.sql' ),
+                       array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
+                       array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
+                       array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
+                       array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
                        array( 'doLangLinksLengthUpdate' ),
 
                        // 1.18
                        array( 'doUserNewTalkTimestampNotNull' ),
-                       array( 'addIndex', 'user',          'user_email',       'patch-user_email_index.sql' ),
+                       array( 'addIndex', 'user', 'user_email', 'patch-user_email_index.sql' ),
                        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( 'addTable', 'uploadstash', 'patch-uploadstash.sql' ),
+                       array( 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ),
 
                        // 1.19
-                       array( 'addIndex', 'logging',       'type_action',      'patch-logging-type-action-index.sql'),
-                       array( 'addField', 'revision',      'rev_sha1',         'patch-rev_sha1.sql' ),
+                       array( 'addIndex', 'logging', 'type_action', 'patch-logging-type-action-index.sql' ),
+                       array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ),
                        array( 'doMigrateUserOptions' ),
-                       array( 'dropField', 'user',         'user_options', 'patch-drop-user_options.sql' ),
-                       array( 'addField', 'archive',       'ar_sha1',          'patch-ar_sha1.sql' ),
-                       array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ),
-                       array( 'addField',      'uploadstash',  'us_chunk_inx',         'patch-uploadstash_chunk.sql' ),
-                       array( 'addfield', 'job',           'job_timestamp',    'patch-jobs-add-timestamp.sql' ),
+                       array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ),
+                       array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1.sql' ),
+                       array( 'addIndex', 'page', 'page_redirect_namespace_len',
+                               'patch-page_redirect_namespace_len.sql' ),
+                       array( 'addField', 'uploadstash', 'us_chunk_inx', 'patch-uploadstash_chunk.sql' ),
+                       array( 'addfield', 'job', 'job_timestamp', 'patch-jobs-add-timestamp.sql' ),
 
                        // 1.20
                        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' ),
-                       array( 'dropField', 'category',     'cat_hidden',       'patch-cat_hidden.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' ),
+                       array( 'dropField', 'category', 'cat_hidden', 'patch-cat_hidden.sql' ),
 
                        // 1.21
-                       array( 'addField',      'revision',     'rev_content_format',           'patch-revision-rev_content_format.sql' ),
-                       array( 'addField',      'revision',     'rev_content_model',            'patch-revision-rev_content_model.sql' ),
-                       array( 'addField',      'archive',      'ar_content_format',            'patch-archive-ar_content_format.sql' ),
-                       array( 'addField',      'archive',      'ar_content_model',                 'patch-archive-ar_content_model.sql' ),
-                       array( 'addField',      'page',     'page_content_model',               'patch-page-page_content_model.sql' ),
-                       array( 'dropField', 'site_stats',   'ss_admins',        'patch-drop-ss_admins.sql' ),
-                       array( 'dropField', 'recentchanges', 'rc_moved_to_title',            'patch-rc_moved.sql' ),
-                       array( 'addTable', 'sites',                            'patch-sites.sql' ),
-                       array( 'addField', 'filearchive',   'fa_sha1',          'patch-fa_sha1.sql' ),
-                       array( 'addField', 'job',           'job_token',         'patch-job_token.sql' ),
-                       array( 'addField', 'job',           'job_attempts',       'patch-job_attempts.sql' ),
+                       array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
+                       array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
+                       array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
+                       array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
+                       array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
+                       array( 'dropField', 'site_stats', 'ss_admins', 'patch-drop-ss_admins.sql' ),
+                       array( 'dropField', 'recentchanges', 'rc_moved_to_title', 'patch-rc_moved.sql' ),
+                       array( 'addTable', 'sites', 'patch-sites.sql' ),
+                       array( 'addField', 'filearchive', 'fa_sha1', 'patch-fa_sha1.sql' ),
+                       array( 'addField', 'job', 'job_token', 'patch-job_token.sql' ),
+                       array( 'addField', 'job', 'job_attempts', 'patch-job_attempts.sql' ),
                        array( 'doEnableProfiling' ),
-                       array( 'addField', 'uploadstash',      'us_props',      'patch-uploadstash-us_props.sql' ),
+                       array( 'addField', 'uploadstash', 'us_props', 'patch-uploadstash-us_props.sql' ),
                        array( 'modifyField', 'user_groups', 'ug_group', 'patch-ug_group-length-increase-255.sql' ),
-                       array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ufg_group-length-increase-255.sql' ),
-                       array( 'addIndex', 'page_props', 'pp_propname_page',  'patch-page_props-propname-page-index.sql' ),
+                       array( 'modifyField', 'user_former_groups', 'ufg_group',
+                               'patch-ufg_group-length-increase-255.sql' ),
+                       array( 'addIndex', 'page_props', 'pp_propname_page',
+                               'patch-page_props-propname-page-index.sql' ),
                        array( 'addIndex', 'image', 'img_media_mime', 'patch-img_media_mime-index.sql' ),
 
                        // 1.22
                        array( 'doIwlinksIndexNonUnique' ),
-                       array( 'addIndex', 'iwlinks', 'iwl_prefix_from_title',  'patch-iwlinks-from-title-index.sql' ),
-                       array( 'addField',      'archive',      'ar_id',                    'patch-archive-ar_id.sql' ),
-                       array( 'addField',      'externallinks',  'el_id',  'patch-externallinks-el_id.sql' ),
+                       array( 'addIndex', 'iwlinks', 'iwl_prefix_from_title',
+                               'patch-iwlinks-from-title-index.sql' ),
+                       array( 'addField', 'archive', 'ar_id', 'patch-archive-ar_id.sql' ),
+                       array( 'addField', 'externallinks', 'el_id', 'patch-externallinks-el_id.sql' ),
                );
        }
 
@@ -302,7 +308,11 @@ class MysqlUpdater extends DatabaseUpdater {
                }
 
                $this->applyPatch( 'patch-interwiki.sql', false, 'Creating interwiki table' );
-               $this->applyPatch( "$IP/maintenance/interwiki.sql", true, 'Adding default interwiki definitions' );
+               $this->applyPatch(
+                       "$IP/maintenance/interwiki.sql",
+                       true,
+                       'Adding default interwiki definitions'
+               );
        }
 
        /**
@@ -335,7 +345,13 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               if ( $this->applyPatch( 'patch-fix-il_from.sql', false, "Fixing ancient broken imagelinks table." ) ) {
+               $applied = $this->applyPatch(
+                       'patch-fix-il_from.sql',
+                       false,
+                       'Fixing ancient broken imagelinks table.'
+               );
+
+               if ( $applied ) {
                        $this->output( "NOTE: you will have to run maintenance/refreshLinks.php after this." );
                }
        }
@@ -345,7 +361,12 @@ class MysqlUpdater extends DatabaseUpdater {
         */
        function doWatchlistUpdate() {
                $talk = $this->db->selectField( 'watchlist', 'count(*)', 'wl_namespace & 1', __METHOD__ );
-               $nontalk = $this->db->selectField( 'watchlist', 'count(*)', 'NOT (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" );
 
@@ -374,10 +395,21 @@ class MysqlUpdater extends DatabaseUpdater {
                $this->output( wfTimestamp( TS_DB ) );
                $this->output( "......checking for duplicate entries.\n" );
 
-               list( $cur, $old, $page, $revision, $text ) = $this->db->tableNamesN( 'cur', 'old', 'page', 'revision', 'text' );
+               list( $cur, $old, $page, $revision, $text ) = $this->db->tableNamesN(
+                       'cur',
+                       'old',
+                       'page',
+                       'revision',
+                       'text'
+               );
 
-               $rows = $this->db->query( "SELECT cur_title, cur_namespace, COUNT(cur_namespace) AS c
-                               FROM $cur GROUP BY cur_title, cur_namespace HAVING c>1", __METHOD__ );
+               $rows = $this->db->query( "
+                       SELECT cur_title, cur_namespace, COUNT(cur_namespace) AS c
+                       FROM $cur
+                       GROUP BY cur_title, cur_namespace
+                       HAVING c>1",
+                       __METHOD__
+               );
 
                if ( $rows->numRows() > 0 ) {
                        $this->output( wfTimestamp( TS_DB ) );
@@ -388,8 +420,13 @@ class MysqlUpdater extends DatabaseUpdater {
                                if ( !isset( $duplicate[$row->cur_namespace] ) ) {
                                        $duplicate[$row->cur_namespace] = array();
                                }
+
                                $duplicate[$row->cur_namespace][] = $row->cur_title;
-                               $this->output( sprintf( "      %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) );
+                               $this->output( sprintf(
+                                       "      %-60s %3s %5s\n",
+                                       $row->cur_title, $row->cur_namespace,
+                                       $row->c
+                               ) );
                        }
                        $sql = "SELECT cur_title, cur_namespace, cur_id, cur_timestamp FROM $cur WHERE ";
                        $firstCond = true;
@@ -474,7 +511,10 @@ class MysqlUpdater extends DatabaseUpdater {
 
                $this->output( wfTimestamp( TS_DB ) );
                $this->output( "......Locking tables.\n" );
-               $this->db->query( "LOCK TABLES $page WRITE, $revision WRITE, $old WRITE, $cur WRITE", __METHOD__ );
+               $this->db->query(
+                       "LOCK TABLES $page WRITE, $revision WRITE, $old WRITE, $cur WRITE",
+                       __METHOD__
+               );
 
                $maxold = intval( $this->db->selectField( 'old', 'max(old_id)', '', __METHOD__ ) );
                $this->output( wfTimestamp( TS_DB ) );
@@ -495,27 +535,38 @@ class MysqlUpdater extends DatabaseUpdater {
                        $cur_text = 'cur_text';
                        $cur_flags = "''";
                }
-               $this->db->query( "INSERT INTO $old (old_namespace, old_title, old_text, old_comment, old_user, old_user_text,
-                                       old_timestamp, old_minor_edit, old_flags)
-                       SELECT cur_namespace, cur_title, $cur_text, cur_comment, cur_user, cur_user_text, cur_timestamp, cur_minor_edit, $cur_flags
-                       FROM $cur", __METHOD__ );
+               $this->db->query(
+                       "INSERT INTO $old (old_namespace, old_title, old_text, old_comment, old_user,
+                               old_user_text, old_timestamp, old_minor_edit, old_flags)
+                       SELECT cur_namespace, cur_title, $cur_text, cur_comment, cur_user, cur_user_text,
+                               cur_timestamp, cur_minor_edit, $cur_flags
+                       FROM $cur",
+                       __METHOD__
+               );
 
                $this->output( wfTimestamp( TS_DB ) );
                $this->output( "......Setting up revision table.\n" );
-               $this->db->query( "INSERT INTO $revision (rev_id, rev_page, rev_comment, rev_user, rev_user_text, rev_timestamp,
-                               rev_minor_edit)
+               $this->db->query(
+                       "INSERT INTO $revision (rev_id, rev_page, rev_comment, rev_user,
+                               rev_user_text, rev_timestamp, rev_minor_edit)
                        SELECT old_id, cur_id, old_comment, old_user, old_user_text,
                                old_timestamp, old_minor_edit
-                       FROM $old,$cur WHERE old_namespace=cur_namespace AND old_title=cur_title", __METHOD__ );
+                       FROM $old,$cur WHERE old_namespace=cur_namespace AND old_title=cur_title",
+                       __METHOD__
+               );
 
                $this->output( wfTimestamp( TS_DB ) );
                $this->output( "......Setting up page table.\n" );
-               $this->db->query( "INSERT INTO $page (page_id, page_namespace, page_title, page_restrictions, page_counter,
-                       page_is_redirect, page_is_new, page_random, page_touched, page_latest, page_len)
-                       SELECT cur_id, cur_namespace, cur_title, cur_restrictions, cur_counter, cur_is_redirect, cur_is_new,
-                               cur_random, cur_touched, rev_id, LENGTH(cur_text)
+               $this->db->query(
+                       "INSERT INTO $page (page_id, page_namespace, page_title,
+                               page_restrictions, page_counter, page_is_redirect, page_is_new, page_random,
+                               page_touched, page_latest, page_len)
+                       SELECT cur_id, cur_namespace, cur_title, cur_restrictions, cur_counter,
+                               cur_is_redirect, cur_is_new, cur_random, cur_touched, rev_id, LENGTH(cur_text)
                        FROM $cur,$revision
-                       WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}", __METHOD__ );
+                       WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}",
+                       __METHOD__
+               );
 
                $this->output( wfTimestamp( TS_DB ) );
                $this->output( "......Unlocking tables.\n" );
@@ -562,7 +613,11 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               $this->applyPatch( 'patch-pagelinks.sql', false, "Converting links and brokenlinks tables to pagelinks" );
+               $this->applyPatch(
+                       'patch-pagelinks.sql',
+                       false,
+                       'Converting links and brokenlinks tables to pagelinks'
+               );
 
                global $wgContLang;
                foreach ( MWNamespace::getCanonicalNamespaces() as $ns => $name ) {
@@ -616,14 +671,16 @@ class MysqlUpdater extends DatabaseUpdater {
                        if ( $info->type() == 'int' ) {
                                $oldug = $this->db->tableName( 'user_groups' );
                                $newug = $this->db->tableName( 'user_groups_bogus' );
-                               $this->output( "user_groups table exists but is in bogus intermediate format. Renaming to $newug... " );
+                               $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( "done.\n" );
 
                                $this->applyPatch( 'patch-user_groups.sql', false, "Re-adding fresh user_groups table" );
 
                                $this->output( "***\n" );
-                               $this->output( "*** WARNING: You will need to manually fix up user permissions in the user_groups\n" );
+                               $this->output( "*** WARNING: You will need to manually fix up user " .
+                                       "permissions in the user_groups\n" );
                                $this->output( "*** table. Old 1.5 alpha versions did some pretty funky stuff...\n" );
                                $this->output( "***\n" );
                        } else {
@@ -637,7 +694,11 @@ class MysqlUpdater extends DatabaseUpdater {
 
                if ( !$this->db->tableExists( 'user_rights', __METHOD__ ) ) {
                        if ( $this->db->fieldExists( 'user', 'user_rights', __METHOD__ ) ) {
-                               $this->db->applyPatch( 'patch-user_rights.sql', false, "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion" );
+                               $this->db->applyPatch(
+                                       'patch-user_rights.sql',
+                                       false,
+                                       'Upgrading from a 1.3 or older database? Breaking out user_rights for conversion'
+                               );
                        } 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" );
@@ -684,7 +745,11 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               $this->applyPatch( 'patch-watchlist-null.sql', false, "Making wl_notificationtimestamp nullable" );
+               $this->applyPatch(
+                       'patch-watchlist-null.sql',
+                       false,
+                       'Making wl_notificationtimestamp nullable'
+               );
        }
 
        /**
@@ -744,7 +809,8 @@ class MysqlUpdater extends DatabaseUpdater {
                                ), __METHOD__
                        );
                }
-               $this->output( "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n" );
+               $this->output( "Done. Please run maintenance/refreshLinks.php for a more " .
+                       "thorough templatelinks update.\n" );
        }
 
        protected function doBacklinkingIndicesUpdate() {
@@ -768,8 +834,16 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               $this->applyPatch( 'patch-page_restrictions.sql', false, "Creating page_restrictions table (1/2)" );
-               $this->applyPatch( 'patch-page_restrictions_sortkey.sql', false, "Creating page_restrictions table (2/2)" );
+               $this->applyPatch(
+                       'patch-page_restrictions.sql',
+                       false,
+                       'Creating page_restrictions table (1/2)'
+               );
+               $this->applyPatch(
+                       'patch-page_restrictions_sortkey.sql',
+                       false,
+                       'Creating page_restrictions table (2/2)'
+               );
                $this->output( "done.\n" );
 
                $this->output( "Migrating old restrictions to new table...\n" );
@@ -838,7 +912,11 @@ class MysqlUpdater extends DatabaseUpdater {
                        return true;
                }
 
-               return $this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
+               return $this->applyPatch(
+                       'patch-profiling-memory.sql',
+                       false,
+                       'Adding pf_memory field to table profiling'
+               );
        }
 
        protected function doFilearchiveIndicesUpdate() {
@@ -858,12 +936,17 @@ class MysqlUpdater extends DatabaseUpdater {
                        return true;
                }
                if ( $this->skipSchema ) {
-                       $this->output( "...skipping schema change (making pl_namespace, tl_namespace and il_to indices UNIQUE).\n" );
+                       $this->output( "...skipping schema change (making pl_namespace, tl_namespace " .
+                               "and il_to indices UNIQUE).\n" );
 
                        return false;
                }
 
-               return $this->applyPatch( 'patch-pl-tl-il-unique.sql', false, "Making pl_namespace, tl_namespace and il_to indices UNIQUE" );
+               return $this->applyPatch(
+                       'patch-pl-tl-il-unique.sql',
+                       false,
+                       'Making pl_namespace, tl_namespace and il_to indices UNIQUE'
+               );
        }
 
        protected function doUpdateMimeMinorField() {
@@ -873,7 +956,11 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               $this->applyPatch( 'patch-mime_minor_length.sql', false, "Altering all *_mime_minor fields to 100 bytes in size" );
+               $this->applyPatch(
+                       'patch-mime_minor_length.sql',
+                       false,
+                       'Altering all *_mime_minor fields to 100 bytes in size'
+               );
        }
 
        protected function doClFieldsUpdate() {
@@ -883,7 +970,11 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               $this->applyPatch( 'patch-categorylinks-better-collation2.sql', false, 'Updating categorylinks (again)' );
+               $this->applyPatch(
+                       'patch-categorylinks-better-collation2.sql',
+                       false,
+                       'Updating categorylinks (again)'
+               );
        }
 
        protected function doLangLinksLengthUpdate() {
@@ -892,7 +983,11 @@ class MysqlUpdater extends DatabaseUpdater {
                $row = $this->db->fetchObject( $res );
 
                if ( $row && $row->Type == "varbinary(10)" ) {
-                       $this->applyPatch( 'patch-langlinks-ll_lang-20.sql', false, 'Updating length of ll_lang in langlinks' );
+                       $this->applyPatch(
+                               'patch-langlinks-ll_lang-20.sql',
+                               false,
+                               'Updating length of ll_lang in langlinks'
+                       );
                } else {
                        $this->output( "...ll_lang is up-to-date.\n" );
                }
@@ -913,7 +1008,11 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               $this->applyPatch( 'patch-user-newtalk-timestamp-null.sql', false, "Making user_last_timestamp nullable" );
+               $this->applyPatch(
+                       'patch-user-newtalk-timestamp-null.sql',
+                       false,
+                       'Making user_last_timestamp nullable'
+               );
        }
 
        protected function doIwlinksIndexNonUnique() {
@@ -929,6 +1028,10 @@ class MysqlUpdater extends DatabaseUpdater {
                        return false;
                }
 
-               return $this->applyPatch( 'patch-iwl_prefix_title_from-non-unique.sql', false, "Making iwl_prefix_title_from index non-UNIQUE" );
+               return $this->applyPatch(
+                       'patch-iwl_prefix_title_from-non-unique.sql',
+                       false,
+                       'Making iwl_prefix_title_from index non-UNIQUE'
+               );
        }
 }
index efa8d00..7757510 100644 (file)
@@ -60,12 +60,22 @@ class OracleInstaller extends DatabaseInstaller {
                        $this->parent->setVar( 'wgDBserver', '' );
                }
 
-               return $this->getTextBox( 'wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox( 'config-db-host-oracle-help' ) ) .
+               return $this->getTextBox(
+                       'wgDBserver',
+                       'config-db-host-oracle',
+                       array(),
+                       $this->parent->getHelpBox( 'config-db-host-oracle-help' )
+               ) .
                        Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
                        $this->getTextBox( 'wgDBprefix', 'config-db-prefix' ) .
                        $this->getTextBox( '_OracleDefTS', 'config-oracle-def-ts' ) .
-                       $this->getTextBox( '_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox( 'config-db-oracle-help' ) ) .
+                       $this->getTextBox(
+                               '_OracleTempTS',
+                               'config-oracle-temp-ts',
+                               array(),
+                               $this->parent->getHelpBox( 'config-db-oracle-help' )
+                       ) .
                        Html::closeElement( 'fieldset' ) .
                        $this->parent->getWarningBox( wfMessage( 'config-db-account-oracle-warn' )->text() ) .
                        $this->getInstallUserBox() .
@@ -81,7 +91,12 @@ class OracleInstaller extends DatabaseInstaller {
 
        public function submitConnectForm() {
                // Get variables from the request
-               $newValues = $this->setVarsFromRequest( array( 'wgDBserver', 'wgDBprefix', 'wgDBuser', 'wgDBpassword' ) );
+               $newValues = $this->setVarsFromRequest(
+                       'wgDBserver',
+                       'wgDBprefix',
+                       'wgDBuser',
+                       'wgDBpassword'
+               );
                $this->parent->setVar( 'wgDBname', $this->getVar( 'wgDBuser' ) );
 
                // Validate them
@@ -318,8 +333,11 @@ class OracleInstaller extends DatabaseInstaller {
         * @return bool Whether the connection string is valid.
         */
        public static function checkConnectStringFormat( $connect_string ) {
+               // @@codingStandardsIgnoreStart Long lines with regular expressions.
+               // @todo Very long regular expression. Make more readable?
                $isValid = preg_match( '/^[[:alpha:]][\w\-]*(?:\.[[:alpha:]][\w\-]*){0,2}$/', $connect_string ); // TNS name
                $isValid |= preg_match( '/^(?:\/\/)?[\w\-\.]+(?::[\d]+)?(?:\/(?:[\w\-\.]+(?::(pooled|dedicated|shared))?)?(?:\/[\w\-\.]+)?)?$/', $connect_string ); // EZConnect
+               // @@codingStandardsIgnoreEnd
                return (bool)$isValid;
        }
 }
index 8484189..ec91e57 100644 (file)
@@ -48,13 +48,13 @@ class OracleUpdater extends DatabaseUpdater {
                        array( 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ),
 
                        //1.18
-                       array( 'addIndex',      'user',          'i02',       'patch-user_email_index.sql' ),
+                       array( 'addIndex', 'user', 'i02', 'patch-user_email_index.sql' ),
                        array( 'modifyField', 'user_properties', 'up_property', 'patch-up_property.sql' ),
                        array( 'addTable', 'uploadstash', 'patch-uploadstash.sql' ),
                        array( 'doRecentchangesFK2Cascade' ),
 
                        //1.19
-                       array( 'addIndex', 'logging',       'i05',      'patch-logging_type_action_index.sql'),
+                       array( 'addIndex', 'logging', 'i05', 'patch-logging_type_action_index.sql' ),
                        array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1_field.sql' ),
                        array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1_field.sql' ),
                        array( 'doRemoveNotNullEmptyDefaults2' ),
@@ -70,22 +70,25 @@ class OracleUpdater extends DatabaseUpdater {
                        array( 'dropField', 'category', 'cat_hidden', 'patch-cat_hidden.sql' ),
 
                        //1.21
-                       array( 'addField',      'revision',     'rev_content_format',           'patch-revision-rev_content_format.sql' ),
-                       array( 'addField',      'revision',     'rev_content_model',            'patch-revision-rev_content_model.sql' ),
-                       array( 'addField',      'archive',      'ar_content_format',            'patch-archive-ar_content_format.sql' ),
-                       array( 'addField',      'archive',      'ar_content_model',             'patch-archive-ar_content_model.sql' ),
-                       array( 'addField',      'archive',      'ar_id',                        'patch-archive-ar_id.sql' ),
-                       array( 'addField',      'externallinks',        'el_id',                'patch-externallinks-el_id.sql' ),
-                       array( 'addField',      'page',     'page_content_model',               'patch-page-page_content_model.sql' ),
-                       array( 'dropField', 'site_stats', 'ss_admins',  'patch-ss_admins.sql' ),
+                       array( 'addField', 'revision', 'rev_content_format',
+                               'patch-revision-rev_content_format.sql' ),
+                       array( 'addField', 'revision', 'rev_content_model',
+                               'patch-revision-rev_content_model.sql' ),
+                       array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
+                       array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
+                       array( 'addField', 'archive', 'ar_id', 'patch-archive-ar_id.sql' ),
+                       array( 'addField', 'externallinks', 'el_id', 'patch-externallinks-el_id.sql' ),
+                       array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
+                       array( 'dropField', 'site_stats', 'ss_admins', 'patch-ss_admins.sql' ),
                        array( 'dropField', 'recentchanges', 'rc_moved_to_title', 'patch-rc_moved.sql' ),
-                       array( 'addTable', 'sites',                            'patch-sites.sql' ),
-                       array( 'addField', 'filearchive',   'fa_sha1',          'patch-fa_sha1.sql' ),
-                       array( 'addField', 'job',           'job_token',         'patch-job_token.sql' ),
-                       array( 'addField', 'job',           'job_attempts',       'patch-job_attempts.sql' ),
-                       array( 'addField', 'uploadstash',      'us_props',      'patch-uploadstash-us_props.sql' ),
+                       array( 'addTable', 'sites', 'patch-sites.sql' ),
+                       array( 'addField', 'filearchive', 'fa_sha1', 'patch-fa_sha1.sql' ),
+                       array( 'addField', 'job', 'job_token', 'patch-job_token.sql' ),
+                       array( 'addField', 'job', 'job_attempts', 'patch-job_attempts.sql' ),
+                       array( 'addField', 'uploadstash', 'us_props', 'patch-uploadstash-us_props.sql' ),
                        array( 'modifyField', 'user_groups', 'ug_group', 'patch-ug_group-length-increase-255.sql' ),
-                       array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ufg_group-length-increase-255.sql' ),
+                       array( 'modifyField', 'user_former_groups', 'ufg_group',
+                               'patch-ufg_group-length-increase-255.sql' ),
 
                        // KEEP THIS AT THE BOTTOM!!
                        array( 'doRebuildDuplicateFunction' ),
@@ -104,14 +107,22 @@ class OracleUpdater extends DatabaseUpdater {
                        return;
                }
 
-               $this->applyPatch( 'patch_namespace_defaults.sql', false, "Altering namespace fields with default value" );
+               $this->applyPatch(
+                       'patch_namespace_defaults.sql',
+                       false,
+                       'Altering namespace fields with default value'
+               );
        }
 
        /**
         * Uniform FK names + deferrable state
         */
        protected function doFKRenameDeferr() {
-               $meta = $this->db->query( 'SELECT COUNT(*) cnt FROM user_constraints WHERE constraint_type = \'R\' AND deferrable = \'DEFERRABLE\'' );
+               $meta = $this->db->query( '
+                       SELECT COUNT(*) cnt
+                       FROM user_constraints
+                       WHERE constraint_type = \'R\' AND deferrable = \'DEFERRABLE\''
+               );
                $row = $meta->fetchRow();
                if ( $row && $row['cnt'] > 0 ) {
                        return;
@@ -169,7 +180,11 @@ class OracleUpdater extends DatabaseUpdater {
                if ( $meta->isNullable() ) {
                        return;
                }
-               $this->applyPatch( 'patch_remove_not_null_empty_defs.sql', false, "Removing not null empty constraints" );
+               $this->applyPatch(
+                       'patch_remove_not_null_empty_defs.sql',
+                       false,
+                       'Removing not null empty constraints'
+               );
        }
 
        protected function doRemoveNotNullEmptyDefaults2() {
@@ -177,7 +192,11 @@ class OracleUpdater extends DatabaseUpdater {
                if ( $meta->isNullable() ) {
                        return;
                }
-               $this->applyPatch( 'patch_remove_not_null_empty_defs2.sql', false, "Removing not null empty constraints" );
+               $this->applyPatch(
+                       'patch_remove_not_null_empty_defs2.sql',
+                       false,
+                       'Removing not null empty constraints'
+               );
        }
 
        /**
index a7e8462..2cf4156 100644 (file)
@@ -42,8 +42,8 @@ class PostgresInstaller extends DatabaseInstaller {
                '_InstallUser' => 'postgres',
        );
 
-       var $minimumVersion = '8.3';
-       var $maxRoleSearchDepth = 5;
+       public $minimumVersion = '8.3';
+       public $maxRoleSearchDepth = 5;
 
        protected $pgConns = array();
 
@@ -56,12 +56,27 @@ class PostgresInstaller extends DatabaseInstaller {
        }
 
        function getConnectForm() {
-               return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
+               return $this->getTextBox(
+                       'wgDBserver',
+                       'config-db-host',
+                       array(),
+                       $this->parent->getHelpBox( 'config-db-host-help' )
+               ) .
                        $this->getTextBox( 'wgDBport', 'config-db-port' ) .
                        Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
-                       $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) .
-                       $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) .
+                       $this->getTextBox(
+                               'wgDBname',
+                               'config-db-name',
+                               array(),
+                               $this->parent->getHelpBox( 'config-db-name-help' )
+                       ) .
+                       $this->getTextBox(
+                               'wgDBmwschema',
+                               'config-db-schema',
+                               array(),
+                               $this->parent->getHelpBox( 'config-db-schema-help' )
+                       ) .
                        Html::closeElement( 'fieldset' ) .
                        $this->getInstallUserBox();
        }
index f0e4aec..dfe7865 100644 (file)
@@ -51,16 +51,16 @@ class PostgresUpdater extends DatabaseUpdater {
                        array( 'renameIndex', 'pagecontent', 'text_pkey', 'pagecontent_pkey' ),
 
                        # renamed sequences
-                       array( 'renameSequence', 'ipblocks_ipb_id_val', 'ipblocks_ipb_id_seq'         ),
-                       array( 'renameSequence', 'rev_rev_id_val',      'revision_rev_id_seq'         ),
-                       array( 'renameSequence', 'text_old_id_val',     'text_old_id_seq'             ),
-                       array( 'renameSequence', 'rc_rc_id_seq',        'recentchanges_rc_id_seq'     ),
-                       array( 'renameSequence', 'log_log_id_seq',      'logging_log_id_seq'          ),
-                       array( 'renameSequence', 'pr_id_val',           'page_restrictions_pr_id_seq' ),
-                       array( 'renameSequence', 'us_id_seq',           'uploadstash_us_id_seq' ),
+                       array( 'renameSequence', 'ipblocks_ipb_id_val', 'ipblocks_ipb_id_seq' ),
+                       array( 'renameSequence', 'rev_rev_id_val', 'revision_rev_id_seq' ),
+                       array( 'renameSequence', 'text_old_id_val', 'text_old_id_seq' ),
+                       array( 'renameSequence', 'rc_rc_id_seq', 'recentchanges_rc_id_seq' ),
+                       array( 'renameSequence', 'log_log_id_seq', 'logging_log_id_seq' ),
+                       array( 'renameSequence', 'pr_id_val', 'page_restrictions_pr_id_seq' ),
+                       array( 'renameSequence', 'us_id_seq', 'uploadstash_us_id_seq' ),
 
                        # since r58263
-                       array( 'renameSequence', 'category_id_seq', 'category_cat_id_seq'),
+                       array( 'renameSequence', 'category_id_seq', 'category_cat_id_seq' ),
 
                        # new sequences if not renamed above
                        array( 'addSequence', 'logging', false, 'logging_log_id_seq' ),
@@ -68,200 +68,216 @@ class PostgresUpdater extends DatabaseUpdater {
                        array( 'addSequence', 'filearchive', 'fa_id', 'filearchive_fa_id_seq' ),
 
                        # new tables
-                       array( 'addTable', 'category',          'patch-category.sql' ),
-                       array( 'addTable', 'page',              'patch-page.sql' ),
-                       array( 'addTable', 'querycachetwo',     'patch-querycachetwo.sql' ),
-                       array( 'addTable', 'page_props',        'patch-page_props.sql' ),
+                       array( 'addTable', 'category', 'patch-category.sql' ),
+                       array( 'addTable', 'page', 'patch-page.sql' ),
+                       array( 'addTable', 'querycachetwo', 'patch-querycachetwo.sql' ),
+                       array( 'addTable', 'page_props', 'patch-page_props.sql' ),
                        array( 'addTable', 'page_restrictions', 'patch-page_restrictions.sql' ),
-                       array( 'addTable', 'profiling',         'patch-profiling.sql' ),
-                       array( 'addTable', 'protected_titles',  'patch-protected_titles.sql' ),
-                       array( 'addTable', 'redirect',          'patch-redirect.sql' ),
-                       array( 'addTable', 'updatelog',         'patch-updatelog.sql' ),
-                       array( 'addTable', 'change_tag',        'patch-change_tag.sql' ),
-                       array( 'addTable', 'tag_summary',       'patch-tag_summary.sql' ),
-                       array( 'addTable', 'valid_tag',         'patch-valid_tag.sql' ),
-                       array( 'addTable', 'user_properties',   'patch-user_properties.sql' ),
-                       array( 'addTable', 'log_search',        'patch-log_search.sql' ),
-                       array( 'addTable', 'l10n_cache',        'patch-l10n_cache.sql' ),
-                       array( 'addTable', 'iwlinks',           'patch-iwlinks.sql' ),
-                       array( 'addTable', 'msg_resource',      'patch-msg_resource.sql' ),
-                       array( 'addTable', 'msg_resource_links','patch-msg_resource_links.sql' ),
-                       array( 'addTable', 'module_deps',       'patch-module_deps.sql' ),
-                       array( 'addTable', 'uploadstash',       'patch-uploadstash.sql' ),
-                       array( 'addTable', 'user_former_groups','patch-user_former_groups.sql' ),
-                       array( 'addTable', 'sites',             'patch-sites.sql' ),
+                       array( 'addTable', 'profiling', 'patch-profiling.sql' ),
+                       array( 'addTable', 'protected_titles', 'patch-protected_titles.sql' ),
+                       array( 'addTable', 'redirect', 'patch-redirect.sql' ),
+                       array( 'addTable', 'updatelog', 'patch-updatelog.sql' ),
+                       array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),
+                       array( 'addTable', 'tag_summary', 'patch-tag_summary.sql' ),
+                       array( 'addTable', 'valid_tag', 'patch-valid_tag.sql' ),
+                       array( 'addTable', 'user_properties', 'patch-user_properties.sql' ),
+                       array( 'addTable', 'log_search', 'patch-log_search.sql' ),
+                       array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ),
+                       array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
+                       array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
+                       array( 'addTable', 'msg_resource_links', 'patch-msg_resource_links.sql' ),
+                       array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
+                       array( 'addTable', 'uploadstash', 'patch-uploadstash.sql' ),
+                       array( 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ),
+                       array( 'addTable', 'sites', 'patch-sites.sql' ),
 
                        # Needed before new field
                        array( 'convertArchive2' ),
 
                        # new fields
-                       array( 'addPgField', 'updatelog',     'ul_value',             'TEXT' ),
-                       array( 'addPgField', 'archive',       'ar_deleted',           'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'archive',       'ar_len',               'INTEGER' ),
-                       array( 'addPgField', 'archive',       'ar_page_id',           'INTEGER' ),
-                       array( 'addPgField', 'archive',       'ar_parent_id',         'INTEGER' ),
-                       array( 'addPgField', 'archive',       'ar_content_model',     'TEXT' ),
-                       array( 'addPgField', 'archive',       'ar_content_format',    'TEXT' ),
-                       array( 'addPgField', 'categorylinks', 'cl_sortkey_prefix',    "TEXT NOT NULL DEFAULT ''"),
-                       array( 'addPgField', 'categorylinks', 'cl_collation',         "TEXT NOT NULL DEFAULT 0" ),
-                       array( 'addPgField', 'categorylinks', 'cl_type',              "TEXT NOT NULL DEFAULT 'page'" ),
-                       array( 'addPgField', 'image',         'img_sha1',             "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'ipblocks',      'ipb_allow_usertalk',   'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'ipblocks',      'ipb_anon_only',        'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'ipblocks',      'ipb_by_text',          "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'ipblocks',      'ipb_block_email',      'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'ipblocks',      'ipb_create_account',   'SMALLINT NOT NULL DEFAULT 1' ),
-                       array( 'addPgField', 'ipblocks',      'ipb_deleted',          'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'ipblocks',      'ipb_enable_autoblock', 'SMALLINT NOT NULL DEFAULT 1' ),
-                       array( 'addPgField', 'ipblocks',      'ipb_parent_block_id',            'INTEGER DEFAULT NULL REFERENCES ipblocks(ipb_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED' ),
-                       array( 'addPgField', 'filearchive',   'fa_deleted',           'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'filearchive',   'fa_sha1',              "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'logging',       'log_deleted',          'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'logging',       'log_id',               "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('logging_log_id_seq')" ),
-                       array( 'addPgField', 'logging',       'log_params',           'TEXT' ),
-                       array( 'addPgField', 'mwuser',        'user_editcount',       'INTEGER' ),
-                       array( 'addPgField', 'mwuser',        'user_newpass_time',    'TIMESTAMPTZ' ),
-                       array( 'addPgField', 'oldimage',      'oi_deleted',           'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'oldimage',      'oi_major_mime',        "TEXT NOT NULL DEFAULT 'unknown'" ),
-                       array( 'addPgField', 'oldimage',      'oi_media_type',        'TEXT' ),
-                       array( 'addPgField', 'oldimage',      'oi_metadata',          "BYTEA NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'oldimage',      'oi_minor_mime',        "TEXT NOT NULL DEFAULT 'unknown'" ),
-                       array( 'addPgField', 'oldimage',      'oi_sha1',              "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'page',          'page_content_model',   'TEXT' ),
-                       array( 'addPgField', 'page_restrictions', 'pr_id',            "INTEGER NOT NULL UNIQUE DEFAULT nextval('page_restrictions_pr_id_seq')" ),
-                       array( 'addPgField', 'profiling',     'pf_memory',            'NUMERIC(18,10) NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'recentchanges', 'rc_deleted',           'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'recentchanges', 'rc_log_action',        'TEXT' ),
-                       array( 'addPgField', 'recentchanges', 'rc_log_type',          'TEXT' ),
-                       array( 'addPgField', 'recentchanges', 'rc_logid',             'INTEGER NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'recentchanges', 'rc_new_len',           'INTEGER' ),
-                       array( 'addPgField', 'recentchanges', 'rc_old_len',           'INTEGER' ),
-                       array( 'addPgField', 'recentchanges', 'rc_params',            'TEXT' ),
-                       array( 'addPgField', 'redirect',      'rd_interwiki',         'TEXT NULL' ),
-                       array( 'addPgField', 'redirect',      'rd_fragment',          'TEXT NULL' ),
-                       array( 'addPgField', 'revision',      'rev_deleted',          'SMALLINT NOT NULL DEFAULT 0' ),
-                       array( 'addPgField', 'revision',      'rev_len',              'INTEGER' ),
-                       array( 'addPgField', 'revision',      'rev_parent_id',        'INTEGER DEFAULT NULL' ),
-                       array( 'addPgField', 'revision',      'rev_content_model',    'TEXT' ),
-                       array( 'addPgField', 'revision',      'rev_content_format',   'TEXT' ),
-                       array( 'addPgField', 'site_stats',    'ss_active_users',      "INTEGER DEFAULT '-1'" ),
-                       array( 'addPgField', 'user_newtalk',  'user_last_timestamp',  'TIMESTAMPTZ' ),
-                       array( 'addPgField', 'logging',       'log_user_text',        "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'logging',       'log_page',             'INTEGER' ),
-                       array( 'addPgField', 'interwiki',     'iw_api',               "TEXT NOT NULL DEFAULT ''"),
-                       array( 'addPgField', 'interwiki',     'iw_wikiid',            "TEXT NOT NULL DEFAULT ''"),
-                       array( 'addPgField', 'revision',      'rev_sha1',             "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'archive',       'ar_sha1',              "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'uploadstash',   'us_chunk_inx',         "INTEGER NULL" ),
-                       array( 'addPgField', 'job',           'job_timestamp',        "TIMESTAMPTZ" ),
-                       array( 'addPgField', 'job',           'job_random',           "INTEGER NOT NULL DEFAULT 0" ),
-                       array( 'addPgField', 'job',           'job_attempts',         "INTEGER NOT NULL DEFAULT 0" ),
-                       array( 'addPgField', 'job',           'job_token',            "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'job',           'job_token_timestamp',  "TIMESTAMPTZ" ),
-                       array( 'addPgField', 'job',           'job_sha1',             "TEXT NOT NULL DEFAULT ''" ),
-                       array( 'addPgField', 'archive',       'ar_id',                "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('archive_ar_id_seq')" ),
-                       array( 'addPgField', 'externallinks', 'el_id',                "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('externallinks_el_id_seq')" ),
-
+                       array( 'addPgField', 'updatelog', 'ul_value', 'TEXT' ),
+                       array( 'addPgField', 'archive', 'ar_deleted', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'archive', 'ar_len', 'INTEGER' ),
+                       array( 'addPgField', 'archive', 'ar_page_id', 'INTEGER' ),
+                       array( 'addPgField', 'archive', 'ar_parent_id', 'INTEGER' ),
+                       array( 'addPgField', 'archive', 'ar_content_model', 'TEXT' ),
+                       array( 'addPgField', 'archive', 'ar_content_format', 'TEXT' ),
+                       array( 'addPgField', 'categorylinks', 'cl_sortkey_prefix', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'categorylinks', 'cl_collation', "TEXT NOT NULL DEFAULT 0" ),
+                       array( 'addPgField', 'categorylinks', 'cl_type', "TEXT NOT NULL DEFAULT 'page'" ),
+                       array( 'addPgField', 'image', 'img_sha1', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'ipblocks', 'ipb_allow_usertalk', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'ipblocks', 'ipb_anon_only', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'ipblocks', 'ipb_by_text', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'ipblocks', 'ipb_block_email', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'ipblocks', 'ipb_create_account', 'SMALLINT NOT NULL DEFAULT 1' ),
+                       array( 'addPgField', 'ipblocks', 'ipb_deleted', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'ipblocks', 'ipb_enable_autoblock', 'SMALLINT NOT NULL DEFAULT 1' ),
+                       array( 'addPgField', 'ipblocks', 'ipb_parent_block_id',
+                               'INTEGER DEFAULT NULL REFERENCES ipblocks(ipb_id) ' .
+                               'ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED' ),
+                       array( 'addPgField', 'filearchive', 'fa_deleted', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'filearchive', 'fa_sha1', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'logging', 'log_deleted', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'logging', 'log_id',
+                               "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('logging_log_id_seq')" ),
+                       array( 'addPgField', 'logging', 'log_params', 'TEXT' ),
+                       array( 'addPgField', 'mwuser', 'user_editcount', 'INTEGER' ),
+                       array( 'addPgField', 'mwuser', 'user_newpass_time', 'TIMESTAMPTZ' ),
+                       array( 'addPgField', 'oldimage', 'oi_deleted', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'oldimage', 'oi_major_mime', "TEXT NOT NULL DEFAULT 'unknown'" ),
+                       array( 'addPgField', 'oldimage', 'oi_media_type', 'TEXT' ),
+                       array( 'addPgField', 'oldimage', 'oi_metadata', "BYTEA NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'oldimage', 'oi_minor_mime', "TEXT NOT NULL DEFAULT 'unknown'" ),
+                       array( 'addPgField', 'oldimage', 'oi_sha1', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'page', 'page_content_model', 'TEXT' ),
+                       array( 'addPgField', 'page_restrictions', 'pr_id',
+                               "INTEGER NOT NULL UNIQUE DEFAULT nextval('page_restrictions_pr_id_seq')" ),
+                       array( 'addPgField', 'profiling', 'pf_memory', 'NUMERIC(18,10) NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'recentchanges', 'rc_deleted', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'recentchanges', 'rc_log_action', 'TEXT' ),
+                       array( 'addPgField', 'recentchanges', 'rc_log_type', 'TEXT' ),
+                       array( 'addPgField', 'recentchanges', 'rc_logid', 'INTEGER NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'recentchanges', 'rc_new_len', 'INTEGER' ),
+                       array( 'addPgField', 'recentchanges', 'rc_old_len', 'INTEGER' ),
+                       array( 'addPgField', 'recentchanges', 'rc_params', 'TEXT' ),
+                       array( 'addPgField', 'redirect', 'rd_interwiki', 'TEXT NULL' ),
+                       array( 'addPgField', 'redirect', 'rd_fragment', 'TEXT NULL' ),
+                       array( 'addPgField', 'revision', 'rev_deleted', 'SMALLINT NOT NULL DEFAULT 0' ),
+                       array( 'addPgField', 'revision', 'rev_len', 'INTEGER' ),
+                       array( 'addPgField', 'revision', 'rev_parent_id', 'INTEGER DEFAULT NULL' ),
+                       array( 'addPgField', 'revision', 'rev_content_model', 'TEXT' ),
+                       array( 'addPgField', 'revision', 'rev_content_format', 'TEXT' ),
+                       array( 'addPgField', 'site_stats', 'ss_active_users', "INTEGER DEFAULT '-1'" ),
+                       array( 'addPgField', 'user_newtalk', 'user_last_timestamp', 'TIMESTAMPTZ' ),
+                       array( 'addPgField', 'logging', 'log_user_text', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'logging', 'log_page', 'INTEGER' ),
+                       array( 'addPgField', 'interwiki', 'iw_api', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'interwiki', 'iw_wikiid', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'revision', 'rev_sha1', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'archive', 'ar_sha1', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'uploadstash', 'us_chunk_inx', "INTEGER NULL" ),
+                       array( 'addPgField', 'job', 'job_timestamp', "TIMESTAMPTZ" ),
+                       array( 'addPgField', 'job', 'job_random', "INTEGER NOT NULL DEFAULT 0" ),
+                       array( 'addPgField', 'job', 'job_attempts', "INTEGER NOT NULL DEFAULT 0" ),
+                       array( 'addPgField', 'job', 'job_token', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'job', 'job_token_timestamp', "TIMESTAMPTZ" ),
+                       array( 'addPgField', 'job', 'job_sha1', "TEXT NOT NULL DEFAULT ''" ),
+                       array( 'addPgField', 'archive', 'ar_id',
+                               "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('archive_ar_id_seq')" ),
+                       array( 'addPgField', 'externallinks', 'el_id',
+                               "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('externallinks_el_id_seq')" ),
 
                        # type changes
-                       array( 'changeField', 'archive',       'ar_deleted',      'smallint', '' ),
-                       array( 'changeField', 'archive',       'ar_minor_edit',   'smallint', 'ar_minor_edit::smallint DEFAULT 0' ),
-                       array( 'changeField', 'filearchive',   'fa_deleted',      'smallint', '' ),
-                       array( 'changeField', 'filearchive',   'fa_height',       'integer',  '' ),
-                       array( 'changeField', 'filearchive',   'fa_metadata',     'bytea',    "decode(fa_metadata,'escape')" ),
-                       array( 'changeField', 'filearchive',   'fa_size',         'integer',  '' ),
-                       array( 'changeField', 'filearchive',   'fa_width',        'integer',  '' ),
-                       array( 'changeField', 'filearchive',   'fa_storage_group', 'text',     '' ),
-                       array( 'changeField', 'filearchive',   'fa_storage_key',  'text',     '' ),
-                       array( 'changeField', 'image',         'img_metadata',    'bytea',    "decode(img_metadata,'escape')" ),
-                       array( 'changeField', 'image',         'img_size',        'integer',  '' ),
-                       array( 'changeField', 'image',         'img_width',       'integer',  '' ),
-                       array( 'changeField', 'image',         'img_height',      'integer',  '' ),
-                       array( 'changeField', 'interwiki',     'iw_local',        'smallint', 'iw_local::smallint' ),
-                       array( 'changeField', 'interwiki',     'iw_trans',        'smallint', 'iw_trans::smallint DEFAULT 0' ),
-                       array( 'changeField', 'ipblocks',      'ipb_auto',        'smallint', 'ipb_auto::smallint DEFAULT 0' ),
-                       array( 'changeField', 'ipblocks',      'ipb_anon_only',   'smallint', "CASE WHEN ipb_anon_only=' ' THEN 0 ELSE ipb_anon_only::smallint END DEFAULT 0" ),
-                       array( 'changeField', 'ipblocks',      'ipb_create_account', 'smallint', "CASE WHEN ipb_create_account=' ' THEN 0 ELSE ipb_create_account::smallint END DEFAULT 1" ),
-                       array( 'changeField', 'ipblocks',      'ipb_enable_autoblock', 'smallint', "CASE WHEN ipb_enable_autoblock=' ' THEN 0 ELSE ipb_enable_autoblock::smallint END DEFAULT 1" ),
-                       array( 'changeField', 'ipblocks',      'ipb_block_email', 'smallint', "CASE WHEN ipb_block_email=' ' THEN 0 ELSE ipb_block_email::smallint END DEFAULT 0" ),
-                       array( 'changeField', 'ipblocks',      'ipb_address',     'text',     'ipb_address::text' ),
-                       array( 'changeField', 'ipblocks',      'ipb_deleted',     'smallint', 'ipb_deleted::smallint DEFAULT 0' ),
-                       array( 'changeField', 'mwuser',        'user_token',      'text',     '' ),
-                       array( 'changeField', 'mwuser',        'user_email_token', 'text',     '' ),
-                       array( 'changeField', 'objectcache',   'keyname',         'text',     '' ),
-                       array( 'changeField', 'oldimage',      'oi_height',       'integer',  '' ),
-                       array( 'changeField', 'oldimage',      'oi_metadata',     'bytea',    "decode(img_metadata,'escape')" ),
-                       array( 'changeField', 'oldimage',      'oi_size',         'integer',  '' ),
-                       array( 'changeField', 'oldimage',      'oi_width',        'integer',  '' ),
-                       array( 'changeField', 'page',          'page_is_redirect', 'smallint', 'page_is_redirect::smallint DEFAULT 0' ),
-                       array( 'changeField', 'page',          'page_is_new',     'smallint', 'page_is_new::smallint DEFAULT 0' ),
-                       array( 'changeField', 'querycache',    'qc_value',        'integer',  '' ),
-                       array( 'changeField', 'querycachetwo', 'qcc_value',       'integer',  '' ),
-                       array( 'changeField', 'recentchanges', 'rc_bot',          'smallint', 'rc_bot::smallint DEFAULT 0' ),
-                       array( 'changeField', 'recentchanges', 'rc_deleted',      'smallint', '' ),
-                       array( 'changeField', 'recentchanges', 'rc_minor',        'smallint', 'rc_minor::smallint DEFAULT 0' ),
-                       array( 'changeField', 'recentchanges', 'rc_new',          'smallint', 'rc_new::smallint DEFAULT 0' ),
-                       array( 'changeField', 'recentchanges', 'rc_type',         'smallint', 'rc_type::smallint DEFAULT 0' ),
-                       array( 'changeField', 'recentchanges', 'rc_patrolled',    'smallint', 'rc_patrolled::smallint DEFAULT 0' ),
-                       array( 'changeField', 'revision',      'rev_deleted',     'smallint', 'rev_deleted::smallint DEFAULT 0' ),
-                       array( 'changeField', 'revision',      'rev_minor_edit',  'smallint', 'rev_minor_edit::smallint DEFAULT 0' ),
-                       array( 'changeField', 'templatelinks', 'tl_namespace',    'smallint', 'tl_namespace::smallint' ),
-                       array( 'changeField', 'user_newtalk',  'user_ip',         'text',     'host(user_ip)' ),
-                       array( 'changeField', 'uploadstash',   'us_image_bits',   'smallint', '' ),
-                       array( 'changeField', 'profiling',     'pf_time',         'float', '' ),
-                       array( 'changeField', 'profiling',     'pf_memory',       'float', '' ),
+                       array( 'changeField', 'archive', 'ar_deleted', 'smallint', '' ),
+                       array( 'changeField', 'archive', 'ar_minor_edit', 'smallint',
+                               'ar_minor_edit::smallint DEFAULT 0' ),
+                       array( 'changeField', 'filearchive', 'fa_deleted', 'smallint', '' ),
+                       array( 'changeField', 'filearchive', 'fa_height', 'integer', '' ),
+                       array( 'changeField', 'filearchive', 'fa_metadata', 'bytea', "decode(fa_metadata,'escape')" ),
+                       array( 'changeField', 'filearchive', 'fa_size', 'integer', '' ),
+                       array( 'changeField', 'filearchive', 'fa_width', 'integer', '' ),
+                       array( 'changeField', 'filearchive', 'fa_storage_group', 'text', '' ),
+                       array( 'changeField', 'filearchive', 'fa_storage_key', 'text', '' ),
+                       array( 'changeField', 'image', 'img_metadata', 'bytea', "decode(img_metadata,'escape')" ),
+                       array( 'changeField', 'image', 'img_size', 'integer', '' ),
+                       array( 'changeField', 'image', 'img_width', 'integer', '' ),
+                       array( 'changeField', 'image', 'img_height', 'integer', '' ),
+                       array( 'changeField', 'interwiki', 'iw_local', 'smallint', 'iw_local::smallint' ),
+                       array( 'changeField', 'interwiki', 'iw_trans', 'smallint', 'iw_trans::smallint DEFAULT 0' ),
+                       array( 'changeField', 'ipblocks', 'ipb_auto', 'smallint', 'ipb_auto::smallint DEFAULT 0' ),
+                       array( 'changeField', 'ipblocks', 'ipb_anon_only', 'smallint',
+                               "CASE WHEN ipb_anon_only=' ' THEN 0 ELSE ipb_anon_only::smallint END DEFAULT 0" ),
+                       array( 'changeField', 'ipblocks', 'ipb_create_account', 'smallint',
+                               "CASE WHEN ipb_create_account=' ' THEN 0 ELSE ipb_create_account::smallint END DEFAULT 1" ),
+                       array( 'changeField', 'ipblocks', 'ipb_enable_autoblock', 'smallint',
+                               "CASE WHEN ipb_enable_autoblock=' ' THEN 0 ELSE ipb_enable_autoblock::smallint END DEFAULT 1" ),
+                       array( 'changeField', 'ipblocks', 'ipb_block_email', 'smallint',
+                               "CASE WHEN ipb_block_email=' ' THEN 0 ELSE ipb_block_email::smallint END DEFAULT 0" ),
+                       array( 'changeField', 'ipblocks', 'ipb_address', 'text', 'ipb_address::text' ),
+                       array( 'changeField', 'ipblocks', 'ipb_deleted', 'smallint', 'ipb_deleted::smallint DEFAULT 0' ),
+                       array( 'changeField', 'mwuser', 'user_token', 'text', '' ),
+                       array( 'changeField', 'mwuser', 'user_email_token', 'text', '' ),
+                       array( 'changeField', 'objectcache', 'keyname', 'text', '' ),
+                       array( 'changeField', 'oldimage', 'oi_height', 'integer', '' ),
+                       array( 'changeField', 'oldimage', 'oi_metadata', 'bytea', "decode(img_metadata,'escape')" ),
+                       array( 'changeField', 'oldimage', 'oi_size', 'integer', '' ),
+                       array( 'changeField', 'oldimage', 'oi_width', 'integer', '' ),
+                       array( 'changeField', 'page', 'page_is_redirect', 'smallint',
+                               'page_is_redirect::smallint DEFAULT 0' ),
+                       array( 'changeField', 'page', 'page_is_new', 'smallint', 'page_is_new::smallint DEFAULT 0' ),
+                       array( 'changeField', 'querycache', 'qc_value', 'integer', '' ),
+                       array( 'changeField', 'querycachetwo', 'qcc_value', 'integer', '' ),
+                       array( 'changeField', 'recentchanges', 'rc_bot', 'smallint', 'rc_bot::smallint DEFAULT 0' ),
+                       array( 'changeField', 'recentchanges', 'rc_deleted', 'smallint', '' ),
+                       array( 'changeField', 'recentchanges', 'rc_minor', 'smallint', 'rc_minor::smallint DEFAULT 0' ),
+                       array( 'changeField', 'recentchanges', 'rc_new', 'smallint', 'rc_new::smallint DEFAULT 0' ),
+                       array( 'changeField', 'recentchanges', 'rc_type', 'smallint', 'rc_type::smallint DEFAULT 0' ),
+                       array( 'changeField', 'recentchanges', 'rc_patrolled', 'smallint',
+                               'rc_patrolled::smallint DEFAULT 0' ),
+                       array( 'changeField', 'revision', 'rev_deleted', 'smallint', 'rev_deleted::smallint DEFAULT 0' ),
+                       array( 'changeField', 'revision', 'rev_minor_edit', 'smallint',
+                               'rev_minor_edit::smallint DEFAULT 0' ),
+                       array( 'changeField', 'templatelinks', 'tl_namespace', 'smallint', 'tl_namespace::smallint' ),
+                       array( 'changeField', 'user_newtalk', 'user_ip', 'text', 'host(user_ip)' ),
+                       array( 'changeField', 'uploadstash', 'us_image_bits', 'smallint', '' ),
+                       array( 'changeField', 'profiling', 'pf_time', 'float', '' ),
+                       array( 'changeField', 'profiling', 'pf_memory', 'float', '' ),
 
                        # null changes
-                       array( 'changeNullableField', 'oldimage', 'oi_bits',       'NULL' ),
-                       array( 'changeNullableField', 'oldimage', 'oi_timestamp',  'NULL' ),
+                       array( 'changeNullableField', 'oldimage', 'oi_bits', 'NULL' ),
+                       array( 'changeNullableField', 'oldimage', 'oi_timestamp', 'NULL' ),
                        array( 'changeNullableField', 'oldimage', 'oi_major_mime', 'NULL' ),
                        array( 'changeNullableField', 'oldimage', 'oi_minor_mime', 'NULL' ),
-                       array( 'changeNullableField', 'image', 'img_metadata', 'NOT NULL'),
-                       array( 'changeNullableField', 'filearchive', 'fa_metadata', 'NOT NULL'),
+                       array( 'changeNullableField', 'image', 'img_metadata', 'NOT NULL' ),
+                       array( 'changeNullableField', 'filearchive', 'fa_metadata', 'NOT NULL' ),
                        array( 'changeNullableField', 'recentchanges', 'rc_cur_id', 'NULL' ),
 
                        array( 'checkOiDeleted' ),
 
                        # New indexes
-                       array( 'addPgIndex', 'archive',       'archive_user_text',      '(ar_user_text)' ),
-                       array( 'addPgIndex', 'image',         'img_sha1',               '(img_sha1)' ),
-                       array( 'addPgIndex', 'ipblocks',      'ipb_parent_block_id',              '(ipb_parent_block_id)' ),
-                       array( 'addPgIndex', 'oldimage',      'oi_sha1',                '(oi_sha1)' ),
-                       array( 'addPgIndex', 'page',          'page_mediawiki_title',   '(page_title) WHERE page_namespace = 8' ),
-                       array( 'addPgIndex', 'pagelinks',     'pagelinks_title',        '(pl_title)' ),
-                       array( 'addPgIndex', 'page_props',    'pp_propname_page',       '(pp_propname, pp_page)' ),
-                       array( 'addPgIndex', 'revision',      'rev_text_id_idx',        '(rev_text_id)' ),
-                       array( 'addPgIndex', 'recentchanges', 'rc_timestamp_bot',       '(rc_timestamp) WHERE rc_bot = 0' ),
-                       array( 'addPgIndex', 'templatelinks', 'templatelinks_from',     '(tl_from)' ),
-                       array( 'addPgIndex', 'watchlist',     'wl_user',                '(wl_user)' ),
-                       array( 'addPgIndex', 'logging',       'logging_user_type_time', '(log_user, log_type, log_timestamp)' ),
-                       array( 'addPgIndex', 'logging',       'logging_page_id_time',   '(log_page,log_timestamp)' ),
-                       array( 'addPgIndex', 'iwlinks',       'iwl_prefix_from_title',  '(iwl_prefix, iwl_from, iwl_title)' ),
-                       array( 'addPgIndex', 'iwlinks',       'iwl_prefix_title_from',  '(iwl_prefix, iwl_title, iwl_from)' ),
-                       array( 'addPgIndex', 'job',           'job_timestamp_idx',      '(job_timestamp)' ),
-                       array( 'addPgIndex', 'job',           'job_sha1',               '(job_sha1)' ),
-                       array( 'addPgIndex', 'job',           'job_cmd_token',          '(job_cmd, job_token, job_random)' ),
-                       array( 'addPgIndex', 'job',           'job_cmd_token_id',       '(job_cmd, job_token, job_id)' ),
-                       array( 'addPgIndex', 'filearchive',   'fa_sha1',                '(fa_sha1)' ),
+                       array( 'addPgIndex', 'archive', 'archive_user_text', '(ar_user_text)' ),
+                       array( 'addPgIndex', 'image', 'img_sha1', '(img_sha1)' ),
+                       array( 'addPgIndex', 'ipblocks', 'ipb_parent_block_id', '(ipb_parent_block_id)' ),
+                       array( 'addPgIndex', 'oldimage', 'oi_sha1', '(oi_sha1)' ),
+                       array( 'addPgIndex', 'page', 'page_mediawiki_title', '(page_title) WHERE page_namespace = 8' ),
+                       array( 'addPgIndex', 'pagelinks', 'pagelinks_title', '(pl_title)' ),
+                       array( 'addPgIndex', 'page_props', 'pp_propname_page', '(pp_propname, pp_page)' ),
+                       array( 'addPgIndex', 'revision', 'rev_text_id_idx', '(rev_text_id)' ),
+                       array( 'addPgIndex', 'recentchanges', 'rc_timestamp_bot', '(rc_timestamp) WHERE rc_bot = 0' ),
+                       array( 'addPgIndex', 'templatelinks', 'templatelinks_from', '(tl_from)' ),
+                       array( 'addPgIndex', 'watchlist', 'wl_user', '(wl_user)' ),
+                       array( 'addPgIndex', 'logging', 'logging_user_type_time',
+                               '(log_user, log_type, log_timestamp)' ),
+                       array( 'addPgIndex', 'logging', 'logging_page_id_time', '(log_page,log_timestamp)' ),
+                       array( 'addPgIndex', 'iwlinks', 'iwl_prefix_from_title', '(iwl_prefix, iwl_from, iwl_title)' ),
+                       array( 'addPgIndex', 'iwlinks', 'iwl_prefix_title_from', '(iwl_prefix, iwl_title, iwl_from)' ),
+                       array( 'addPgIndex', 'job', 'job_timestamp_idx', '(job_timestamp)' ),
+                       array( 'addPgIndex', 'job', 'job_sha1', '(job_sha1)' ),
+                       array( 'addPgIndex', 'job', 'job_cmd_token', '(job_cmd, job_token, job_random)' ),
+                       array( 'addPgIndex', 'job', 'job_cmd_token_id', '(job_cmd, job_token, job_id)' ),
+                       array( 'addPgIndex', 'filearchive', 'fa_sha1', '(fa_sha1)' ),
 
                        array( 'checkIndex', 'pagelink_unique', array(
                                array( 'pl_from', 'int4_ops', 'btree', 0 ),
                                array( 'pl_namespace', 'int2_ops', 'btree', 0 ),
                                array( 'pl_title', 'text_ops', 'btree', 0 ),
                        ),
-                       'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' ),
+                               'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' ),
                        array( 'checkIndex', 'cl_sortkey', array(
                                array( 'cl_to', 'text_ops', 'btree', 0 ),
                                array( 'cl_sortkey', 'text_ops', 'btree', 0 ),
                                array( 'cl_from', 'int4_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX cl_sortkey ON "categorylinks" USING "btree" ("cl_to", "cl_sortkey", "cl_from")' ),
+                               'CREATE INDEX cl_sortkey ON "categorylinks" ' .
+                                       'USING "btree" ("cl_to", "cl_sortkey", "cl_from")' ),
                        array( 'checkIndex', 'iwl_prefix_title_from', array(
                                array( 'iwl_prefix', 'text_ops', 'btree', 0 ),
                                array( 'iwl_title', 'text_ops', 'btree', 0 ),
                                array( 'iwl_from', 'int4_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX iwl_prefix_title_from ON "iwlinks" USING "btree" ("iwl_prefix", "iwl_title", "iwl_from")' ),
+                       'CREATE INDEX iwl_prefix_title_from ON "iwlinks" ' .
+                               'USING "btree" ("iwl_prefix", "iwl_title", "iwl_from")' ),
                        array( 'checkIndex', 'logging_times', array(
                                array( 'log_timestamp', 'timestamptz_ops', 'btree', 0 ),
                        ),
@@ -271,36 +287,48 @@ class PostgresUpdater extends DatabaseUpdater {
                                array( 'oi_name', 'text_ops', 'btree', 0 ),
                                array( 'oi_archive_name', 'text_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "oi_name_archive_name" ON "oldimage" USING "btree" ("oi_name", "oi_archive_name")' ),
+                       'CREATE INDEX "oi_name_archive_name" ON "oldimage" ' .
+                               'USING "btree" ("oi_name", "oi_archive_name")' ),
                        array( 'checkIndex', 'oi_name_timestamp', array(
                                array( 'oi_name', 'text_ops', 'btree', 0 ),
                                array( 'oi_timestamp', 'timestamptz_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "oi_name_timestamp" ON "oldimage" USING "btree" ("oi_name", "oi_timestamp")' ),
+                       'CREATE INDEX "oi_name_timestamp" ON "oldimage" ' .
+                               'USING "btree" ("oi_name", "oi_timestamp")' ),
                        array( 'checkIndex', 'page_main_title', array(
                                array( 'page_title', 'text_pattern_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "page_main_title" ON "page" USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 0)' ),
+                       'CREATE INDEX "page_main_title" ON "page" ' .
+                               'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 0)' ),
                        array( 'checkIndex', 'page_mediawiki_title', array(
                                array( 'page_title', 'text_pattern_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "page_mediawiki_title" ON "page" USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 8)' ),
+                       'CREATE INDEX "page_mediawiki_title" ON "page" ' .
+                               'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 8)' ),
                        array( 'checkIndex', 'page_project_title', array(
                                array( 'page_title', 'text_pattern_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "page_project_title" ON "page" USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 4)' ),
+                       'CREATE INDEX "page_project_title" ON "page" ' .
+                               'USING "btree" ("page_title" "text_pattern_ops") ' .
+                               'WHERE ("page_namespace" = 4)' ),
                        array( 'checkIndex', 'page_talk_title', array(
                                array( 'page_title', 'text_pattern_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "page_talk_title" ON "page" USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 1)' ),
+                       'CREATE INDEX "page_talk_title" ON "page" ' .
+                               'USING "btree" ("page_title" "text_pattern_ops") ' .
+                               'WHERE ("page_namespace" = 1)' ),
                        array( 'checkIndex', 'page_user_title', array(
                                array( 'page_title', 'text_pattern_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "page_user_title" ON "page" USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 2)' ),
+                       'CREATE INDEX "page_user_title" ON "page" ' .
+                               'USING "btree" ("page_title" "text_pattern_ops") WHERE ' .
+                               '("page_namespace" = 2)' ),
                        array( 'checkIndex', 'page_utalk_title', array(
                                array( 'page_title', 'text_pattern_ops', 'btree', 0 ),
                        ),
-                       'CREATE INDEX "page_utalk_title" ON "page" USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 3)' ),
+                       'CREATE INDEX "page_utalk_title" ON "page" ' .
+                               'USING "btree" ("page_title" "text_pattern_ops") ' .
+                               'WHERE ("page_namespace" = 3)' ),
                        array( 'checkIndex', 'ts2_page_text', array(
                                array( 'textvector', 'tsvector_ops', 'gist', 0 ),
                        ),
@@ -320,39 +348,48 @@ class PostgresUpdater extends DatabaseUpdater {
                                array( 'ipb_auto', 'int2_ops', 'btree', 0 ),
                                array( 'ipb_anon_only', 'int2_ops', 'btree', 0 ),
                        ),
-                       'CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only)' ),
+                       'CREATE UNIQUE INDEX ipb_address_unique ' .
+                               'ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only)' ),
 
                        array( 'checkIwlPrefix' ),
 
                        # All FK columns should be deferred
-                       array( 'changeFkeyDeferrable', 'archive',          'ar_user',         'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'categorylinks',    'cl_from',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'externallinks',    'el_from',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'filearchive',      'fa_deleted_user', 'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'filearchive',      'fa_user',         'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'image',            'img_user',        'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'imagelinks',       'il_from',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'ipblocks',         'ipb_by',          'mwuser(user_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'ipblocks',         'ipb_user',        'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'ipblocks',         'ipb_parent_block_id',       'ipblocks(ipb_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'langlinks',        'll_from',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'logging',          'log_user',        'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'oldimage',         'oi_name',         'image(img_name) ON DELETE CASCADE ON UPDATE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'oldimage',         'oi_user',         'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'pagelinks',        'pl_from',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'page_props',       'pp_page',         'page (page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'page_restrictions', 'pr_page',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'protected_titles', 'pt_user',         'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'recentchanges',    'rc_cur_id',       'page(page_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'recentchanges',    'rc_user',         'mwuser(user_id) ON DELETE SET NULL' ),
-                       array( 'changeFkeyDeferrable', 'redirect',         'rd_from',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'revision',         'rev_page',        'page (page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'revision',         'rev_user',        'mwuser(user_id) ON DELETE RESTRICT' ),
-                       array( 'changeFkeyDeferrable', 'templatelinks',    'tl_from',         'page(page_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'user_groups',      'ug_user',         'mwuser(user_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'user_newtalk',     'user_id',         'mwuser(user_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'user_properties',  'up_user',         'mwuser(user_id) ON DELETE CASCADE' ),
-                       array( 'changeFkeyDeferrable', 'watchlist',        'wl_user',         'mwuser(user_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'archive', 'ar_user', 'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'categorylinks', 'cl_from', 'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'externallinks', 'el_from', 'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'filearchive', 'fa_deleted_user',
+                               'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'filearchive', 'fa_user', 'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'image', 'img_user', 'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'imagelinks', 'il_from', 'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_by', 'mwuser(user_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_user', 'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_parent_block_id',
+                               'ipblocks(ipb_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'langlinks', 'll_from', 'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'logging', 'log_user', 'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'oldimage', 'oi_name',
+                               'image(img_name) ON DELETE CASCADE ON UPDATE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'oldimage', 'oi_user', 'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'pagelinks', 'pl_from', 'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'page_props', 'pp_page', 'page (page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'page_restrictions', 'pr_page',
+                               'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'protected_titles', 'pt_user',
+                               'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'recentchanges', 'rc_cur_id',
+                               'page(page_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'recentchanges', 'rc_user',
+                               'mwuser(user_id) ON DELETE SET NULL' ),
+                       array( 'changeFkeyDeferrable', 'redirect', 'rd_from', 'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'revision', 'rev_page', 'page (page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'revision', 'rev_user', 'mwuser(user_id) ON DELETE RESTRICT' ),
+                       array( 'changeFkeyDeferrable', 'templatelinks', 'tl_from', 'page(page_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'user_groups', 'ug_user', 'mwuser(user_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'user_newtalk', 'user_id', 'mwuser(user_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'user_properties', 'up_user',
+                               'mwuser(user_id) ON DELETE CASCADE' ),
+                       array( 'changeFkeyDeferrable', 'watchlist', 'wl_user', 'mwuser(user_id) ON DELETE CASCADE' ),
 
                        # r81574
                        array( 'addInterwikiType' ),
@@ -569,7 +606,8 @@ END;
                        if ( !$skipBothIndexExistWarning
                                && $this->db->indexExists( $table, $old, __METHOD__ )
                        ) {
-                               $this->output( "...WARNING: $old still exists, despite it has been renamed into $new (which also exists).\n" .
+                               $this->output( "...WARNING: $old still exists, despite it has been " .
+                                       "renamed into $new (which also exists).\n" .
                                        "            $old should be manually removed if not needed anymore.\n" );
                        }
 
@@ -682,7 +720,8 @@ END;
        protected function changeFkeyDeferrable( $table, $field, $clause ) {
                $fi = $this->db->fieldInfo( $table, $field );
                if ( is_null( $fi ) ) {
-                       $this->output( "WARNING! Column '$table.$field' does not exist but it should! Please report this.\n" );
+                       $this->output( "WARNING! Column '$table.$field' does not exist but it should! " .
+                               "Please report this.\n" );
 
                        return;
                }
@@ -696,10 +735,13 @@ END;
                        $command = "ALTER TABLE $table DROP CONSTRAINT $conname";
                        $this->db->query( $command );
                } else {
-                       $this->output( "Column '$table.$field' does not have a foreign key constraint, will be added\n" );
+                       $this->output( "Column '$table.$field' does not have a foreign key " .
+                               "constraint, will be added\n" );
                        $conclause = "";
                }
-               $command = "ALTER TABLE $table ADD $conclause FOREIGN KEY ($field) REFERENCES $clause DEFERRABLE INITIALLY DEFERRED";
+               $command =
+                       "ALTER TABLE $table ADD $conclause " .
+                       "FOREIGN KEY ($field) REFERENCES $clause DEFERRABLE INITIALLY DEFERRED";
                $this->db->query( $command );
        }
 
@@ -713,7 +755,11 @@ END;
                                $this->output( "Dropping rule 'archive_delete'\n" );
                                $this->db->query( 'DROP RULE archive_delete ON archive' );
                        }
-                       $this->applyPatch( 'patch-remove-archive2.sql', false, "Converting 'archive2' back to normal archive table" );
+                       $this->applyPatch(
+                               'patch-remove-archive2.sql',
+                               false,
+                               "Converting 'archive2' back to normal archive table"
+                       );
                } else {
                        $this->output( "...obsolete table 'archive2' does not exist\n" );
                }
@@ -723,7 +769,8 @@ END;
                if ( $this->db->fieldInfo( 'oldimage', 'oi_deleted' )->type() !== 'smallint' ) {
                        $this->output( "Changing 'oldimage.oi_deleted' to type 'smallint'\n" );
                        $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT" );
-                       $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" );
+                       $this->db->query(
+                               "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" );
                        $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted SET DEFAULT 0" );
                } else {
                        $this->output( "...column 'oldimage.oi_deleted' is already of type 'smallint'\n" );
@@ -732,23 +779,32 @@ END;
 
        protected function checkOiNameConstraint() {
                if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascaded" ) ) {
-                       $this->output( "...table 'oldimage' has correct cascading delete/update foreign key to image\n" );
+                       $this->output( "...table 'oldimage' has correct cascading delete/update " .
+                               "foreign key to image\n" );
                } else {
                        if ( $this->db->hasConstraint( "oldimage_oi_name_fkey" ) ) {
-                               $this->db->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" );
+                               $this->db->query(
+                                       "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" );
                        }
                        if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascade" ) ) {
-                               $this->db->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey_cascade" );
+                               $this->db->query(
+                                       "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey_cascade" );
                        }
                        $this->output( "Making foreign key on table 'oldimage' (to image) a cascade delete/update\n" );
-                       $this->db->query( "ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascaded " .
-                               "FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE ON UPDATE CASCADE" );
+                       $this->db->query(
+                               "ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascaded " .
+                               "FOREIGN KEY (oi_name) REFERENCES image(img_name) " .
+                               "ON DELETE CASCADE ON UPDATE CASCADE" );
                }
        }
 
        protected function checkPageDeletedTrigger() {
                if ( !$this->db->triggerExists( 'page', 'page_deleted' ) ) {
-                       $this->applyPatch( 'patch-page_deleted.sql', false, "Adding function and trigger 'page_deleted' to table 'page'" );
+                       $this->applyPatch(
+                               'patch-page_deleted.sql',
+                               false,
+                               "Adding function and trigger 'page_deleted' to table 'page'"
+                       );
                } else {
                        $this->output( "...table 'page' has 'page_deleted' trigger\n" );
                }
@@ -783,13 +839,21 @@ END;
                if ( $this->fkeyDeltype( 'revision_rev_user_fkey' ) == 'r' ) {
                        $this->output( "...constraint 'revision_rev_user_fkey' is ON DELETE RESTRICT\n" );
                } else {
-                       $this->applyPatch( 'patch-revision_rev_user_fkey.sql', false, "Changing constraint 'revision_rev_user_fkey' to ON DELETE RESTRICT" );
+                       $this->applyPatch(
+                               'patch-revision_rev_user_fkey.sql',
+                               false,
+                               "Changing constraint 'revision_rev_user_fkey' to ON DELETE RESTRICT"
+                       );
                }
        }
 
        protected function checkIwlPrefix() {
                if ( $this->db->indexExists( 'iwlinks', 'iwl_prefix' ) ) {
-                       $this->applyPatch( 'patch-rename-iwl_prefix.sql', false, "Replacing index 'iwl_prefix' with 'iwl_prefix_title_from'" );
+                       $this->applyPatch(
+                               'patch-rename-iwl_prefix.sql',
+                               false,
+                               "Replacing index 'iwl_prefix' with 'iwl_prefix_title_from'"
+                       );
                }
        }
 
index 136ca4b..19218c6 100644 (file)
@@ -82,8 +82,17 @@ class SqliteInstaller extends DatabaseInstaller {
        }
 
        public function getConnectForm() {
-               return $this->getTextBox( 'wgSQLiteDataDir', 'config-sqlite-dir', array(), $this->parent->getHelpBox( 'config-sqlite-dir-help' ) ) .
-                       $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-sqlite-name-help' ) );
+               return $this->getTextBox(
+                       'wgSQLiteDataDir',
+                       'config-sqlite-dir', array(),
+                       $this->parent->getHelpBox( 'config-sqlite-dir-help' )
+               ) .
+               $this->getTextBox(
+                       'wgDBname',
+                       'config-db-name',
+                       array(),
+                       $this->parent->getHelpBox( 'config-sqlite-name-help' )
+               );
        }
 
        /**
@@ -132,9 +141,16 @@ class SqliteInstaller extends DatabaseInstaller {
                        if ( !is_writable( dirname( $dir ) ) ) {
                                $webserverGroup = Installer::maybeGetWebserverPrimaryGroup();
                                if ( $webserverGroup !== null ) {
-                                       return Status::newFatal( 'config-sqlite-parent-unwritable-group', $dir, dirname( $dir ), basename( $dir ), $webserverGroup );
+                                       return Status::newFatal(
+                                               'config-sqlite-parent-unwritable-group',
+                                               $dir, dirname( $dir ), basename( $dir ),
+                                               $webserverGroup
+                                       );
                                } else {
-                                       return Status::newFatal( 'config-sqlite-parent-unwritable-nogroup', $dir, dirname( $dir ), basename( $dir ) );
+                                       return Status::newFatal(
+                                               'config-sqlite-parent-unwritable-nogroup',
+                                               $dir, dirname( $dir ), basename( $dir )
+                                       );
                                }
                        }
 
index 0b572f6..78ca511 100644 (file)
@@ -32,90 +32,97 @@ class SqliteUpdater extends DatabaseUpdater {
        protected function getCoreUpdateList() {
                return array(
                        // 1.14
-                       array( 'addField', 'site_stats',    'ss_active_users',  'patch-ss_active_users.sql' ),
+                       array( 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
                        array( 'doActiveUsersInit' ),
-                       array( 'addField', 'ipblocks',      'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
+                       array( 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
                        array( 'sqliteInitialIndexes' ),
 
                        // 1.15
-                       array( 'addTable', 'change_tag',                        'patch-change_tag.sql' ),
-                       array( 'addTable', 'tag_summary',                       'patch-tag_summary.sql' ),
-                       array( 'addTable', 'valid_tag',                         'patch-valid_tag.sql' ),
+                       array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),
+                       array( 'addTable', 'tag_summary', 'patch-tag_summary.sql' ),
+                       array( 'addTable', 'valid_tag', 'patch-valid_tag.sql' ),
 
                        // 1.16
-                       array( 'addTable', 'user_properties',                   'patch-user_properties.sql' ),
-                       array( 'addTable', 'log_search',                        'patch-log_search.sql' ),
-                       array( 'addField', 'logging',       'log_user_text',    'patch-log_user_text.sql' ),
-                       array( 'doLogUsertextPopulation' ), # listed separately from the previous update because 1.16 was released without this update
+                       array( 'addTable', 'user_properties', 'patch-user_properties.sql' ),
+                       array( 'addTable', 'log_search', 'patch-log_search.sql' ),
+                       array( 'addField', 'logging', 'log_user_text', 'patch-log_user_text.sql' ),
+                       # listed separately from the previous update because 1.16 was released without this update
+                       array( 'doLogUsertextPopulation' ),
                        array( 'doLogSearchPopulation' ),
-                       array( 'addTable', 'l10n_cache',                        'patch-l10n_cache.sql' ),
-                       array( 'addIndex', 'log_search',    'ls_field_val',     'patch-log_search-rename-index.sql' ),
-                       array( 'addIndex', 'change_tag',    'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
-                       array( 'addField', 'redirect',      'rd_interwiki',     'patch-rd_interwiki.sql' ),
+                       array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ),
+                       array( 'addIndex', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ),
+                       array( 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
+                       array( 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ),
                        array( 'doUpdateTranscacheField' ),
                        array( 'sqliteSetupSearchindex' ),
 
                        // 1.17
-                       array( 'addTable', 'iwlinks',                           'patch-iwlinks.sql' ),
-                       array( 'addIndex', 'iwlinks',   'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ),
-                       array( 'addField', 'updatelog', 'ul_value',             'patch-ul_value.sql' ),
-                       array( 'addField', 'interwiki',     'iw_api',           'patch-iw_api_and_wikiid.sql' ),
-                       array( 'dropIndex', 'iwlinks', 'iwl_prefix',            'patch-kill-iwl_prefix.sql' ),
-                       array( 'addField', 'categorylinks', 'cl_collation',     'patch-categorylinks-better-collation.sql' ),
+                       array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
+                       array( 'addIndex', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ),
+                       array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
+                       array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
+                       array( 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ),
+                       array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),
                        array( 'doCollationUpdate' ),
-                       array( 'addTable', 'msg_resource',                      'patch-msg_resource.sql' ),
-                       array( 'addTable', 'module_deps',                       'patch-module_deps.sql' ),
-                       array( 'dropIndex', 'archive', 'ar_page_revid',         'patch-archive_kill_ar_page_revid.sql' ),
-                       array( 'addIndex', 'archive', 'ar_revid',               'patch-archive_ar_revid.sql' ),
+                       array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
+                       array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
+                       array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
+                       array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
 
                        // 1.18
-                       array( 'addIndex', 'user',          'user_email',       'patch-user_email_index.sql' ),
-                       array( 'addTable', 'uploadstash',                       'patch-uploadstash.sql' ),
-                       array( 'addTable', 'user_former_groups',                'patch-user_former_groups.sql'),
+                       array( 'addIndex', 'user', 'user_email', 'patch-user_email_index.sql' ),
+                       array( 'addTable', 'uploadstash', 'patch-uploadstash.sql' ),
+                       array( 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ),
 
                        // 1.19
-                       array( 'addIndex', 'logging',       'type_action',      'patch-logging-type-action-index.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( 'addField',      'uploadstash',  'us_chunk_inx',         'patch-uploadstash_chunk.sql' ),
-                       array( 'addfield', 'job',           'job_timestamp',    'patch-jobs-add-timestamp.sql' ),
+                       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( 'addField', 'uploadstash', 'us_chunk_inx', 'patch-uploadstash_chunk.sql' ),
+                       array( 'addfield', 'job', 'job_timestamp', 'patch-jobs-add-timestamp.sql' ),
 
                        // 1.20
                        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' ),
-                       array( 'dropField', 'category',     'cat_hidden',       'patch-cat_hidden.sql' ),
+                       array( 'dropField', 'category', 'cat_hidden', 'patch-cat_hidden.sql' ),
 
                        // 1.21
                        array( 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ),
-                       array( 'addField', 'revision', 'rev_content_model',  'patch-revision-rev_content_model.sql' ),
-                       array( 'addField', 'archive',  'ar_content_format',  'patch-archive-ar_content_format.sql' ),
-                       array( 'addField', 'archive',  'ar_content_model',   'patch-archive-ar_content_model.sql' ),
-                       array( 'addField', 'page',     'page_content_model', 'patch-page-page_content_model.sql' ),
-                       array( 'dropField', 'site_stats',    'ss_admins',         'patch-drop-ss_admins.sql' ),
+                       array( 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ),
+                       array( 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ),
+                       array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ),
+                       array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ),
+                       array( 'dropField', 'site_stats', 'ss_admins', 'patch-drop-ss_admins.sql' ),
                        array( 'dropField', 'recentchanges', 'rc_moved_to_title', 'patch-rc_moved.sql' ),
-                       array( 'addTable', 'sites',                            'patch-sites.sql' ),
-                       array( 'addField', 'filearchive',   'fa_sha1',          'patch-fa_sha1.sql' ),
-                       array( 'addField', 'job',           'job_token',         'patch-job_token.sql' ),
-                       array( 'addField', 'job',           'job_attempts',      'patch-job_attempts.sql' ),
+                       array( 'addTable', 'sites', 'patch-sites.sql' ),
+                       array( 'addField', 'filearchive', 'fa_sha1', 'patch-fa_sha1.sql' ),
+                       array( 'addField', 'job', 'job_token', 'patch-job_token.sql' ),
+                       array( 'addField', 'job', 'job_attempts', 'patch-job_attempts.sql' ),
                        array( 'doEnableProfiling' ),
-                       array( 'addField', 'uploadstash',      'us_props',      'patch-uploadstash-us_props.sql' ),
+                       array( 'addField', 'uploadstash', 'us_props', 'patch-uploadstash-us_props.sql' ),
                        array( 'modifyField', 'user_groups', 'ug_group', 'patch-ug_group-length-increase-255.sql' ),
-                       array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ufg_group-length-increase-255.sql' ),
-                       array( 'addIndex', 'page_props', 'pp_propname_page',  'patch-page_props-propname-page-index.sql' ),
+                       array( 'modifyField', 'user_former_groups', 'ufg_group',
+                               'patch-ufg_group-length-increase-255.sql' ),
+                       array( 'addIndex', 'page_props', 'pp_propname_page',
+                               'patch-page_props-propname-page-index.sql' ),
                        array( 'addIndex', 'image', 'img_media_mime', 'patch-img_media_mime-index.sql' ),
-                       array( 'addIndex', 'iwlinks', 'iwl_prefix_from_title',  'patch-iwlinks-from-title-index.sql' ),
+                       array( 'addIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-iwlinks-from-title-index.sql' ),
                        array( 'addField', 'archive', 'ar_id', 'patch-archive-ar_id.sql' ),
                        array( 'addField', 'externallinks', 'el_id', 'patch-externallinks-el_id.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 ( $this->updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name', __METHOD__ ) ) {
+               // initial-indexes.sql fails if the indexes are already present,
+               // so we perform a quick check if our database is newer.
+               if ( $this->updateRowExists( 'initial_indexes' ) ||
+                       $this->db->indexExists( 'user', 'user_name', __METHOD__ )
+               ) {
                        $this->output( "...have initial indexes\n" );
 
                        return;
@@ -127,7 +134,11 @@ class SqliteUpdater extends DatabaseUpdater {
                $module = DatabaseSqlite::getFulltextSearchModule();
                $fts3tTable = $this->updateRowExists( 'fts3' );
                if ( $fts3tTable && !$module ) {
-                       $this->applyPatch( 'searchindex-no-fts.sql', false, 'PHP is missing FTS3 support, downgrading tables' );
+                       $this->applyPatch(
+                               'searchindex-no-fts.sql',
+                               false,
+                               'PHP is missing FTS3 support, downgrading tables'
+                       );
                } elseif ( !$fts3tTable && $module == 'FTS3' ) {
                        $this->applyPatch( 'searchindex-fts3.sql', false, "Adding FTS3 search capabilities" );
                } else {
index cbceed6..e23edf5 100644 (file)
@@ -660,7 +660,9 @@ class WebInstaller extends Installer {
         */
        public function getInfoBox( $text, $icon = false, $class = false ) {
                $text = $this->parse( $text, true );
-               $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/' . $icon;
+               $icon = ( $icon == false ) ?
+                       '../skins/common/images/info-32.png' :
+                       '../skins/common/images/' . $icon;
                $alt = wfMessage( 'config-information' )->text();
 
                return Html::infoBox( $text, $icon, $alt, $class, false );
index 11c0a8e..e30373e 100644 (file)
@@ -704,9 +704,8 @@ class WebInstaller_Name extends WebInstallerPage {
                        ) ) .
                        $this->parent->getTextBox( array(
                                'var' => 'wgMetaNamespace',
-                               'label' => '', //TODO: Needs a label?
-                               'attribs' => array( 'readonly' => 'readonly', 'class' => 'enabledByOther' ),
-
+                               'label' => '', // @todo Needs a label?
+                               'attribs' => array( 'readonly' => 'readonly', 'class' => 'enabledByOther' )
                        ) ) .
                        $this->getFieldSetStart( 'config-admin-box' ) .
                        $this->parent->getTextBox( array(
@@ -865,7 +864,6 @@ class WebInstaller_Name extends WebInstallerPage {
 }
 
 class WebInstaller_Options extends WebInstallerPage {
-
        public function execute() {
                if ( $this->getVar( '_SkipOptional' ) == 'skip' ) {
                        return 'skip';
@@ -1255,7 +1253,9 @@ class WebInstaller_Install extends WebInstallerPage {
        public function startStage( $step ) {
                // Messages: config-install-database, config-install-tables, config-install-interwiki,
                // config-install-stats, config-install-keys, config-install-sysop, config-install-mainpage
-               $this->addHTML( "<li>" . wfMessage( "config-install-$step" )->escaped() . wfMessage( 'ellipsis' )->escaped() );
+               $this->addHTML( "<li>" . wfMessage( "config-install-$step" )->escaped() .
+                       wfMessage( 'ellipsis' )->escaped() );
+
                if ( $step == 'extension-tables' ) {
                        $this->startLiveBox();
                }
@@ -1282,7 +1282,6 @@ class WebInstaller_Install extends WebInstallerPage {
 }
 
 class WebInstaller_Complete extends WebInstallerPage {
-
        public function execute() {
                // Pop up a dialog box, to make it difficult for the user to forget
                // to download the file
index 6fc457d..4600402 100644 (file)
@@ -377,6 +377,10 @@ class LinkHolderArray {
                                $key = "$ns:$index";
                                $searchkey = "<!--LINK $key-->";
                                $displayText = $entry['text'];
+                               if ( isset( $entry['selflink'] ) ) {
+                                       $replacePairs[$searchkey] = Linker::makeSelfLinkObj( $title, $displayText, $query );
+                                       continue;
+                               }
                                if ( $displayText === '' ) {
                                        $displayText = null;
                                }
@@ -455,20 +459,17 @@ class LinkHolderArray {
                // single string to all variants. This would improve parser's performance
                // significantly.
                foreach ( $this->internals as $ns => $entries ) {
+                       if ( $ns == NS_SPECIAL ) {
+                               continue;
+                       }
                        foreach ( $entries as $index => $entry ) {
                                $pdbk = $entry['pdbk'];
                                // we only deal with new links (in its first query)
                                if ( !isset( $colours[$pdbk] ) || $colours[$pdbk] === 'new' ) {
-                                       $title = $entry['title'];
-                                       $titleText = $title->getText();
-                                       $titlesAttrs[] = array(
-                                               'ns' => $ns,
-                                               'key' => "$ns:$index",
-                                               'titleText' => $titleText,
-                                       );
+                                       $titlesAttrs[] = array( $index, $entry['title'] );
                                        // separate titles with \0 because it would never appears
                                        // in a valid title
-                                       $titlesToBeConverted .= $titleText . "\0";
+                                       $titlesToBeConverted .= $entry['title']->getText() . "\0";
                                }
                        }
                }
@@ -479,19 +480,35 @@ class LinkHolderArray {
                foreach ( $titlesAllVariants as &$titlesVariant ) {
                        $titlesVariant = explode( "\0", $titlesVariant );
                }
-               $l = count( $titlesAttrs );
+
                // Then add variants of links to link batch
-               for ( $i = 0; $i < $l; $i ++ ) {
+               $parentTitle = $this->parent->getTitle();
+               foreach ( $titlesAttrs as $i => $attrs ) {
+                       list( $index, $title ) = $attrs;
+                       $ns = $title->getNamespace();
+                       $text = $title->getText();
+
                        foreach ( $allVariantsName as $variantName ) {
                                $textVariant = $titlesAllVariants[$variantName][$i];
-                               if ( $textVariant != $titlesAttrs[$i]['titleText'] ) {
-                                       $variantTitle = Title::makeTitle( $titlesAttrs[$i]['ns'], $textVariant );
-                                       if ( is_null( $variantTitle ) ) {
-                                               continue;
-                                       }
-                                       $linkBatch->addObj( $variantTitle );
-                                       $variantMap[$variantTitle->getPrefixedDBkey()][] = $titlesAttrs[$i]['key'];
+                               if ( $textVariant === $text ) {
+                                       continue;
+                               }
+
+                               $variantTitle = Title::makeTitle( $ns, $textVariant );
+                               if ( is_null( $variantTitle ) ) {
+                                       continue;
+                               }
+
+                               // Self-link checking for mixed/different variant titles. At this point, we
+                               // already know the exact title does not exist, so the link cannot be to a
+                               // variant of the current title that exists as a separate page.
+                               if ( $variantTitle->equals( $parentTitle ) && $title->getFragment() === '' ) {
+                                       $this->internals[$ns][$index]['selflink'] = true;
+                                       continue 2;
                                }
+
+                               $linkBatch->addObj( $variantTitle );
+                               $variantMap[$variantTitle->getPrefixedDBkey()][] = "$ns:$index";
                        }
                }
 
index 7e939ee..5e86209 100644 (file)
@@ -2113,16 +2113,12 @@ class Parser {
                                }
                        }
 
-                       # Self-link checking
-                       if ( $nt->getFragment() === '' && $ns != NS_SPECIAL ) {
-                               if ( $nt->equals( $this->mTitle ) || ( !$nt->isKnown() && in_array(
-                                       $this->mTitle->getPrefixedText(),
-                                       $this->getConverterLanguage()->autoConvertToAllVariants( $nt->getPrefixedText() ),
-                                       true
-                               ) ) ) {
-                                       $s .= $prefix . Linker::makeSelfLinkObj( $nt, $text, '', $trail );
-                                       continue;
-                               }
+                       # Self-link checking. For some languages, variants of the title are checked in
+                       # LinkHolderArray::doVariants() to allow batching the existence checks necessary
+                       # for linking to a different variant.
+                       if ( $ns != NS_SPECIAL && $nt->equals( $this->mTitle ) && $nt->getFragment() === '' ) {
+                               $s .= $prefix . Linker::makeSelfLinkObj( $nt, $text, '', $trail );
+                               continue;
                        }
 
                        # NS_MEDIA is a pseudo-namespace for linking directly to a file
index bdc6675..b3d7bb3 100644 (file)
                        var name = mw.language.months.names[i].toLowerCase();
                        ts.monthNames[name] = i + 1;
                        regex.push( $.escapeRE( name ) );
-                       name = mw.language.months.genitive[i].toLowerCase().replace( '.', '' );
+                       name = mw.language.months.genitive[i].toLowerCase();
                        ts.monthNames[name] = i + 1;
                        regex.push( $.escapeRE( name ) );
-                       name = mw.language.months.abbrev[i].toLowerCase();
+                       name = mw.language.months.abbrev[i].toLowerCase().replace( '.', '' );
                        ts.monthNames[name] = i + 1;
                        regex.push( $.escapeRE( name ) );
                }
index f9a14b0..cdc6767 100644 (file)
                                                        tokenCache[tokenType] = params.token = undefined;
                                                        return api.post( params );
                                                }
+                                               // Pass the promise forward, so the caller gets error codes
+                                               return this;
                                        }
                                );
                        } else {
index 0939ebe..cd9a93e 100644 (file)
@@ -40,7 +40,6 @@ $wgAutoloadClasses += array(
        'MediaWikiPHPUnitCommand' => "$testDir/phpunit/MediaWikiPHPUnitCommand.php",
        'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php",
        'MediaWikiLangTestCase' => "$testDir/phpunit/MediaWikiLangTestCase.php",
-       'MediaWikiProvide' => "$testDir/phpunit/includes/Providers.php",
        'TestUser' => "$testDir/phpunit/includes/TestUser.php",
 
        # tests/phpunit/includes
index 3f8d7f9..5036a51 100644 (file)
  */
 class ParserTest {
        /**
-        * boolean $color whereas output should be colorized
+        * @var bool $color whereas output should be colorized
         */
        private $color;
 
        /**
-        * boolean $showOutput Show test output
+        * @var bool $showOutput Show test output
         */
        private $showOutput;
 
        /**
-        * boolean $useTemporaryTables Use temporary tables for the temporary database
+        * @var bool $useTemporaryTables Use temporary tables for the temporary database
         */
        private $useTemporaryTables = true;
 
        /**
-        * boolean $databaseSetupDone True if the database has been set up
+        * @var bool $databaseSetupDone True if the database has been set up
         */
        private $databaseSetupDone = false;
 
@@ -65,7 +65,7 @@ class ParserTest {
        private $dbClone;
 
        /**
-        * string $oldTablePrefix Original table prefix
+        * @var string $oldTablePrefix Original table prefix
         */
        private $oldTablePrefix;
 
index 6ae5fb4..3882185 100644 (file)
@@ -14438,6 +14438,17 @@ title=[[Duna]] language=sr
 </p>
 !! end
 
+!! test
+Link to a section of a variant of this title shouldn't be parsed as self-link
+!! options
+title=[[Duna]] language=sr
+!! input
+[[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
+!! result
+<p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
+</p>
+!! end
+
 !! test
 Link to pages in language variants
 !! options
diff --git a/tests/phpunit/includes/Providers.php b/tests/phpunit/includes/Providers.php
deleted file mode 100644 (file)
index 4ddc0b0..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Generic providers for the MediaWiki PHPUnit test suite
- *
- * @author Antoine Musso
- * @copyright Copyright © 2011, Antoine Musso
- * @file
- */
-
-/** */
-class MediaWikiProvide {
-
-       /* provide an array of numbers from 1 up to @param $num */
-       private static function createProviderUpTo( $num ) {
-               $ret = array();
-               for ( $i = 1; $i <= $num; $i++ ) {
-                       $ret[] = array( $i );
-               }
-
-               return $ret;
-       }
-
-       /* array of months numbers (as an integer) */
-       public static function Months() {
-               return self::createProviderUpTo( 12 );
-       }
-
-       /* array of days numbers (as an integer) */
-       public static function Days() {
-               return self::createProviderUpTo( 31 );
-       }
-
-       public static function DaysMonths() {
-               $ret = array();
-
-               $months = self::Months();
-               $days = self::Days();
-               foreach ( $months as $month ) {
-                       foreach ( $days as $day ) {
-                               $ret[] = array( $day[0], $month[0] );
-                       }
-               }
-
-               return $ret;
-       }
-}
index 1c898f0..5a3c161 100644 (file)
@@ -4,12 +4,14 @@
  * CSSJanus libary:
  * http://code.google.com/p/cssjanus/source/browse/trunk/cssjanus_test.py
  * Ported to PHP for ResourceLoader and has been extended since.
+ *
+ * @covers CSSJanus
  */
 class CSSJanusTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideTransformCases
         */
-       function testTransform( $cssA, $cssB = null ) {
+       public function testTransform( $cssA, $cssB = null ) {
 
                if ( $cssB ) {
                        $transformedA = CSSJanus::transform( $cssA );
@@ -28,7 +30,7 @@ class CSSJanusTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideTransformAdvancedCases
         */
-       function testTransformAdvanced( $code, $expectedOutput, $options = array() ) {
+       public function testTransformAdvanced( $code, $expectedOutput, $options = array() ) {
                $swapLtrRtlInURL = isset( $options['swapLtrRtlInURL'] ) ? $options['swapLtrRtlInURL'] : false;
                $swapLeftRightInURL = isset( $options['swapLeftRightInURL'] ) ? $options['swapLeftRightInURL'] : false;
 
@@ -44,7 +46,7 @@ class CSSJanusTest extends MediaWikiTestCase {
         * @dataProvider provideTransformBrokenCases
         * @group Broken
         */
-       function testTransformBroken( $code, $expectedOutput ) {
+       public function testTransformBroken( $code, $expectedOutput ) {
                $flipped = CSSJanus::transform( $code );
 
                $this->assertEquals( $expectedOutput, $flipped, 'Test flipping' );
index 263df5f..c2c97c0 100644 (file)
@@ -9,11 +9,13 @@
  * @author Antoine Musso
  * @copyright Copyright © 2011, Antoine Musso
  * @file
+ * @todo covers tags
  */
 
-/** */
 class MagicVariableTest extends MediaWikiTestCase {
-       /** Will contains a parser object*/
+       /**
+        * @var Parser
+        */
        private $testParser = null;
 
        /**
@@ -51,11 +53,31 @@ class MagicVariableTest extends MediaWikiTestCase {
                $this->testParser->setTitle( $title );
        }
 
-       /** destroy parser (TODO: is it really neded?)*/
-       protected function tearDown() {
-               unset( $this->testParser );
+       /**
+        * @param int $num upper limit for numbers
+        * @return array of numbers from 1 up to $num
+        */
+       private static function createProviderUpTo( $num ) {
+               $ret = array();
+               for ( $i = 1; $i <= $num; $i++ ) {
+                       $ret[] = array( $i );
+               }
+
+               return $ret;
+       }
+
+       /**
+        * @return array of months numbers (as an integer)
+        */
+       public static function provideMonths() {
+               return self::createProviderUpTo( 12 );
+       }
 
-               parent::tearDown();
+       /**
+        * @return array of days numbers (as an integer)
+        */
+       public static function provideDays() {
+               return self::createProviderUpTo( 31 );
        }
 
        ############### TESTS #############################################
@@ -65,70 +87,69 @@ class MagicVariableTest extends MediaWikiTestCase {
 
        # day
 
-       /** @dataProvider MediaWikiProvide::Days */
-       function testCurrentdayIsUnPadded( $day ) {
+       /** @dataProvider provideDays */
+       public function testCurrentdayIsUnPadded( $day ) {
                $this->assertUnPadded( 'currentday', $day );
        }
 
-       /** @dataProvider MediaWikiProvide::Days */
-       function testCurrentdaytwoIsZeroPadded( $day ) {
+       /** @dataProvider provideDays */
+       public function testCurrentdaytwoIsZeroPadded( $day ) {
                $this->assertZeroPadded( 'currentday2', $day );
        }
 
-       /** @dataProvider MediaWikiProvide::Days */
-       function testLocaldayIsUnPadded( $day ) {
+       /** @dataProvider provideDays */
+       public function testLocaldayIsUnPadded( $day ) {
                $this->assertUnPadded( 'localday', $day );
        }
 
-       /** @dataProvider MediaWikiProvide::Days */
-       function testLocaldaytwoIsZeroPadded( $day ) {
+       /** @dataProvider provideDays */
+       public function testLocaldaytwoIsZeroPadded( $day ) {
                $this->assertZeroPadded( 'localday2', $day );
        }
 
        # month
 
-       /** @dataProvider MediaWikiProvide::Months */
-       function testCurrentmonthIsZeroPadded( $month ) {
+       /** @dataProvider provideMonths */
+       public function testCurrentmonthIsZeroPadded( $month ) {
                $this->assertZeroPadded( 'currentmonth', $month );
        }
 
-       /** @dataProvider MediaWikiProvide::Months */
-       function testCurrentmonthoneIsUnPadded( $month ) {
+       /** @dataProvider provideMonths */
+       public function testCurrentmonthoneIsUnPadded( $month ) {
                $this->assertUnPadded( 'currentmonth1', $month );
        }
 
-       /** @dataProvider MediaWikiProvide::Months */
-       function testLocalmonthIsZeroPadded( $month ) {
+       /** @dataProvider provideMonths */
+       public function testLocalmonthIsZeroPadded( $month ) {
                $this->assertZeroPadded( 'localmonth', $month );
        }
 
-       /** @dataProvider MediaWikiProvide::Months */
-       function testLocalmonthoneIsUnPadded( $month ) {
+       /** @dataProvider provideMonths */
+       public function testLocalmonthoneIsUnPadded( $month ) {
                $this->assertUnPadded( 'localmonth1', $month );
        }
 
-
        # revision day
 
-       /** @dataProvider MediaWikiProvide::Days */
-       function testRevisiondayIsUnPadded( $day ) {
+       /** @dataProvider provideDays */
+       public function testRevisiondayIsUnPadded( $day ) {
                $this->assertUnPadded( 'revisionday', $day );
        }
 
-       /** @dataProvider MediaWikiProvide::Days */
-       function testRevisiondaytwoIsZeroPadded( $day ) {
+       /** @dataProvider provideDays */
+       public function testRevisiondaytwoIsZeroPadded( $day ) {
                $this->assertZeroPadded( 'revisionday2', $day );
        }
 
        # revision month
 
-       /** @dataProvider MediaWikiProvide::Months */
-       function testRevisionmonthIsZeroPadded( $month ) {
+       /** @dataProvider provideMonths */
+       public function testRevisionmonthIsZeroPadded( $month ) {
                $this->assertZeroPadded( 'revisionmonth', $month );
        }
 
-       /** @dataProvider MediaWikiProvide::Months */
-       function testRevisionmonthoneIsUnPadded( $month ) {
+       /** @dataProvider provideMonths */
+       public function testRevisionmonthoneIsUnPadded( $month ) {
                $this->assertUnPadded( 'revisionmonth1', $month );
        }
 
@@ -136,15 +157,15 @@ class MagicVariableTest extends MediaWikiTestCase {
         * Rough tests for {{SERVERNAME}} magic word
         * Bug 31176
         * @group Database
-        * @dataProvider dataServernameFromDifferentProtocols
+        * @dataProvider provideDataServernameFromDifferentProtocols
         */
-       function testServernameFromDifferentProtocols( $server ) {
+       public function testServernameFromDifferentProtocols( $server ) {
                $this->setMwGlobals( 'wgServer', $server );
 
                $this->assertMagic( 'localhost', 'servername' );
        }
 
-       function dataServernameFromDifferentProtocols() {
+       public static function provideDataServernameFromDifferentProtocols() {
                return array(
                        array( 'http://localhost/' ),
                        array( 'https://localhost/' ),
@@ -155,12 +176,12 @@ class MagicVariableTest extends MediaWikiTestCase {
        ############### HELPERS ############################################
 
        /** assertion helper expecting a magic output which is zero padded */
-       PUBLIC function assertZeroPadded( $magic, $value ) {
+       public function assertZeroPadded( $magic, $value ) {
                $this->assertMagicPadding( $magic, $value, '%02d' );
        }
 
        /** assertion helper expecting a magic output which is unpadded */
-       PUBLIC function assertUnPadded( $magic, $value ) {
+       public function assertUnPadded( $magic, $value ) {
                $this->assertMagicPadding( $magic, $value, '%d' );
        }
 
index ab8e77b..e90c630 100644 (file)
@@ -6,6 +6,8 @@
  * @group Database
  * @group Parser
  * @group Stub
+ *
+ * @todo covers tags
  */
 class NewParserTest extends MediaWikiTestCase {
        static protected $articles = array(); // Array of test articles defined by the tests
index 3cdbf15..e5c5cb2 100644 (file)
@@ -15,6 +15,7 @@ class ParserMethodsTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider providePreSaveTransform
+        * @covers Parser::preSaveTransform
         */
        public function testPreSaveTransform( $text, $expected ) {
                global $wgParser;
@@ -28,6 +29,9 @@ class ParserMethodsTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $text );
        }
 
+       /**
+        * @covers Parser::callParserFunction
+        */
        public function testCallParserFunction() {
                global $wgParser;
 
@@ -45,6 +49,10 @@ class ParserMethodsTest extends MediaWikiLangTestCase {
                ), $ret, 'callParserFunction works for {{#tag:pre|foo|style=margin-left: 1.6em}}' );
        }
 
+       /**
+        * @covers Parser::parse
+        * @covers ParserOutput::getSections
+        */
        public function testGetSections() {
                global $wgParser;
 
@@ -83,5 +91,5 @@ class ParserMethodsTest extends MediaWikiLangTestCase {
                        ),
                ), $out->getSections(), 'getSections() with proper value when <h2> is used' );
        }
-       // TODO: Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
+       //@Todo Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
 }
index 68f77ab..c73666d 100644 (file)
@@ -2,7 +2,7 @@
 
 class ParserOutputTest extends MediaWikiTestCase {
 
-       function dataIsLinkInternal() {
+       public static function provideIsLinkInternal() {
                return array(
                        // Different domains
                        array( false, 'http://example.org', 'http://mediawiki.org' ),
@@ -29,13 +29,17 @@ class ParserOutputTest extends MediaWikiTestCase {
 
        /**
         * Test to make sure ParserOutput::isLinkInternal behaves properly
-        * @dataProvider dataIsLinkInternal
+        * @dataProvider provideIsLinkInternal
+        * @covers ParserOutput::isLinkInternal
         */
-       function testIsLinkInternal( $shouldMatch, $server, $url ) {
-
+       public function testIsLinkInternal( $shouldMatch, $server, $url ) {
                $this->assertEquals( $shouldMatch, ParserOutput::isLinkInternal( $server, $url ) );
        }
 
+       /**
+        * @covers ParserOutput::setExtensionData
+        * @covers ParserOutput::getExtensionData
+        */
        public function testExtensionData() {
                $po = new ParserOutput();
 
index c609164..d12fee3 100644 (file)
@@ -4,8 +4,17 @@
  * @author Antoine Musso
  */
 class ParserPreloadTest extends MediaWikiTestCase {
+       /**
+        * @var Parser
+        */
        private $testParser;
+       /**
+        * @var ParserOptions
+        */
        private $testParserOptions;
+       /**
+        * @var Title
+        */
        private $title;
 
        protected function setUp() {
@@ -31,14 +40,14 @@ class ParserPreloadTest extends MediaWikiTestCase {
        /**
         * @covers Parser::getPreloadText
         */
-       function testPreloadSimpleText() {
+       public function testPreloadSimpleText() {
                $this->assertPreloaded( 'simple', 'simple' );
        }
 
        /**
         * @covers Parser::getPreloadText
         */
-       function testPreloadedPreIsUnstripped() {
+       public function testPreloadedPreIsUnstripped() {
                $this->assertPreloaded(
                        '<pre>monospaced</pre>',
                        '<pre>monospaced</pre>',
@@ -49,7 +58,7 @@ class ParserPreloadTest extends MediaWikiTestCase {
        /**
         * @covers Parser::getPreloadText
         */
-       function testPreloadedNowikiIsUnstripped() {
+       public function testPreloadedNowikiIsUnstripped() {
                $this->assertPreloaded(
                        '<nowiki>[[Dummy title]]</nowiki>',
                        '<nowiki>[[Dummy title]]</nowiki>',
@@ -57,7 +66,7 @@ class ParserPreloadTest extends MediaWikiTestCase {
                );
        }
 
-       function assertPreloaded( $expected, $text, $msg = '' ) {
+       protected function assertPreloaded( $expected, $text, $msg = '' ) {
                $this->assertEquals(
                        $expected,
                        $this->testParser->getPreloadText(
index 7e9c9d4..0d2e07e 100644 (file)
@@ -1,9 +1,16 @@
 <?php
 
 class PreprocessorTest extends MediaWikiTestCase {
-       var $mTitle = 'Page title';
-       var $mPPNodeCount = 0;
-       var $mOptions;
+       protected $mTitle = 'Page title';
+       protected $mPPNodeCount = 0;
+       /**
+        * @var ParserOptions
+        */
+       protected $mOptions;
+       /**
+        * @var Preprocessor
+        */
+       protected $mPreprocessor;
 
        protected function setUp() {
                global $wgParserConf, $wgContLang;
@@ -115,7 +122,7 @@ class PreprocessorTest extends MediaWikiTestCase {
         * @param string $wikiText
         * @return string
         */
-       function preprocessToXml( $wikiText ) {
+       protected function preprocessToXml( $wikiText ) {
                if ( method_exists( $this->mPreprocessor, 'preprocessToXml' ) ) {
                        return $this->normalizeXml( $this->mPreprocessor->preprocessToXml( $wikiText ) );
                }
@@ -134,14 +141,15 @@ class PreprocessorTest extends MediaWikiTestCase {
         * @param string $xml
         * @return string
         */
-       function normalizeXml( $xml ) {
+       protected function normalizeXml( $xml ) {
                return preg_replace( '!<([a-z]+)/>!', '<$1></$1>', str_replace( ' />', '/>', $xml ) );
        }
 
        /**
         * @dataProvider provideCases
+        * @covers Preprocessor_DOM::preprocessToXml
         */
-       function testPreprocessorOutput( $wikiText, $expectedXml ) {
+       public function testPreprocessorOutput( $wikiText, $expectedXml ) {
                $this->assertEquals( $this->normalizeXml( $expectedXml ), $this->preprocessToXml( $wikiText ) );
        }
 
@@ -160,8 +168,9 @@ class PreprocessorTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideFiles
+        * @covers Preprocessor_DOM::preprocessToXml
         */
-       function testPreprocessorOutputFiles( $filename ) {
+       public function testPreprocessorOutputFiles( $filename ) {
                $folder = __DIR__ . "/../../../parser/preprocess";
                $wikiText = file_get_contents( "$folder/$filename.txt" );
                $output = $this->preprocessToXml( $wikiText );
@@ -222,6 +231,7 @@ class PreprocessorTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideHeadings
+        * @covers Preprocessor_DOM::preprocessToXml
         */
        function testHeadings( $wikiText, $expectedXml ) {
                $this->assertEquals( $this->normalizeXml( $expectedXml ), $this->preprocessToXml( $wikiText ) );