Merge "Deglobalization in EditPage.php"
authorReedy <reedy@wikimedia.org>
Mon, 29 Oct 2012 15:43:21 +0000 (15:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 29 Oct 2012 15:43:21 +0000 (15:43 +0000)
25 files changed:
README.mediawiki [new symlink]
includes/AutoLoader.php
includes/User.php
includes/actions/InfoAction.php
includes/conf/Conf.php [deleted file]
includes/conf/DatabaseConf.php [deleted file]
includes/conf/DefaultSettings.php [deleted file]
includes/content/TextContent.php
includes/installer/Ibm_db2Updater.php
includes/installer/MysqlUpdater.php
includes/installer/OracleUpdater.php
includes/installer/PostgresUpdater.php
includes/installer/SqliteUpdater.php
includes/specials/SpecialEmailuser.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/archives/patch-config.sql [deleted file]
maintenance/ibm_db2/tables.sql
maintenance/language/messages.inc
maintenance/oracle/archives/patch-config.sql [deleted file]
maintenance/oracle/tables.sql
maintenance/postgres/archives/patch-config.sql [deleted file]
maintenance/postgres/tables.sql
maintenance/tables.sql
tests/phpunit/MediaWikiTestCase.php

diff --git a/README.mediawiki b/README.mediawiki
new file mode 120000 (symlink)
index 0000000..100b938
--- /dev/null
@@ -0,0 +1 @@
+README
\ No newline at end of file
index c97c95a..0cd81c3 100644 (file)
@@ -446,11 +446,6 @@ $wgAutoloadLocalClasses = array(
        'TitleDependency' => 'includes/cache/CacheDependency.php',
        'TitleListDependency' => 'includes/cache/CacheDependency.php',
 
-       # includes/conf
-       'Conf' => 'includes/conf/Conf.php',
-       'DatabaseConf' => 'includes/conf/DatabaseConf.php',
-       'DefaultSettings' => 'includes/conf/DefaultSettings.php',
-
        # includes/context
        'ContextSource' => 'includes/context/ContextSource.php',
        'DerivativeContext' => 'includes/context/DerivativeContext.php',
index e210eba..770b28e 100644 (file)
@@ -1216,6 +1216,14 @@ class User {
        public static function getDefaultOptions() {
                global $wgNamespacesToBeSearchedDefault, $wgDefaultUserOptions, $wgContLang, $wgDefaultSkin;
 
+               static $defOpt = null;
+               if ( !defined( 'MW_PHPUNIT_TEST' ) && $defOpt !== null ) {
+                       // Disabling this for the unit tests, as they rely on being able to change $wgContLang
+                       // mid-request and see that change reflected in the return value of this function.
+                       // Which is insane and would never happen during normal MW operation
+                       return $defOpt;
+               }
+
                $defOpt = $wgDefaultUserOptions;
                # default language setting
                $defOpt['variant'] = $wgContLang->getCode();
@@ -1225,12 +1233,6 @@ class User {
                }
                $defOpt['skin'] = $wgDefaultSkin;
 
-               // FIXME: Ideally we'd cache the results of this function so the hook is only run once,
-               // but that breaks the parser tests because they rely on being able to change $wgContLang
-               // mid-request and see that change reflected in the return value of this function.
-               // Which is insane and would never happen during normal MW operation, but is also not
-               // likely to get fixed unless and until we context-ify everything.
-               // See also https://www.mediawiki.org/wiki/Special:Code/MediaWiki/101488#c25275
                wfRunHooks( 'UserGetDefaultOptions', array( &$defOpt ) );
 
                return $defOpt;
index e986323..29c3d7e 100644 (file)
@@ -234,6 +234,12 @@ class InfoAction extends FormlessAction {
                // Page ID (number not localised, as it's a database ID)
                $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-article-id' ), $id );
 
+               // Language in which the page content is (supposed to be) written
+               $pageLang = $title->getPageLanguage()->getCode();
+               $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-language' ),
+                       Language::fetchLanguageName( $pageLang, $lang->getCode() )
+                       . ' ' . $this->msg( 'parentheses', $pageLang ) );
+
                // Search engine status
                $pOutput = new ParserOutput();
                if ( isset( $pageProperties['noindex'] ) ) {
diff --git a/includes/conf/Conf.php b/includes/conf/Conf.php
deleted file mode 100644 (file)
index 22c621f..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-/**
- * Base configuration class.
- *
- * Get some configuration variable:
- *   $mySetting = Conf::get( 'mySetting' );
- *
- * Copyright © 2011 Chad Horohoe <chadh@wikimedia.org>
- * http://www.mediawiki.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @defgroup Config Config
- */
-abstract class Conf {
-       /**
-        * A special value to return when default config items do not exist. Use
-        * this to differentiate from 'null' which may be a valid config value.
-        *
-        * Please don't ever make this a default (or accepted) value for your
-        * configuration. It's liable to Break Something.
-        */
-       const NO_SUCH_DEFAULT_CONFIG = 'mw-no-such-default-config';
-
-       /**
-        * The Wiki ID (usually $wgDBname)
-        * @var String
-        */
-       private $wikiId;
-
-       /**
-        * Singleton
-        * @var Conf
-        */
-       private static $__instance;
-
-       /**
-        * Stores of the core defaults, extension defaults and wiki overrides
-        *
-        * @var array
-        */
-       protected $defaults, $extensionDefaults, $values = array();
-
-       /**
-        * Constructor. Children should call this if implementing.
-        * @param $confConfig Array of config vars
-        */
-       protected function __construct( $confConfig ) {
-               $this->wikiId = $confConfig['wikiId'];
-               $this->defaults = (array)(new DefaultSettings);
-               // @todo implement this:
-               // $this->initExtensionDefaults();
-               $this->initChangedSettings();
-               if( isset( $confConfig['exposeGlobals'] ) ) {
-                       $this->exposeGlobals();
-               }
-       }
-
-       /**
-        * Expose all config variables as globals for back-compat. Ewwww.
-        */
-       private function exposeGlobals() {
-               $allVars = $this->defaults + $this->extensionDefaults + $this->values;
-               foreach( $allVars as $name => $value ) {
-                       $var = 'wg' . ucfirst( $name );
-                       $GLOBALS[$var] = $value;
-               }
-       }
-
-       /**
-        * Load customized settings from whatever the data store is
-        */
-       abstract protected function initChangedSettings();
-
-       /**
-        * Apply a setting to the backend store
-        * @param $name String Name of the setting
-        * @param $value mixed Value to store
-        */
-       abstract protected function writeSetting( $name, $value );
-
-       /**
-        * Initialize a new child class based on a configuration array
-        * @param $conf Array of configuration settings, see $wgConfiguration
-        *   for details
-        * @throws MWException
-        * @return Conf
-        */
-       private static function newFromSettings( $conf ) {
-               $class = ucfirst( $conf['type'] ) . 'Conf';
-               if( !class_exists( $class ) ) {
-                       throw new MWException( '$wgConfiguration misconfigured with invalid "type"' );
-               }
-               return new $class( $conf );
-       }
-
-       /**
-        * Get the singleton if we don't want a specific wiki
-        * @param bool|string $wiki An id for a remote wiki
-        * @throws MWException
-        * @return Conf child
-        */
-       public static function load( $wiki = false ) {
-               throw new MWException( "Not working yet, don't attempt to use this" );
-               if( !self::$__instance ) {
-                       /**global $wgConfiguration;
-                       self::$__instance = self::newFromSettings( $wgConfiguration );*/
-               }
-               if( $wiki && $wiki != self::$__instance->getWikiId() ) {
-                       // Load configuration for a different wiki, not sure how
-                       // we're gonna do this yet
-                       return null;
-               }
-               return self::$__instance;
-       }
-
-       /**
-        * Get a property from the configuration database, falling back
-        * to DefaultSettings if undefined
-        * @param $name String Name of setting to retrieve.
-        * @param $wiki String An id for a remote wiki
-        * @return mixed
-        */
-       public static function get( $name, $wiki = false ) {
-               return self::load( $wiki )->retrieveSetting( $name );
-       }
-
-       /**
-        * Actually get the setting, checking overrides, extensions, then core.
-        *
-        * @param $name String Name of setting to get
-        * @return mixed
-        */
-       public function retrieveSetting( $name ) {
-               // isset() is ok here, because the default is to return null anyway.
-               if( isset( $this->values[$name] ) ) {
-                       return $this->values[$name];
-               } elseif( isset( $this->extensionDefaults[$name] ) ) {
-                       return $this->extensionDefaults[$name];
-               } elseif( isset( $this->defaults[$name] ) ) {
-                       return $this->defaults[$name];
-               } else {
-                       wfDebug( __METHOD__ . " called for unknown configuration item '$name'\n" );
-                       return null;
-               }
-       }
-
-       /**
-        * Apply a setting to the configuration object.
-        * @param $name String Name of the config item
-        * @param $value mixed Any value to use for the key
-        * @param $write bool Whether to write to the static copy (db, file, etc)
-        */
-       public function applySetting( $name, $value, $write = false ) {
-               $this->values[$name] = $value;
-               if( $write && ( $value !== $this->getDefaultSetting( $name ) ) ) {
-                       $this->writeSetting( $name, $value );
-               }
-       }
-
-       /**
-        * Get the default for a given setting name. Check core and then extensions.
-        * Will return NO_SUCH_DEFAULT_CONFIG if the config item does not exist.
-        *
-        * @param $name String Name of setting
-        * @return mixed
-        */
-       public function getDefaultSetting( $name ) {
-               // Use array_key_exists() here, to make sure we return a default
-               // that's really set to null.
-               if( array_key_exists( $name, $this->defaults ) ) {
-                       return $this->defaults[$name];
-               } elseif( array_key_exists( $name, $this->extensionDefaults ) ) {
-                       return $this->extensionDefaults[$name];
-               } else {
-                       wfDebug( __METHOD__ . " called for unknown configuration item '$name'\n" );
-                       return self::NO_SUCH_DEFAULT_CONFIG;
-               }
-       }
-
-       /**
-        * What is the wiki ID for this site?
-        * @return String
-        */
-       public function getWikiId() {
-               return $this->wikiId;
-       }
-}
diff --git a/includes/conf/DatabaseConf.php b/includes/conf/DatabaseConf.php
deleted file mode 100644 (file)
index d8f644d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * Database configuration class
- *
- * Copyright © 2011 Chad Horohoe <chadh@wikimedia.org>
- * http://www.mediawiki.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Config
- */
-class DatabaseConf extends Conf {
-       /**
-        * @see Conf::initChangedSettings()
-        */
-       protected function initChangedSettings() {
-               $res = wfGetDB( DB_MASTER )->select( 'config', '*', array(), __METHOD__ );
-               foreach( $res as $row ) {
-                       $this->values[$row->cf_name] = unserialize( $row->cf_value );
-               }
-       }
-
-       /**
-        * @see Conf::writeSetting()
-        *
-        * @param $name
-        * @param $value
-        *
-        * @return bool
-        */
-       protected function writeSetting( $name, $value ) {
-               $dbw = wfGetDB( DB_MASTER );
-               $value = serialize( $value );
-               if( $dbw->selectRow( 'config', 'cf_name', array( 'cf_name' => $name ), __METHOD__ ) ) {
-                       $dbw->update( 'config', array( 'cf_value' => $value ),
-                               array( 'cf_name' => $name ), __METHOD__ );
-               } else {
-                       $dbw->insert( 'config',
-                               array( 'cf_name' => $name, 'cf_value' => $value ), __METHOD__ );
-               }
-               return (bool)$dbw->affectedRows();
-       }
-}
diff --git a/includes/conf/DefaultSettings.php b/includes/conf/DefaultSettings.php
deleted file mode 100644 (file)
index 4601f04..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * Utility class for holding all of our default settings.
- *
- * Copyright © 2011 Chad Horohoe <chadh@wikimedia.org>
- * http://www.mediawiki.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Config
- */
-final class DefaultSettings {
-       public $mySetting = 'defaultValue';
-}
index 74c5a88..0e22fce 100644 (file)
@@ -32,6 +32,13 @@ class TextContent extends AbstractContent {
        public function __construct( $text, $model_id = CONTENT_MODEL_TEXT ) {
                parent::__construct( $model_id );
 
+               if ( $text === null || $text === false ) {
+                       wfWarn( "TextContent constructed with \$text = " . var_export( $text, true ) . "! "
+                                       . "This may indicate an error in the caller's scope." );
+
+                       $text = '';
+               }
+
                if ( !is_string( $text ) ) {
                        throw new MWException( "TextContent expects a string in the constructor." );
                }
index 805ff0f..33bf69c 100644 (file)
@@ -85,9 +85,6 @@ class Ibm_db2Updater extends DatabaseUpdater {
                        array( 'addField', 'revision',      'rev_sha1',         'patch-rev_sha1.sql' ),
                        array( 'addField', 'archive',       'ar_sha1',          'patch-ar_sha1.sql' ),
 
-                       // 1.20
-                       array( 'addTable', 'config',                            'patch-config.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' ),
index 82de913..3f1dad9 100644 (file)
@@ -209,7 +209,6 @@ class MysqlUpdater extends DatabaseUpdater {
                        array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ufg_group-length-increase.sql' ),
 
                        // 1.20
-                       array( 'addTable', 'config',                            'patch-config.sql' ),
                        array( 'addIndex', 'revision', 'page_user_timestamp', 'patch-revision-user-page-index.sql' ),
                        array( 'addField', 'ipblocks',      'ipb_parent_block_id',           'patch-ipb-parent-block-id.sql' ),
                        array( 'addIndex', 'ipblocks',      'ipb_parent_block_id',           'patch-ipb-parent-block-id-index.sql' ),
index f946d59..5523470 100644 (file)
@@ -67,7 +67,6 @@ class OracleUpdater extends DatabaseUpdater {
                        array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ufg_group-length-increase.sql' ),
 
                        //1.20
-                       array( 'addTable', 'config', 'patch-config.sql' ),
                        array( 'addIndex', 'ipblocks', 'i05', 'patch-ipblocks_i05_index.sql' ),
                        array( 'addIndex', 'revision', 'i05', 'patch-revision_i05_index.sql' ),
                        array( 'dropField', 'category', 'cat_hidden', 'patch-cat_hidden.sql' ),
index 457268c..5a13d42 100644 (file)
@@ -89,7 +89,6 @@ class PostgresUpdater extends DatabaseUpdater {
                        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', 'config',            'patch-config.sql' ),
                        array( 'addTable', 'external_user',     'patch-external_user.sql' ),
 
                        # Needed before new field
index c3f7a81..2fa3f31 100644 (file)
@@ -88,7 +88,6 @@ class SqliteUpdater extends DatabaseUpdater {
                        array( 'modifyField', 'user_former_groups', 'ufg_group', 'patch-ug_group-length-increase.sql' ),
 
                        // 1.20
-                       array( 'addTable', 'config',                            'patch-config.sql' ),
                        array( 'addIndex', 'revision', 'page_user_timestamp', 'patch-revision-user-page-index.sql' ),
                        array( 'addField', 'ipblocks', 'ipb_parent_block_id', 'patch-ipb-parent-block-id.sql' ),
                        array( 'addIndex', 'ipblocks', 'ipb_parent_block_id', 'patch-ipb-parent-block-id-index.sql' ),
index 4d875e6..9a42c09 100644 (file)
@@ -139,7 +139,8 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                $this->mTargetObj = $ret;
 
                $form = new HTMLForm( $this->getFormFields(), $this->getContext() );
-               $form->addPreText( $this->msg( 'emailpagetext' )->parse() );
+               // By now we are supposed to be sure that $this->mTarget is a user name
+               $form->addPreText( $this->msg( 'emailpagetext', $this->mTarget )->parse() );
                $form->setSubmitTextMsg( 'emailsend' );
                $form->setTitle( $this->getTitle() );
                $form->setSubmitCallback( array( __CLASS__, 'uiSubmit' ) );
index 5b8987a..832f2c6 100644 (file)
@@ -2807,7 +2807,8 @@ There may be [[{{MediaWiki:Listgrouprights-helppage}}|additional information]] a
 'emailuser-title-notarget' => 'E-mail user',
 'emailuser-summary'        => '', # do not translate or duplicate this message to other languages
 'emailpage'                => 'E-mail user',
-'emailpagetext'            => 'You can use the form below to send an e-mail message to this user.
+// Dummy GENDER to prevent warnings at translatewiki
+'emailpagetext'            => 'You can use the form below to send an e-mail message to this {{GENDER:$1|user}}.
 The e-mail address you entered in [[Special:Preferences|your user preferences]] will appear as the "From" address of the e-mail, so the recipient will be able to reply directly to you.',
 'usermailererror'          => 'Mail object returned error:',
 'defemailsubject'          => '{{SITENAME}} e-mail from user "$1"',
@@ -3752,6 +3753,7 @@ This is probably caused by a link to a blacklisted external site.',
 'pageinfo-default-sort'        => 'Default sort key',
 'pageinfo-length'              => 'Page length (in bytes)',
 'pageinfo-article-id'          => 'Page ID',
+'pageinfo-language'            => 'Page content language',
 'pageinfo-robot-policy'        => 'Search engine status',
 'pageinfo-robot-index'         => 'Indexable',
 'pageinfo-robot-noindex'       => 'Not indexable',
index d88763b..3fea1f1 100644 (file)
@@ -2654,7 +2654,8 @@ See also {{msg-mw|listgrouprights-addgroup-all}}.',
 'emailpage' => "Title of special page [[Special:EmailUser]], when it is the destination of the sidebar link {{msg-mw|Emailuser}} on a user's page.",
 'emailpagetext' => 'This is the text that is displayed above the e-mail form on [[Special:EmailUser]].
 
-Special:EmailUser appears when you click on the link "E-mail this user" in the sidebar, but only if there is an e-mail address in the recipient\'s user preferences. If there isn\'t then the message [[Mediawiki:Noemailtext]] will appear instead of Special:EmailUser.',
+Special:EmailUser appears when you click on the link "E-mail this user" in the sidebar, but only if there is an e-mail address in the recipient\'s user preferences. If there isn\'t then the message [[Mediawiki:Noemailtext]] will appear instead of Special:EmailUser. Parameters:
+* $1 can be used for GENDER.',
 'defemailsubject' => 'The default subject of EmailUser emails. Parameters:
 * $1 is the username of the user sending the email and can be used for GENDER.',
 'usermaildisabled' => 'Caption for an error message ({{msg-mw|Usermaildisabledtext}}) shown when the user-to-user e-mail feature is disabled on the wiki (see [[mw:Manual:$wgEnableEmail]], [[mw:Manual:$wgEnableUserEmail]]).',
@@ -3544,6 +3545,7 @@ See also {{msg-mw|Anonuser}} and {{msg-mw|Siteusers}}.',
 'pageinfo-default-sort' => 'The key by which the page is sorted in categories by default.',
 'pageinfo-length' => 'પૃષ્ઠની લંબાઇ બાઇટમાં',
 'pageinfo-article-id' => 'The numeric identifier of the page.',
+'pageinfo-language' => 'Language in which the page content is written.',
 'pageinfo-robot-policy' => 'The search engine status of the page, e.g. "marked as index".',
 'pageinfo-robot-index' => 'An indication that the page is indexable.',
 'pageinfo-robot-noindex' => 'An indication that the page is not indexable.',
diff --git a/maintenance/archives/patch-config.sql b/maintenance/archives/patch-config.sql
deleted file mode 100644 (file)
index 791015e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
--- Table for holding configuration changes
-CREATE TABLE /*_*/config (
-  -- Config var name
-  cf_name varbinary(255) NOT NULL PRIMARY KEY,
-  -- Config var value
-  cf_value blob NOT NULL
-) /*$wgDBTableOptions*/;
--- Should cover *most* configuration - strings, ints, bools, etc.
-CREATE INDEX /*i*/cf_name_value ON /*_*/config (cf_name,cf_value(255));
index 6fd7a83..2edb7f0 100644 (file)
@@ -927,13 +927,3 @@ CREATE TABLE user_former_groups (
 );
 CREATE UNIQUE INDEX ufg_user_group
   ON user_former_groups (ufg_user, ufg_group);
-
-
-
--- Table for holding configuration changes
-CREATE TABLE config (
-  cf_name   VARCHAR(255) NOT NULL
-    PRIMARY KEY,
-  cf_value  CLOB(64K) INLINE LENGTH 4096 NOT NULL
-);
-
index 391fd99..56cff94 100644 (file)
@@ -2682,6 +2682,7 @@ $wgMessageStructure = array(
                'pageinfo-default-sort',
                'pageinfo-length',
                'pageinfo-article-id',
+               'pageinfo-language',
                'pageinfo-robot-policy',
                'pageinfo-robot-index',
                'pageinfo-robot-noindex',
diff --git a/maintenance/oracle/archives/patch-config.sql b/maintenance/oracle/archives/patch-config.sql
deleted file mode 100644 (file)
index 66714a7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-define mw_prefix='{$wgDBprefix}';
-
-CREATE TABLE &mw_prefix.config (
-  cf_name VARCHAR2(255) NOT NULL,
-  cf_value blob NOT NULL
-);
-ALTER TABLE &mw_prefix.config ADD CONSTRAINT &mw_prefix.config_pk PRIMARY KEY (cf_name);
-
index d0712e3..f28c61f 100644 (file)
@@ -670,13 +670,6 @@ CREATE TABLE &mw_prefix.module_deps (
 );
 CREATE UNIQUE INDEX &mw_prefix.module_deps_u01 ON &mw_prefix.module_deps (md_module, md_skin);
 
-CREATE TABLE &mw_prefix.config (
-  cf_name VARCHAR2(255) NOT NULL,
-  cf_value blob NOT NULL
-);
-ALTER TABLE &mw_prefix.config ADD CONSTRAINT &mw_prefix.config_pk PRIMARY KEY (cf_name);
--- leaving index out for now ...
-
 -- do not prefix this table as it breaks parserTests
 CREATE TABLE wiki_field_info_full (
 table_name VARCHAR2(35) NOT NULL,
diff --git a/maintenance/postgres/archives/patch-config.sql b/maintenance/postgres/archives/patch-config.sql
deleted file mode 100644 (file)
index 2f39ff0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE config (
-  cf_name   TEXT  NOT NULL  PRIMARY KEY,
-  cf_value  TEXT  NOT NULL
-);
-CREATE INDEX cf_name_value ON config (cf_name, cf_value);
\ No newline at end of file
index 27759d5..845193d 100644 (file)
@@ -697,9 +697,3 @@ CREATE TABLE module_deps (
   md_deps    TEXT  NOT NULL
 );
 CREATE UNIQUE INDEX md_module_skin ON module_deps (md_module, md_skin);
-
-CREATE TABLE config (
-  cf_name   TEXT  NOT NULL  PRIMARY KEY,
-  cf_value  TEXT  NOT NULL
-);
-CREATE INDEX cf_name_value ON config (cf_name, cf_value);
index a4cdefd..bdcd66e 100644 (file)
@@ -1508,16 +1508,6 @@ CREATE TABLE /*_*/module_deps (
 ) /*$wgDBTableOptions*/;
 CREATE UNIQUE INDEX /*i*/md_module_skin ON /*_*/module_deps (md_module, md_skin);
 
--- Table for holding configuration changes
-CREATE TABLE /*_*/config (
-  -- Config var name
-  cf_name varbinary(255) NOT NULL PRIMARY KEY,
-  -- Config var value
-  cf_value blob NOT NULL
-) /*$wgDBTableOptions*/;
--- Should cover *most* configuration - strings, ints, bools, etc.
-CREATE INDEX /*i*/cf_name_value ON /*_*/config (cf_name,cf_value(255));
-
 -- Holds all the sites known to the wiki.
 CREATE TABLE /*_*/sites (
 -- Numeric id of the site
index 258dfec..db41a4d 100644 (file)
@@ -220,15 +220,22 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         *  if an array is given as first argument).
         */
        protected function setMwGlobals( $pairs, $value = null ) {
-               if ( !is_array( $pairs ) ) {
-                       $key = $pairs;
-                       $this->mwGlobals[$key] = $GLOBALS[$key];
-                       $GLOBALS[$key] = $value;
-               } else {
-                       foreach ( $pairs as $key => $value ) {
+
+               // Normalize (string, value) to an array
+               if( is_string( $pairs ) ) {
+                       $pairs = array( $pairs => $value );
+               }
+
+               foreach ( $pairs as $key => $value ) {
+                       // NOTE: make sure we only save the global once or a second call to
+                       // setMwGlobals() on the same global would override the original
+                       // value.
+                       if ( !array_key_exists( $key, $this->mwGlobals ) ) {
                                $this->mwGlobals[$key] = $GLOBALS[$key];
-                               $GLOBALS[$key] = $value;
                        }
+
+                       // Override the global
+                       $GLOBALS[$key] = $value;
                }
        }