Merge "Remove unused global from SpecialUserlogin.php"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 17 Jun 2015 22:09:20 +0000 (22:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 17 Jun 2015 22:09:20 +0000 (22:09 +0000)
42 files changed:
RELEASE-NOTES-1.26
includes/Import.php
includes/Setup.php
includes/api/ApiBlock.php
includes/api/ApiCreateAccount.php
includes/api/ApiEditPage.php
includes/api/ApiFormatXml.php
includes/api/ApiLogin.php
includes/api/ApiParamInfo.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiUnblock.php
includes/api/ApiUndelete.php
includes/cache/LCStoreStaticArray.php
includes/objectcache/SqlBagOStuff.php
includes/registration/ExtensionRegistry.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderImage.php
includes/resourceloader/ResourceLoaderImageModule.php
includes/resourceloader/ResourceLoaderModule.php
includes/resourceloader/ResourceLoaderOOUIImageModule.php
includes/resourceloader/ResourceLoaderSkinModule.php
includes/resourceloader/ResourceLoaderStartUpModule.php
includes/skins/Skin.php
includes/skins/SkinFallbackTemplate.php
includes/upload/UploadFromUrl.php
languages/messages/MessagesGom.php
languages/messages/MessagesGom_deva.php
languages/messages/MessagesPnt.php
maintenance/convertExtensionToRegistration.php
maintenance/exportSites.php
maintenance/importSites.php
resources/ResourcesOOUI.php
resources/src/mediawiki.action/mediawiki.action.edit.stash.js
tests/phpunit/ResourceLoaderTestCase.php
tests/phpunit/includes/api/ApiMainTest.php
tests/phpunit/includes/api/ApiResultTest.php
tests/phpunit/includes/api/query/ApiQueryTest.php
tests/phpunit/includes/objectcache/WANObjectCacheTest.php
tests/phpunit/includes/site/HashSiteStoreTest.php
tests/phpunit/includes/site/SiteExporterTest.php
tests/phpunit/includes/utils/IPTest.php
tests/phpunit/structure/AvailableRightsTest.php

index db560c6..419525b 100644 (file)
@@ -45,6 +45,8 @@ production.
   with formatversion=2.
 * Various other output from meta=siteinfo will now always be arrays instead of
   sometimes being numerically-indexed objects with formatversion=2.
+* When errors about users being blocked are returned, they now include
+  information about the relevant block.
 
 === Action API internal changes in 1.26 ===
 
index 214bc4e..6a0bfd0 100644 (file)
@@ -394,9 +394,9 @@ class WikiImporter {
                        $countKey = 'title_' . $title->getPrefixedText();
                        $countable = $page->isCountable( $editInfo );
                        if ( array_key_exists( $countKey, $this->countableCache ) &&
-                               $countable != $this->countableCache[ $countKey ] ) {
+                               $countable != $this->countableCache[$countKey] ) {
                                DeferredUpdates::addUpdate( SiteStatsUpdate::factory( array(
-                                       'articles' => ( (int)$countable - (int)$this->countableCache[ $countKey ] )
+                                       'articles' => ( (int)$countable - (int)$this->countableCache[$countKey] )
                                ) ) );
                        }
                }
@@ -611,7 +611,7 @@ class WikiImporter {
                        $tag = $this->reader->localName;
 
                        if ( $tag == 'namespace' ) {
-                               $this->foreignNamespaces[ $this->nodeAttribute( 'key' ) ] =
+                               $this->foreignNamespaces[$this->nodeAttribute( 'key' )] =
                                        $this->nodeContents();
                        } elseif ( in_array( $tag, $normalFields ) ) {
                                $siteInfo[$tag] = $this->nodeContents();
index 2fa9de1..a97cfa6 100644 (file)
@@ -363,7 +363,7 @@ if ( $wgMetaNamespace === false ) {
 
 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
 if ( $wgResourceLoaderMaxQueryLength === false ) {
-       $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' );
+       $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
        if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
                $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
        } else {
index 26b5f0e..6adfc1a 100644 (file)
@@ -52,7 +52,13 @@ class ApiBlock extends ApiBase {
                if ( $user->isBlocked() ) {
                        $status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
                        if ( $status !== true ) {
-                               $this->dieUsageMsg( array( $status ) );
+                               $msg = $this->parseMsg( $status );
+                               $this->dieUsage(
+                                       $msg['info'],
+                                       $msg['code'],
+                                       0,
+                                       array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) )
+                               );
                        }
                }
 
index 57f96c6..b3a543a 100644 (file)
@@ -48,7 +48,12 @@ class ApiCreateAccount extends ApiBase {
                        );
                }
                if ( $this->getUser()->isBlockedFromCreateAccount() ) {
-                       $this->dieUsage( 'You cannot create a new account because you are blocked', 'blocked' );
+                       $this->dieUsage(
+                               'You cannot create a new account because you are blocked',
+                               'blocked',
+                               0,
+                               array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $this->getUser()->getBlock() ) )
+                       );
                }
 
                $params = $this->extractRequestParams();
index 6189f68..e70b8f0 100644 (file)
@@ -130,7 +130,30 @@ class ApiEditPage extends ApiBase {
                        $errors = array_merge( $errors, $titleObj->getUserPermissionsErrors( 'create', $user ) );
                }
                if ( count( $errors ) ) {
-                       $this->dieUsageMsg( $errors[0] );
+                       if ( is_array( $errors[0] ) ) {
+                               switch ( $errors[0][0] ) {
+                                       case 'blockedtext':
+                                               $this->dieUsage(
+                                                       'You have been blocked from editing',
+                                                       'blocked',
+                                                       0,
+                                                       array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) )
+                                               );
+                                               break;
+                                       case 'autoblockedtext':
+                                               $this->dieUsage(
+                                                       'Your IP address has been blocked automatically, because it was used by a blocked user',
+                                                       'autoblocked',
+                                                       0,
+                                                       array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) )
+                                               );
+                                               break;
+                                       default:
+                                               $this->dieUsageMsg( $errors[0] );
+                               }
+                       } else {
+                               $this->dieUsageMsg( $errors[0] );
+                       }
                }
 
                $toMD5 = $params['text'];
@@ -450,7 +473,12 @@ class ApiEditPage extends ApiBase {
                                $this->dieUsageMsg( array( 'spamdetected', $result['spam'] ) );
 
                        case EditPage::AS_BLOCKED_PAGE_FOR_USER:
-                               $this->dieUsageMsg( 'blockedtext' );
+                               $this->dieUsage(
+                                       'You have been blocked from editing',
+                                       'blocked',
+                                       0,
+                                       array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) )
+                               );
 
                        case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
                        case EditPage::AS_CONTENT_TOO_BIG:
index fa0bac3..4c7d720 100644 (file)
@@ -72,7 +72,7 @@ class ApiFormatXml extends ApiFormatBase {
                        'Custom' => function ( &$data, &$metadata ) {
                                if ( isset( $metadata[ApiResult::META_TYPE] ) ) {
                                        // We want to use non-BC for BCassoc to force outputting of _idx.
-                                       switch( $metadata[ApiResult::META_TYPE] ) {
+                                       switch ( $metadata[ApiResult::META_TYPE] ) {
                                                case 'BCassoc':
                                                        $metadata[ApiResult::META_TYPE] = 'assoc';
                                                        break;
index d8b390c..c4e7022 100644 (file)
@@ -144,6 +144,10 @@ class ApiLogin extends ApiBase {
                        case LoginForm::CREATE_BLOCKED:
                                $result['result'] = 'CreateBlocked';
                                $result['details'] = 'Your IP address is blocked from account creation';
+                               $result = array_merge(
+                                       $result,
+                                       ApiQueryUserInfo::getBlockInfo( $context->getUser()->getBlock() )
+                               );
                                break;
 
                        case LoginForm::THROTTLED:
@@ -154,6 +158,10 @@ class ApiLogin extends ApiBase {
 
                        case LoginForm::USER_BLOCKED:
                                $result['result'] = 'Blocked';
+                               $result = array_merge(
+                                       $result,
+                                       ApiQueryUserInfo::getBlockInfo( User::newFromName( $params['name'] )->getBlock() )
+                               );
                                break;
 
                        case LoginForm::ABORTED:
index 8a4ef49..2ab37ad 100644 (file)
@@ -337,7 +337,7 @@ class ApiParamInfo extends ApiBase {
                                                        ? '' : ( $module->getModulePath() . '+' );
                                                $item['submodules'] = array();
                                                foreach ( $item['type'] as $v ) {
-                                                       $item['submodules'][$v] = $prefix.$v;
+                                                       $item['submodules'][$v] = $prefix . $v;
                                                }
                                        }
                                        if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
index 4302ef3..e003e31 100644 (file)
@@ -51,9 +51,32 @@ class ApiQueryUserInfo extends ApiQueryBase {
                $result->addValue( 'query', $this->getModuleName(), $r );
        }
 
-       protected function getCurrentUserInfo() {
+       /**
+        * Get basic info about a given block
+        * @param Block $block
+        * @return array Array containing several keys:
+        *  - blockid - ID of the block
+        *  - blockedby - username of the blocker
+        *  - blockedbyid - user ID of the blocker
+        *  - blockreason - reason provided for the block
+        *  - blockedtimestamp - timestamp for when the block was placed/modified
+        *  - blockexpiry - expiry time of the block
+        */
+       public static function getBlockInfo( Block $block ) {
                global $wgContLang;
+               $vals = array();
+               $vals['blockid'] = $block->getId();
+               $vals['blockedby'] = $block->getByName();
+               $vals['blockedbyid'] = $block->getBy();
+               $vals['blockreason'] = $block->mReason;
+               $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->mTimestamp );
+               $vals['blockexpiry'] = $wgContLang->formatExpiry(
+                       $block->getExpiry(), TS_ISO_8601, 'infinite'
+               );
+               return $vals;
+       }
 
+       protected function getCurrentUserInfo() {
                $user = $this->getUser();
                $result = $this->getResult();
                $vals = array();
@@ -64,18 +87,8 @@ class ApiQueryUserInfo extends ApiQueryBase {
                        $vals['anon'] = true;
                }
 
-               if ( isset( $this->prop['blockinfo'] ) ) {
-                       if ( $user->isBlocked() ) {
-                               $block = $user->getBlock();
-                               $vals['blockid'] = $block->getId();
-                               $vals['blockedby'] = $block->getByName();
-                               $vals['blockedbyid'] = $block->getBy();
-                               $vals['blockreason'] = $user->blockedFor();
-                               $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->mTimestamp );
-                               $vals['blockexpiry'] = $wgContLang->formatExpiry(
-                                       $block->getExpiry(), TS_ISO_8601, 'infinite'
-                               );
-                       }
+               if ( isset( $this->prop['blockinfo'] ) && $user->isBlocked() ) {
+                       $vals = array_merge( $vals, self::getBlockInfo( $user->getBlock() ) );
                }
 
                if ( isset( $this->prop['hasmsg'] ) ) {
index 1af83ba..f6c24b7 100644 (file)
@@ -53,7 +53,13 @@ class ApiUnblock extends ApiBase {
                if ( $user->isBlocked() ) {
                        $status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
                        if ( $status !== true ) {
-                               $this->dieUsageMsg( $status );
+                               $msg = $this->parseMsg( $status );
+                               $this->dieUsage(
+                                       $msg['info'],
+                                       $msg['code'],
+                                       0,
+                                       array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) )
+                               );
                        }
                }
 
index c23e9ff..28702b1 100644 (file)
@@ -37,7 +37,12 @@ class ApiUndelete extends ApiBase {
                }
 
                if ( $this->getUser()->isBlocked() ) {
-                       $this->dieUsageMsg( 'blockedtext' );
+                       $this->dieUsage(
+                               'You have been blocked from editing',
+                               'blocked',
+                               0,
+                               array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $this->getUser()->getBlock() ) )
+                       );
                }
 
                $titleObj = Title::newFromText( $params['title'] );
index 862ed67..6a597ca 100644 (file)
@@ -48,7 +48,7 @@ class LCStoreStaticArray implements LCStore {
 
        public function startWrite( $code ) {
                $this->currentLang = $code;
-               $this->fname = $this->directory. '/' . $code . '.l10n.php';
+               $this->fname = $this->directory . '/' . $code . '.l10n.php';
                $this->data[$code] = array();
                if ( file_exists( $this->fname ) ) {
                        $this->data[$code] = require $this->fname;
@@ -125,7 +125,7 @@ class LCStoreStaticArray implements LCStore {
 
        public function get( $code, $key ) {
                if ( !array_key_exists( $code, $this->data ) ) {
-                       $fname = $this->directory. '/' . $code . '.l10n.php';
+                       $fname = $this->directory . '/' . $code . '.l10n.php';
                        if ( !file_exists( $fname ) ) {
                                return null;
                        }
index 2017a74..b8c1e75 100644 (file)
@@ -358,8 +358,6 @@ class SqlBagOStuff extends BagOStuff {
                return $result;
        }
 
-
-
        /**
         * @param string $key
         * @param mixed $value
index d767870..d48a1bd 100644 (file)
@@ -137,7 +137,7 @@ class ExtensionRegistry {
                        if ( !is_array( $info ) ) {
                                throw new Exception( "$path is not a valid JSON file." );
                        }
-                       if ( !isset( $info['manifest_version' ] ) ) {
+                       if ( !isset( $info['manifest_version'] ) ) {
                                // For backwards-compatability, assume a version of 1
                                $info['manifest_version'] = 1;
                        }
index bbe55ab..92b0156 100644 (file)
@@ -1104,9 +1104,9 @@ MESSAGE;
                $module = array(
                        $name,
                        $scripts,
-                       (object) $styles,
-                       (object) $messages,
-                       (object) $templates,
+                       (object)$styles,
+                       (object)$messages,
+                       (object)$templates,
                );
                self::trimArray( $module );
 
index bf68fdd..6382200 100644 (file)
@@ -60,9 +60,9 @@ class ResourceLoaderImage {
                                if ( strpos( $langList, ',' ) !== false ) {
                                        $this->descriptor['lang'] += array_fill_keys(
                                                explode( ',', $langList ),
-                                               $this->descriptor['lang'][ $langList ]
+                                               $this->descriptor['lang'][$langList]
                                        );
-                                       unset( $this->descriptor['lang'][ $langList ] );
+                                       unset( $this->descriptor['lang'][$langList] );
                                }
                        }
                }
@@ -121,10 +121,10 @@ class ResourceLoaderImage {
                $desc = $this->descriptor;
                if ( is_string( $desc ) ) {
                        return $this->basePath . '/' . $desc;
-               } elseif ( isset( $desc['lang'][ $context->getLanguage() ] ) ) {
-                       return $this->basePath . '/' . $desc['lang'][ $context->getLanguage() ];
-               } elseif ( isset( $desc[ $context->getDirection() ] ) ) {
-                       return $this->basePath . '/' . $desc[ $context->getDirection() ];
+               } elseif ( isset( $desc['lang'][$context->getLanguage()] ) ) {
+                       return $this->basePath . '/' . $desc['lang'][$context->getLanguage()];
+               } elseif ( isset( $desc[$context->getDirection()] ) ) {
+                       return $this->basePath . '/' . $desc[$context->getDirection()];
                } else {
                        return $this->basePath . '/' . $desc['default'];
                }
index ccdb88f..0c1db1a 100644 (file)
@@ -231,23 +231,23 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
                        $this->loadFromDefinition();
                        $this->imageObjects = array();
                }
-               if ( !isset( $this->imageObjects[ $skin ] ) ) {
-                       $this->imageObjects[ $skin ] = array();
-                       if ( !isset( $this->images[ $skin ] ) ) {
-                               $this->images[ $skin ] = isset( $this->images[ 'default' ] ) ?
-                                       $this->images[ 'default' ] :
+               if ( !isset( $this->imageObjects[$skin] ) ) {
+                       $this->imageObjects[$skin] = array();
+                       if ( !isset( $this->images[$skin] ) ) {
+                               $this->images[$skin] = isset( $this->images['default'] ) ?
+                                       $this->images['default'] :
                                        array();
                        }
-                       foreach ( $this->images[ $skin ] as $name => $options ) {
+                       foreach ( $this->images[$skin] as $name => $options ) {
                                $fileDescriptor = is_string( $options ) ? $options : $options['file'];
 
                                $allowedVariants = array_merge(
                                        is_array( $options ) && isset( $options['variants'] ) ? $options['variants'] : array(),
                                        $this->getGlobalVariants( $context )
                                );
-                               if ( isset( $this->variants[ $skin ] ) ) {
+                               if ( isset( $this->variants[$skin] ) ) {
                                        $variantConfig = array_intersect_key(
-                                               $this->variants[ $skin ],
+                                               $this->variants[$skin],
                                                array_fill_keys( $allowedVariants, true )
                                        );
                                } else {
@@ -261,11 +261,11 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
                                        $this->localBasePath,
                                        $variantConfig
                                );
-                               $this->imageObjects[ $skin ][ $image->getName() ] = $image;
+                               $this->imageObjects[$skin][$image->getName()] = $image;
                        }
                }
 
-               return $this->imageObjects[ $skin ];
+               return $this->imageObjects[$skin];
        }
 
        /**
@@ -280,21 +280,21 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
                        $this->loadFromDefinition();
                        $this->globalVariants = array();
                }
-               if ( !isset( $this->globalVariants[ $skin ] ) ) {
-                       $this->globalVariants[ $skin ] = array();
-                       if ( !isset( $this->variants[ $skin ] ) ) {
-                               $this->variants[ $skin ] = isset( $this->variants[ 'default' ] ) ?
-                                       $this->variants[ 'default' ] :
+               if ( !isset( $this->globalVariants[$skin] ) ) {
+                       $this->globalVariants[$skin] = array();
+                       if ( !isset( $this->variants[$skin] ) ) {
+                               $this->variants[$skin] = isset( $this->variants['default'] ) ?
+                                       $this->variants['default'] :
                                        array();
                        }
-                       foreach ( $this->variants[ $skin ] as $name => $config ) {
+                       foreach ( $this->variants[$skin] as $name => $config ) {
                                if ( isset( $config['global'] ) && $config['global'] ) {
-                                       $this->globalVariants[ $skin ][] = $name;
+                                       $this->globalVariants[$skin][] = $name;
                                }
                        }
                }
 
-               return $this->globalVariants[ $skin ];
+               return $this->globalVariants[$skin];
        }
 
        /**
index ec7ed70..63da592 100644 (file)
@@ -458,9 +458,9 @@ abstract class ResourceLoaderModule {
                // Cache this expensive operation. This calls builds the scripts, styles, and messages
                // content which typically involves filesystem and/or database access.
                if ( !array_key_exists( $contextHash, $this->contents ) ) {
-                       $this->contents[ $contextHash ] = $this->buildContent( $context );
+                       $this->contents[$contextHash] = $this->buildContent( $context );
                }
-               return $this->contents[ $contextHash ];
+               return $this->contents[$contextHash];
        }
 
        /**
@@ -608,9 +608,9 @@ abstract class ResourceLoaderModule {
                                $str .= strval( $mhash );
                        }
 
-                       $this->versionHash[ $contextHash ] = ResourceLoader::makeHash( $str );
+                       $this->versionHash[$contextHash] = ResourceLoader::makeHash( $str );
                }
-               return $this->versionHash[ $contextHash ];
+               return $this->versionHash[$contextHash];
        }
 
        /**
index ebbeb01..c825ab2 100644 (file)
@@ -50,7 +50,7 @@ class ResourceLoaderOOUIImageModule extends ResourceLoaderImageModule {
                                array_walk( $data['images'], function ( &$value ) use ( $fixPath ) {
                                        if ( is_string( $value['file'] ) ) {
                                                $fixPath( $value['file'] );
-                                       } else if ( is_array( $value['file'] ) ) {
+                                       } elseif ( is_array( $value['file'] ) ) {
                                                array_walk_recursive( $value['file'], $fixPath );
                                        }
                                } );
index 980b7fe..911d953 100644 (file)
@@ -44,13 +44,13 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
                                        '(min-resolution: 1.5dppx), ' .
                                        '(min-resolution: 144dpi)'
                                ][] = '.mw-wiki-logo { background-image: ' .
-                               CSSMin::buildUrlValue( $logoHD['1.5x'] ) .';' .
+                               CSSMin::buildUrlValue( $logoHD['1.5x'] ) . ';' .
                                'background-size: 135px auto; }';
                        }
                        if ( isset( $logoHD['2x'] ) ) {
                                $styles[
                                        '(-webkit-min-device-pixel-ratio: 2), ' .
-                                       '(min--moz-device-pixel-ratio: 2),'.
+                                       '(min--moz-device-pixel-ratio: 2),' .
                                        '(min-resolution: 2dppx), ' .
                                        '(min-resolution: 192dpi)'
                                ][] = '.mw-wiki-logo { background-image: ' .
index 8dbed8e..a578ece 100644 (file)
@@ -404,7 +404,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                // Pre-populate versionHash with something because the loop over all modules below includes
                // the startup module (this module).
                // See ResourceLoaderModule::getVersionHash() for usage of this cache.
-               $this->versionHash[ $context->getHash() ] = null;
+               $this->versionHash[$context->getHash()] = null;
 
                return $rl->getCombinedVersion( $context, $rl->getModuleNames() );
        }
index 6c5fbcd..327ef7c 100644 (file)
@@ -650,7 +650,7 @@ abstract class Skin extends ContextSource {
                }
 
                return $this->msg( 'retrievedfrom' )
-                       ->rawParams( '<a dir="ltr" href="' . $url. '">' . $url . '</a>' )
+                       ->rawParams( '<a dir="ltr" href="' . $url . '">' . $url . '</a>' )
                        ->parse();
        }
 
index 312769f..cd5e43c 100644 (file)
@@ -87,7 +87,7 @@ class SkinFallbackTemplate extends BaseTemplate {
                if ( file_exists( "$IP/skins/$skin/skin.json" ) ) {
                        return "wfLoadSkin( '$skin' );";
                } else {
-                       return  "require_once \"\$IP/skins/$skin/$skin.php\";";
+                       return "require_once \"\$IP/skins/$skin/$skin.php\";";
                }
        }
 
index fc59ace..4c099b3 100644 (file)
@@ -241,7 +241,7 @@ class UploadFromUrl extends UploadBase {
                        wfDebugLog(
                                'fileupload',
                                'Short write ' . $this->nbytes . '/' . strlen( $buffer ) .
-                                       ' bytes, aborting with '  . $this->mFileSize . ' uploaded so far'
+                                       ' bytes, aborting with ' . $this->mFileSize . ' uploaded so far'
                        );
                        fclose( $this->mTmpHandle );
                        $this->mTmpHandle = false;
index d684ed5..4adf154 100644 (file)
@@ -8,4 +8,4 @@
  *
  */
 
-$fallback = 'gom-deva';
\ No newline at end of file
+$fallback = 'gom-deva';
index 58fc505..b5cc343 100644 (file)
@@ -28,4 +28,4 @@ $namespaceNames = array(
        NS_HELP_TALK        => 'मजत_चर्चा',
        NS_CATEGORY         => 'श्रेणी',
        NS_CATEGORY_TALK    => 'श्रेणी_चर्चा',
-);
\ No newline at end of file
+);
index 0ca2a49..b0a4ca7 100644 (file)
@@ -48,8 +48,6 @@ $datePreferences = array(
 
 $defaultDateFormat = 'pnt';
 
-
-
 $dateFormats = array(
        'pnt time' => 'H:i',
        'pnt date' => 'j xg Y',
index df67306..b7fe80b 100644 (file)
@@ -56,7 +56,8 @@ class ConvertExtensionToRegistration extends Maintenance {
        public function __construct() {
                parent::__construct();
                $this->mDescription = 'Converts extension entry points to the new JSON registration format';
-               $this->addArg( 'path', 'Location to the PHP entry point you wish to convert', /* $required = */ true );
+               $this->addArg( 'path', 'Location to the PHP entry point you wish to convert',
+                       /* $required = */ true );
                $this->addOption( 'skin', 'Whether to write to skin.json', false, false );
        }
 
@@ -95,7 +96,8 @@ class ConvertExtensionToRegistration extends Maintenance {
                        }
 
                        if ( isset( $this->custom[$realName] ) ) {
-                               call_user_func_array( array( $this, $this->custom[$realName] ), array( $realName, $value, $vars ) );
+                               call_user_func_array( array( $this, $this->custom[$realName] ),
+                                       array( $realName, $value, $vars ) );
                        } elseif ( in_array( $realName, $globalSettings ) ) {
                                $this->json[$realName] = $value;
                        } elseif ( array_key_exists( $realName, $this->noLongerSupportedGlobals ) ) {
@@ -133,7 +135,9 @@ class ConvertExtensionToRegistration extends Maintenance {
        protected function handleExtensionFunctions( $realName, $value ) {
                foreach ( $value as $func ) {
                        if ( $func instanceof Closure ) {
-                               $this->error( "Error: Closures cannot be converted to JSON. Please move your extension function somewhere else.", 1 );
+                               $this->error( "Error: Closures cannot be converted to JSON. " .
+                                       "Please move your extension function somewhere else.", 1
+                               );
                        }
                }
 
@@ -197,7 +201,9 @@ class ConvertExtensionToRegistration extends Maintenance {
                foreach ( $value as $hookName => $handlers ) {
                        foreach ( $handlers as $func ) {
                                if ( $func instanceof Closure ) {
-                                       $this->error( "Error: Closures cannot be converted to JSON. Please move the handler for $hookName somewhere else.", 1 );
+                                       $this->error( "Error: Closures cannot be converted to JSON. " .
+                                               "Please move the handler for $hookName somewhere else.", 1
+                                       );
                                }
                        }
                }
index 1c71dc0..0c61633 100644 (file)
@@ -34,7 +34,7 @@ class ExportSites extends Maintenance {
 
                $handle = fopen( $file, 'w' );
 
-               if ( !$handle )  {
+               if ( !$handle ) {
                        $this->error( "Failed to open $file for writing.\n", 1 );
                }
 
@@ -51,4 +51,4 @@ class ExportSites extends Maintenance {
 }
 
 $maintClass = 'ExportSites';
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;
index 7abb8d7..4537943 100644 (file)
@@ -49,4 +49,4 @@ class ImportSites extends Maintenance {
 }
 
 $maintClass = 'ImportSites';
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;
index 37203fb..88a703e 100644 (file)
@@ -115,7 +115,7 @@ return call_user_func( function () {
                        $module['selectorWithVariant'] = '.oo-ui-image-{variant} .oo-ui-icon-{name}, .oo-ui-image-{variant}.oo-ui-icon-{name}, .mw-ui-icon-{name}-{variant}:before, .mw-ui-hovericon:hover .mw-ui-icon-{name}-{variant}-hover:before, .mw-ui-hovericon.mw-ui-icon-{name}-{variant}-hover:hover:before';
                }
 
-               $modules[ "oojs-ui.styles.$name" ] = $module;
+               $modules["oojs-ui.styles.$name"] = $module;
        }
 
        return $modules;
index 8e7b168..29c533d 100644 (file)
                        data = {},
                        timer = null;
 
+               function stashEdit( token ) {
+                       data = $form.serializeObject();
+
+                       pending = api.post( {
+                               action: 'stashedit',
+                               token: token,
+                               title: mw.config.get( 'wgPageName' ),
+                               section: data.wpSection,
+                               sectiontitle: '',
+                               text: data.wpTextbox1,
+                               contentmodel: data.model,
+                               contentformat: data.format,
+                               baserevid: data.parentRevId
+                       } );
+               }
+
                /* Has the edit body text changed since the last stashEdit() call? */
                function isChanged() {
                        // Normalize line endings to CRLF, like $.fn.serializeObject does.
                                pending.abort();
                        }
 
-                       data = $form.serializeObject();
-                       pending = api.postWithToken( 'edit', {
-                               action: 'stashedit',
-                               title: mw.config.get( 'wgPageName' ),
-                               section: data.wpSection,
-                               sectiontitle: '',
-                               text: data.wpTextbox1,
-                               contentmodel: data.model,
-                               contentformat: data.format,
-                               baserevid: data.parentRevId
-                       } );
+                       api.getToken( 'edit' ).then( stashEdit );
                }
 
                function onKeyPress( e ) {
index 223019c..3165bb8 100644 (file)
@@ -51,7 +51,7 @@ abstract class ResourceLoaderTestCase extends MediaWikiTestCase {
 
                $globals = array();
                foreach ( self::getSettings() as $key => $value ) {
-                       $globals[ 'wg' . $key ] = $value;
+                       $globals['wg' . $key] = $value;
                }
                $this->setMwGlobals( $globals );
        }
index e8ef180..ee1a954 100644 (file)
@@ -71,7 +71,7 @@ class ApiMainTest extends ApiTestCase {
                        new FauxRequest( array( 'action' => 'query', 'meta' => 'siteinfo' ) )
                );
                $modules = $api->getModuleManager()->getNamesWithClasses();
-               foreach( $modules as $name => $class ) {
+               foreach ( $modules as $name => $class ) {
                        $this->assertArrayHasKey(
                                $class,
                                $classes,
index 1ed571c..6f4300e 100644 (file)
@@ -1565,7 +1565,7 @@ class ApiResultTest extends MediaWikiTestCase {
 
                try {
                        $arr = array();
-                       ApiResult::setValue( $arr, 'foo',  new ApiResultTestSerializableObject(
+                       ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject(
                                new ApiResultTestStringifiableObject()
                        ) );
                        $this->fail( 'Expected exception not thrown' );
@@ -1579,7 +1579,7 @@ class ApiResultTest extends MediaWikiTestCase {
 
                try {
                        $arr = array();
-                       ApiResult::setValue( $arr, 'foo',  new ApiResultTestSerializableObject( NAN ) );
+                       ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject( NAN ) );
                        $this->fail( 'Expected exception not thrown' );
                } catch ( UnexpectedValueException $ex ) {
                        $this->assertSame(
@@ -1590,7 +1590,7 @@ class ApiResultTest extends MediaWikiTestCase {
                }
 
                $arr = array();
-               ApiResult::setValue( $arr, 'foo',  new ApiResultTestSerializableObject(
+               ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject(
                        array(
                                'one' => new ApiResultTestStringifiableObject( '1' ),
                                'two' => new ApiResultTestSerializableObject( 2 ),
index 5f061b5..61b992b 100644 (file)
@@ -131,7 +131,7 @@ class ApiQueryTest extends ApiTestCase {
                );
                $queryApi = new ApiQuery( $api, 'query' );
                $modules = $queryApi->getModuleManager()->getNamesWithClasses();
-               foreach( $modules as $name => $class ) {
+               foreach ( $modules as $name => $class ) {
                        $this->assertArrayHasKey(
                                $class,
                                $classes,
index 10dee83..47a83b3 100644 (file)
@@ -66,7 +66,7 @@ class WANObjectCacheTest extends MediaWikiTestCase {
 
        public function testSetOver() {
                $key = wfRandomString();
-               for ( $i=0; $i<3; ++$i ) {
+               for ( $i = 0; $i < 3; ++$i ) {
                        $value = wfRandomString();
                        $this->cache->set( $key, $value, 3 );
 
index 49a9633..bebc093 100644 (file)
@@ -32,7 +32,7 @@ class HashSiteStoreTest extends MediaWikiTestCase {
        public function testGetSites() {
                $expectedSites = array();
 
-               foreach( TestSites::getSites() as $testSite ) {
+               foreach ( TestSites::getSites() as $testSite ) {
                        $siteId = $testSite->getGlobalId();
                        $expectedSites[$siteId] = $testSite;
                }
index 19dd0aa..7be19ef 100644 (file)
@@ -53,7 +53,7 @@ class SiteExporterTest extends PHPUnit_Framework_TestCase {
                $exporter->exportSites( array( $foo, $acme ) );
 
                fseek( $tmp, 0 );
-               $xml = fread( $tmp, 16*1024 );
+               $xml = fread( $tmp, 16 * 1024 );
 
                $this->assertContains( '<sites ', $xml );
                $this->assertContains( '<site>', $xml );
@@ -133,7 +133,7 @@ class SiteExporterTest extends PHPUnit_Framework_TestCase {
                $exporter->exportSites( $sites );
 
                fseek( $tmp, 0 );
-               $xml = fread( $tmp, 16*1024 );
+               $xml = fread( $tmp, 16 * 1024 );
 
                $actualSites = new SiteList();
                $store = $this->newSiteStore( $actualSites );
index 65464c4..04b8f48 100644 (file)
@@ -360,17 +360,17 @@ class IPTest extends PHPUnit_Framework_TestCase {
        public static function provideIsPublic() {
                return array(
                        array( false, 'fc00::3' ), # RFC 4193 (local)
-                       array( false, 'fc00::ff'), # RFC 4193 (local)
-                       array( false, '127.1.2.3'), # loopback
-                       array( false, '::1'), # loopback
-                       array( false, 'fe80::1'), # link-local
-                       array( false, '169.254.1.1'), # link-local
-                       array( false, '10.0.0.1'), # RFC 1918 (private)
-                       array( false, '172.16.0.1'), # RFC 1918 (private)
-                       array( false, '192.168.0.1'), # RFC 1918 (private)
-                       array( true, '2001:5c0:1000:a::133'), # public
-                       array( true, 'fc::3'), # public
-                       array( true, '00FC::') # public
+                       array( false, 'fc00::ff' ), # RFC 4193 (local)
+                       array( false, '127.1.2.3' ), # loopback
+                       array( false, '::1' ), # loopback
+                       array( false, 'fe80::1' ), # link-local
+                       array( false, '169.254.1.1' ), # link-local
+                       array( false, '10.0.0.1' ), # RFC 1918 (private)
+                       array( false, '172.16.0.1' ), # RFC 1918 (private)
+                       array( false, '192.168.0.1' ), # RFC 1918 (private)
+                       array( true, '2001:5c0:1000:a::133' ), # public
+                       array( true, 'fc::3' ), # public
+                       array( true, '00FC::' ) # public
                );
        }
 
index 51d31aa..ccf5393 100644 (file)
@@ -19,11 +19,11 @@ class AvailableRightsTest extends PHPUnit_Framework_TestCase {
 
                $rights = User::getAllRights();
 
-               foreach( $wgGroupPermissions as $permissions ) {
+               foreach ( $wgGroupPermissions as $permissions ) {
                        $rights = array_merge( $rights, array_keys( $permissions ) );
                }
 
-               foreach( $wgRevokePermissions as $permissions ) {
+               foreach ( $wgRevokePermissions as $permissions ) {
                        $rights = array_merge( $rights, array_keys( $permissions ) );
                }