Merge "Changing the welcome message after signing up"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 20 Nov 2013 14:48:40 +0000 (14:48 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 20 Nov 2013 14:48:40 +0000 (14:48 +0000)
79 files changed:
includes/Action.php
includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/HTMLForm.php
includes/ImagePage.php
includes/Linker.php
includes/SpecialPage.php
includes/Title.php
includes/api/ApiQuery.php
includes/cache/BacklinkCache.php
includes/clientpool/RedisConnectionPool.php
includes/content/AbstractContent.php
includes/content/Content.php
includes/content/ContentHandler.php
includes/content/CssContentHandler.php
includes/content/JavaScriptContentHandler.php
includes/content/MessageContent.php
includes/content/TextContent.php
includes/content/TextContentHandler.php
includes/content/WikitextContent.php
includes/content/WikitextContentHandler.php
includes/context/ContextSource.php
includes/context/DerivativeContext.php
includes/context/RequestContext.php
includes/dao/DBAccessBase.php
includes/db/DatabaseMysqlBase.php
includes/db/DatabaseMysqli.php
includes/db/LoadBalancer.php
includes/filerepo/file/LocalFile.php
includes/installer/DatabaseUpdater.php
includes/media/FormatMetadata.php
includes/parser/ParserOutput.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/specials/SpecialChangeEmail.php
includes/specials/SpecialChangePassword.php
includes/specials/SpecialConfirmemail.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialListfiles.php
includes/specials/SpecialPreferences.php
includes/specials/SpecialResetTokens.php
includes/specials/SpecialSpecialpages.php
includes/specials/SpecialWatchlist.php
includes/upload/UploadFromChunks.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/benchmarks/bench_wfIsWindows.php
maintenance/dictionary/mediawiki.dic
maintenance/language/messages.inc
maintenance/language/zhtable/trad2simp_supp_unset.manual [deleted file]
maintenance/mergeMessageFileList.php
maintenance/mssql/tables.sql
maintenance/oracle/archives/patch_16_17_schema_changes.sql
maintenance/oracle/tables.sql
maintenance/purgeChangedFiles.php
maintenance/sqlite/archives/initial-indexes.sql
maintenance/tables.sql
maintenance/update.php
skins/common/images/feed-icon.svg [new file with mode: 0644]
skins/common/shared.css
tests/phpunit/data/db/sqlite/tables-1.13.sql
tests/phpunit/includes/ExceptionTest.php
tests/phpunit/includes/FallbackTest.php
tests/phpunit/includes/MWExceptionHandlerTest.php
tests/phpunit/includes/StatusTest.php
tests/phpunit/includes/UserMailerTest.php
tests/phpunit/includes/XmlJsTest.php
tests/phpunit/includes/api/ApiEditPageTest.php
tests/phpunit/includes/api/ApiOptionsTest.php
tests/phpunit/includes/api/ApiTestContext.php
tests/phpunit/includes/api/MockApi.php
tests/phpunit/includes/api/UserWrapper.php
tests/phpunit/includes/db/DatabaseMysqlBaseTest.php
tests/phpunit/includes/db/DatabaseTest.php
tests/phpunit/includes/diff/DifferenceEngineTest.php
tests/phpunit/includes/media/FakeDimensionFile.php
tests/phpunit/includes/media/FormatMetadataTest.php
tests/phpunit/includes/parser/TidyTest.php
tests/phpunit/structure/AutoLoaderTest.php
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js

index 4b6e446..72be46f 100644 (file)
@@ -167,7 +167,7 @@ abstract class Action {
        final public function getContext() {
                if ( $this->context instanceof IContextSource ) {
                        return $this->context;
-               } else if ( $this->page instanceof Article ) {
+               } elseif ( $this->page instanceof Article ) {
                        // NOTE: $this->page can be a WikiPage, which does not have a context.
                        wfDebug( __METHOD__ . ': no context known, falling back to Article\'s context.' );
                        return $this->page->getContext();
index 8faae60..fbf838c 100644 (file)
@@ -1608,7 +1608,12 @@ $wgSharedTables = array( 'user', 'user_properties' );
  *   - user:        DB user
  *   - password:    DB password
  *   - type:        "mysql" or "postgres"
- *   - load:        ratio of DB_SLAVE load, must be >=0, the sum of all loads must be >0
+ *
+ *   - load:        Ratio of DB_SLAVE load, must be >=0, the sum of all loads must be >0.
+ *                  If this is zero for any given server, no normal query traffic will be
+ *                  sent to it. It will be excluded from lag checks in maintenance scripts.
+ *                  The only way it can receive traffic is if groupLoads is used.
+ *
  *   - groupLoads:  array of load ratios, the key is the query group name. A query may belong
  *                  to several groups, the most specific group defined here is used.
  *
index 688300a..57877a2 100644 (file)
@@ -3810,7 +3810,7 @@ function wfGetNull() {
  * @param string|bool $cluster Cluster name accepted by LBFactory. Default: false.
  */
 function wfWaitForSlaves( $maxLag = false, $wiki = false, $cluster = false ) {
-       if( $cluster !== false ) {
+       if ( $cluster !== false ) {
                $lb = wfGetLBFactory()->getExternalLB( $cluster );
        } else {
                $lb = wfGetLB( $wiki );
index d260862..b60146a 100644 (file)
@@ -1034,7 +1034,7 @@ class HTMLForm extends ContextSource {
                $subsectionHtml = '';
                $hasLabel = false;
 
-               switch( $displayFormat ) {
+               switch ( $displayFormat ) {
                        case 'table':
                                $getFieldHtmlMethod = 'getTableRow';
                                break;
index d6b8a03..4ea1712 100644 (file)
@@ -415,6 +415,7 @@ class ImagePage extends Article {
                                $params['width'] = $width;
                                $params['height'] = $height;
                                $thumbnail = $this->displayImg->transform( $params );
+                               Linker::processResponsiveImages( $this->displayImg, $thumbnail, $params );
 
                                $anchorclose = Html::rawElement( 'div', array( 'class' => 'mw-filepage-resolutioninfo' ), $msgsmall );
 
index 4dcdfd5..895f0f2 100644 (file)
@@ -902,7 +902,7 @@ class Linker {
         * @param MediaOutput $thumb
         * @param array $hp image parameters
         */
-       protected static function processResponsiveImages( $file, $thumb, $hp ) {
+       public static function processResponsiveImages( $file, $thumb, $hp ) {
                global $wgResponsiveImages;
                if ( $wgResponsiveImages ) {
                        $hp15 = $hp;
index 741cce3..9fb39da 100644 (file)
@@ -595,6 +595,49 @@ class SpecialPage {
                }
        }
 
+       /**
+        * If the user is not logged in, throws UserNotLoggedIn error.
+        *
+        * Default error message includes a link to Special:Userlogin with properly set 'returnto' query
+        * parameter.
+        *
+        * @since 1.23
+        * @param string|Message $reasonMsg [optional] Passed on to UserNotLoggedIn constructor. Strings
+        *     will be used as message keys. If a string is given, the message will also receive a
+        *     formatted login link (generated using the 'loginreqlink' message) as first parameter. If a
+        *     Message is given, it will be passed on verbatim.
+        * @param string|Message $titleMsg [optional] Passed on to UserNotLoggedIn constructor. Strings
+        *     will be used as message keys.
+        * @throws UserNotLoggedIn
+        */
+       public function requireLogin( $reasonMsg = null, $titleMsg = null ) {
+               if ( $this->getUser()->isAnon() ) {
+                       // Use default messages if not given or explicit null passed
+                       if ( !$reasonMsg ) {
+                               $reasonMsg = 'exception-nologin-text-manual';
+                       }
+                       if ( !$titleMsg ) {
+                               $titleMsg = 'exception-nologin';
+                       }
+
+                       // Convert to Messages with current context
+                       if ( is_string( $reasonMsg ) ) {
+                               $loginreqlink = Linker::linkKnown(
+                                       SpecialPage::getTitleFor( 'Userlogin' ),
+                                       $this->msg( 'loginreqlink' )->escaped(),
+                                       array(),
+                                       array( 'returnto' => $this->getTitle()->getPrefixedText() )
+                               );
+                               $reasonMsg = $this->msg( $reasonMsg )->rawParams( $loginreqlink );
+                       }
+                       if ( is_string( $titleMsg ) ) {
+                               $titleMsg = $this->msg( $titleMsg );
+                       }
+
+                       throw new UserNotLoggedIn( $reasonMsg, $titleMsg );
+               }
+       }
+
        /**
         * Sets headers - this should be called from the execute() method of all derived classes!
         */
index 4b8a141..c726e9d 100644 (file)
@@ -4830,7 +4830,7 @@ class Title {
                        $langObj = wfGetLangObj( $contentHandler->getPageLanguage( $this ) );
                        $this->mPageLanguage = array( $langObj->getCode(), $wgLanguageCode );
                } else {
-                       $langObj =  wfGetLangObj( $this->mPageLanguage[0] );
+                       $langObj = wfGetLangObj( $this->mPageLanguage[0] );
                }
                wfProfileOut( __METHOD__ );
                return $langObj;
index 79a3b05..cec1ca8 100644 (file)
@@ -714,7 +714,7 @@ class ApiQuery extends ApiBase {
                        'meta' => 'Which metadata to get about the site. Module help is available below',
                        'indexpageids' => 'Include an additional pageids section listing all returned page IDs',
                        'export' => 'Export the current revisions of all given or generated pages',
-                       'exportnowrap' => 'Return the export XML without wrapping it in an '.
+                       'exportnowrap' => 'Return the export XML without wrapping it in an ' .
                                'XML result (same format as Special:Export). Can only be used with export',
                        'iwurl' => 'Whether to get the full URL if the title is an interwiki link',
                        'continue' => array(
index dcd8191..8eed1a5 100644 (file)
@@ -223,7 +223,7 @@ class BacklinkCache {
                                );
                        }
 
-                       if ( !$startId && !$endId && $res->numRows() < $max ) {
+                       if ( $select === 'all' && !$startId && !$endId && $res->numRows() < $max ) {
                                // The full results fit within the limit, so cache them
                                $this->fullResultCache[$table] = $res;
                        } else {
index 987ad3f..f4a2fa6 100644 (file)
@@ -52,15 +52,15 @@ class RedisConnectionPool {
        protected $serializer;
        /** @} */
 
-       /** @var integer Current idle pool size */
+       /** @var int Current idle pool size */
        protected $idlePoolSize = 0;
 
-       /** @var Array (server name => ((connection info array),...) */
+       /** @var array (server name => ((connection info array),...) */
        protected $connections = array();
-       /** @var Array (server name => UNIX timestamp) */
+       /** @var array (server name => UNIX timestamp) */
        protected $downServers = array();
 
-       /** @var Array (pool ID => RedisConnectionPool) */
+       /** @var array (pool ID => RedisConnectionPool) */
        protected static $instances = array();
 
        /** integer; seconds to cache servers as "down". */
@@ -68,6 +68,7 @@ class RedisConnectionPool {
 
        /**
         * @param array $options
+        * @throws MWException
         */
        protected function __construct( array $options ) {
                if ( !class_exists( 'Redis' ) ) {
@@ -89,8 +90,8 @@ class RedisConnectionPool {
        }
 
        /**
-        * @param $options Array
-        * @return Array
+        * @param array $options
+        * @return array
         */
        protected static function applyDefaultConfig( array $options ) {
                if ( !isset( $options['connectTimeout'] ) ) {
@@ -107,7 +108,7 @@ class RedisConnectionPool {
        }
 
        /**
-        * @param $options Array
+        * @param array $options
         * $options include:
         *   - connectTimeout : The timeout for new connections, in seconds.
         *                      Optional, default is 1 second.
@@ -227,9 +228,9 @@ class RedisConnectionPool {
        /**
         * Mark a connection to a server as free to return to the pool
         *
-        * @param $server string
-        * @param $conn Redis
-        * @return boolean
+        * @param string $server
+        * @param Redis $conn
+        * @return bool
         */
        public function freeConnection( $server, Redis $conn ) {
                $found = false;
@@ -249,15 +250,13 @@ class RedisConnectionPool {
 
        /**
         * Close any extra idle connections if there are more than the limit
-        *
-        * @return void
         */
        protected function closeExcessIdleConections() {
                if ( $this->idlePoolSize <= count( $this->connections ) ) {
                        return; // nothing to do (no more connections than servers)
                }
 
-               foreach ( $this->connections as $server => &$serverConnections ) {
+               foreach ( $this->connections as &$serverConnections ) {
                        foreach ( $serverConnections as $key => &$connection ) {
                                if ( $connection['free'] ) {
                                        unset( $serverConnections[$key] );
@@ -275,10 +274,9 @@ class RedisConnectionPool {
         * not. The safest response for us is to explicitly destroy the connection
         * object and let it be reopened during the next request.
         *
-        * @param $server string
-        * @param $cref RedisConnRef
-        * @param $e RedisException
-        * @return void
+        * @param string $server
+        * @param RedisConnRef $cref
+        * @param RedisException $e
         */
        public function handleException( $server, RedisConnRef $cref, RedisException $e ) {
                wfDebugLog( 'redis', "Redis exception on server $server: " . $e->getMessage() . "\n" );
@@ -338,9 +336,9 @@ class RedisConnRef {
        protected $lastError; // string
 
        /**
-        * @param $pool RedisConnectionPool
-        * @param $server string
-        * @param $conn Redis
+        * @param RedisConnectionPool $pool
+        * @param string $server
+        * @param Redis $conn
         */
        public function __construct( RedisConnectionPool $pool, $server, Redis $conn ) {
                $this->pool = $pool;
@@ -423,7 +421,7 @@ class RedisConnRef {
        }
 
        /**
-        * @param RedisConnRef $conn
+        * @param Redis $conn
         * @return bool
         */
        public function isConnIdentical( Redis $conn ) {
index 137efb8..e1b1f01 100644 (file)
@@ -32,7 +32,6 @@
  * @ingroup Content
  */
 abstract class AbstractContent implements Content {
-
        /**
         * Name of the content model this Content object represents.
         * Use with CONTENT_MODEL_XXX constants
@@ -264,7 +263,7 @@ abstract class AbstractContent implements Content {
                                break;
                        }
                        // Redirects to some special pages are not permitted
-                       if ( $newtitle instanceOf Title && $newtitle->isValidRedirectTarget() ) {
+                       if ( $newtitle instanceof Title && $newtitle->isValidRedirectTarget() ) {
                                // The new title passes the checks, so make that our current
                                // title so that further recursion can be checked
                                $title = $newtitle;
@@ -273,6 +272,7 @@ abstract class AbstractContent implements Content {
                                break;
                        }
                }
+
                return $titles;
        }
 
@@ -293,6 +293,7 @@ abstract class AbstractContent implements Content {
         */
        public function getUltimateRedirectTarget() {
                $titles = $this->getRedirectChain();
+
                return $titles ? array_pop( $titles ) : null;
        }
 
@@ -394,15 +395,16 @@ abstract class AbstractContent implements Content {
         *    database after deletion.
         */
        public function getDeletionUpdates( WikiPage $page,
-               ParserOutput $parserOutput = null )
-       {
+               ParserOutput $parserOutput = null
+       {
                return array(
                        new LinksDeletionUpdate( $page ),
                );
        }
 
        /**
-        * This default implementation always returns false. Subclasses may override this to supply matching logic.
+        * This default implementation always returns false. Subclasses may override
+        * this to supply matching logic.
         *
         * @see Content::matchMagicWord
         *
@@ -422,8 +424,8 @@ abstract class AbstractContent implements Content {
         * This base implementation calls the hook ConvertContent to enable custom conversions.
         * Subclasses may override this to implement conversion for "their" content model.
         *
-        * @param string  $toModel the desired content model, use the CONTENT_MODEL_XXX flags.
-        * @param string  $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is
+        * @param string $toModel the desired content model, use the CONTENT_MODEL_XXX flags.
+        * @param string $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is
         * not allowed, full round-trip conversion is expected to work without losing information.
         *
         * @return Content|bool A content object with the content model $toModel, or false if
@@ -439,6 +441,7 @@ abstract class AbstractContent implements Content {
                $result = false;
 
                wfRunHooks( 'ConvertContent', array( $this, $toModel, $lossy, &$result ) );
+
                return $result;
        }
 }
index 5a90e09..da49ced 100644 (file)
@@ -32,7 +32,6 @@
  * @ingroup Content
  */
 interface Content {
-
        /**
         * @since 1.21
         *
@@ -267,6 +266,7 @@ interface Content {
        public function getParserOutput( Title $title,
                $revId = null,
                ParserOptions $options = null, $generateHtml = true );
+
        // TODO: make RenderOutput and RenderOptions base classes
 
        /**
@@ -362,7 +362,8 @@ interface Content {
         *
         * @param Title $target the new redirect target
         *
-        * @return Content a new Content object with the updated redirect (or $this if this Content object isn't a redirect)
+        * @return Content a new Content object with the updated redirect (or $this
+        *   if this Content object isn't a redirect)
         */
        public function updateRedirect( Title $target );
 
@@ -437,22 +438,22 @@ interface Content {
         * This may be used to check the content's consistency with global state. This function should
         * NOT write any information to the database.
         *
-        * Note that this method will usually be called inside the same transaction bracket that will be used
-        * to save the new revision.
+        * Note that this method will usually be called inside the same transaction
+        * bracket that will be used to save the new revision.
         *
-        * Note that this method is called before any update to the page table is performed. This means that
-        * $page may not yet know a page ID.
+        * Note that this method is called before any update to the page table is
+        * performed. This means that $page may not yet know a page ID.
         *
         * @since 1.21
         *
         * @param WikiPage $page The page to be saved.
-        * @param int      $flags bitfield for use with EDIT_XXX constants, see WikiPage::doEditContent()
-        * @param int      $baseRevId the ID of the current revision
-        * @param User     $user
+        * @param int $flags bitfield for use with EDIT_XXX constants, see WikiPage::doEditContent()
+        * @param int $baseRevId the ID of the current revision
+        * @param User $user
         *
-        * @return Status A status object indicating whether the content was successfully prepared for saving.
-        *                If the returned status indicates an error, a rollback will be performed and the
-        *                transaction aborted.
+        * @return Status A status object indicating whether the content was
+        *   successfully prepared for saving. If the returned status indicates
+        *   an error, a rollback will be performed and the transaction aborted.
         *
         * @see see WikiPage::doEditContent()
         */
@@ -491,17 +492,16 @@ interface Content {
         * Converts this content object into another content object with the given content model,
         * if that is possible.
         *
-        * @param string  $toModel the desired content model, use the CONTENT_MODEL_XXX flags.
-        * @param string  $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is
+        * @param string $toModel the desired content model, use the CONTENT_MODEL_XXX flags.
+        * @param string $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is
         * not allowed, full round-trip conversion is expected to work without losing information.
         *
         * @return Content|bool A content object with the content model $toModel, or false if
         * that conversion is not supported.
         */
        public function convert( $toModel, $lossy = '' );
-
-               // TODO: ImagePage and CategoryPage interfere with per-content action handlers
-       // TODO: nice&sane integration of GeSHi syntax highlighting
+       // @todo ImagePage and CategoryPage interfere with per-content action handlers
+       // @todo nice&sane integration of GeSHi syntax highlighting
        //   [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a
        //   config to set the class which handles syntax highlighting
        //   [12:00] <vvv> And default it to a DummyHighlighter
index ede4306..1abe1fa 100644 (file)
@@ -31,7 +31,6 @@
  * @ingroup Content
  */
 class MWContentSerializationException extends MWException {
-
 }
 
 /**
@@ -54,7 +53,6 @@ class MWContentSerializationException extends MWException {
  * @ingroup Content
  */
 abstract class ContentHandler {
-
        /**
         * Switch for enabling deprecation warnings. Used by ContentHandler::deprecated()
         * and ContentHandler::runLegacyHooks().
@@ -145,8 +143,8 @@ abstract class ContentHandler {
         *    not be unserialized using $format.
         */
        public static function makeContent( $text, Title $title = null,
-               $modelId = null, $format = null )
-       {
+               $modelId = null, $format = null
+       {
                if ( is_null( $modelId ) ) {
                        if ( is_null( $title ) ) {
                                throw new MWException( "Must provide a Title object or a content model ID." );
@@ -156,6 +154,7 @@ abstract class ContentHandler {
                }
 
                $handler = ContentHandler::getForModelID( $modelId );
+
                return $handler->unserializeContent( $text, $format );
        }
 
@@ -259,6 +258,7 @@ abstract class ContentHandler {
         */
        public static function getForTitle( Title $title ) {
                $modelId = $title->getContentModel();
+
                return ContentHandler::getForModelID( $modelId );
        }
 
@@ -273,13 +273,14 @@ abstract class ContentHandler {
         */
        public static function getForContent( Content $content ) {
                $modelId = $content->getModel();
+
                return ContentHandler::getForModelID( $modelId );
        }
 
        /**
-        * @var Array A Cache of ContentHandler instances by model id
+        * @var array A Cache of ContentHandler instances by model id
         */
-       static $handlers;
+       protected static $handlers;
 
        /**
         * Returns the ContentHandler singleton for the given model ID. Use the
@@ -330,14 +331,16 @@ abstract class ContentHandler {
                        $handler = new $class( $modelId );
 
                        if ( !( $handler instanceof ContentHandler ) ) {
-                               throw new MWException( "$class from \$wgContentHandlers is not compatible with ContentHandler" );
+                               throw new MWException( "$class from \$wgContentHandlers is not " .
+                                       "compatible with ContentHandler" );
                        }
                }
 
                wfDebugLog( 'ContentHandler', 'Created handler for ' . $modelId
-                                       . ': ' . get_class( $handler ) );
+                       . ': ' . get_class( $handler ) );
 
                ContentHandler::$handlers[$modelId] = $handler;
+
                return ContentHandler::$handlers[$modelId];
        }
 
@@ -380,6 +383,7 @@ abstract class ContentHandler {
                }
 
                $formats = array_unique( $formats );
+
                return $formats;
        }
 
@@ -598,16 +602,18 @@ abstract class ContentHandler {
        /**
         * Get the language in which the content of the given page is written.
         *
-        * This default implementation just returns $wgContLang (except for pages in the MediaWiki namespace)
+        * This default implementation just returns $wgContLang (except for pages
+        * in the MediaWiki namespace)
         *
-        * Note that the pages language is not cacheable, since it may in some cases depend on user settings.
+        * Note that the pages language is not cacheable, since it may in some
+        * cases depend on user settings.
         *
         * Also note that the page language may or may not depend on the actual content of the page,
         * that is, this method may load the content in order to determine the language.
         *
         * @since 1.21
         *
-        * @param Title        $title the page to determine the language for.
+        * @param Title $title the page to determine the language for.
         * @param Content|null $content the page's content, if you have it handy, to avoid reloading it.
         *
         * @return Language the page's language
@@ -623,6 +629,7 @@ abstract class ContentHandler {
                }
 
                wfRunHooks( 'PageContentLanguage', array( $title, &$pageLang, $wgLang ) );
+
                return wfGetLangObj( $pageLang );
        }
 
@@ -641,7 +648,7 @@ abstract class ContentHandler {
         *
         * @since 1.21
         *
-        * @param Title        $title the page to determine the language for.
+        * @param Title $title the page to determine the language for.
         * @param Content|null $content the page's content, if you have it handy, to avoid reloading it.
         *
         * @return Language the page's language for viewing
@@ -735,15 +742,15 @@ abstract class ContentHandler {
                if ( is_object( $rt ) ) {
                        if ( !is_object( $ot )
                                || !$rt->equals( $ot )
-                               || $ot->getFragment() != $rt->getFragment() )
-                       {
+                               || $ot->getFragment() != $rt->getFragment()
+                       {
                                $truncatedtext = $newContent->getTextForSummary(
                                        250
-                                               - strlen( wfMessage( 'autoredircomment' )->inContentLanguage()->text() )
-                                               - strlen( $rt->getFullText() ) );
+                                       - strlen( wfMessage( 'autoredircomment' )->inContentLanguage()->text() )
+                                       - strlen( $rt->getFullText() ) );
 
                                return wfMessage( 'autoredircomment', $rt->getFullText() )
-                                               ->rawParams( $truncatedtext )->inContentLanguage()->text();
+                                       ->rawParams( $truncatedtext )->inContentLanguage()->text();
                        }
                }
 
@@ -756,7 +763,7 @@ abstract class ContentHandler {
                                200 - strlen( wfMessage( 'autosumm-new' )->inContentLanguage()->text() ) );
 
                        return wfMessage( 'autosumm-new' )->rawParams( $truncatedtext )
-                                       ->inContentLanguage()->text();
+                               ->inContentLanguage()->text();
                }
 
                // Blanking auto-summaries
@@ -764,15 +771,15 @@ abstract class ContentHandler {
                        return wfMessage( 'autosumm-blank' )->inContentLanguage()->text();
                } elseif ( !empty( $oldContent )
                        && $oldContent->getSize() > 10 * $newContent->getSize()
-                       && $newContent->getSize() < 500 )
-               {
+                       && $newContent->getSize() < 500
+               {
                        // Removing more than 90% of the article
 
                        $truncatedtext = $newContent->getTextForSummary(
                                200 - strlen( wfMessage( 'autosumm-replace' )->inContentLanguage()->text() ) );
 
                        return wfMessage( 'autosumm-replace' )->rawParams( $truncatedtext )
-                                       ->inContentLanguage()->text();
+                               ->inContentLanguage()->text();
                }
 
                // If we reach this point, there's no applicable auto-summary for our
@@ -1004,11 +1011,11 @@ abstract class ContentHandler {
         * Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if
         * self::$enableDeprecationWarnings is set to true.
         *
-        * @param string      $func The name of the deprecated function
-        * @param string      $version The version since the method is deprecated. Usually 1.21
-        *                    for ContentHandler related stuff.
-        * @param string|bool $component: Component to which the function belongs.
-        *                                If false, it is assumed the function is in MediaWiki core.
+        * @param string $func The name of the deprecated function
+        * @param string $version The version since the method is deprecated. Usually 1.21
+        *   for ContentHandler related stuff.
+        * @param string|bool $component : Component to which the function belongs.
+        *   If false, it is assumed the function is in MediaWiki core.
         *
         * @see ContentHandler::$enableDeprecationWarnings
         * @see wfDeprecated
@@ -1037,7 +1044,8 @@ abstract class ContentHandler {
         * @see ContentHandler::$enableDeprecationWarnings
         */
        public static function runLegacyHooks( $event, $args = array(),
-                       $warn = null ) {
+               $warn = null
+       ) {
 
                if ( $warn === null ) {
                        $warn = self::$enableDeprecationWarnings;
@@ -1079,7 +1087,8 @@ abstract class ContentHandler {
 
                        wfRestoreWarnings();
 
-                       wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " . implode( ', ', $handlerInfo ), 2 );
+                       wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " .
+                               implode( ', ', $handlerInfo ), 2 );
                }
 
                // convert Content objects to text
index cb5a349..7becabb 100644 (file)
@@ -28,7 +28,6 @@
  * @ingroup Content
  */
 class CssContentHandler extends TextContentHandler {
-
        public function __construct( $modelId = CONTENT_MODEL_CSS ) {
                parent::__construct( $modelId, array( CONTENT_FORMAT_CSS ) );
        }
@@ -46,6 +45,8 @@ class CssContentHandler extends TextContentHandler {
        /**
         * Returns the english language, because CSS is english, and should be handled as such.
         *
+        * @param Title $title
+        * @param Content $content
         * @return Language wfGetLangObj( 'en' )
         *
         * @see ContentHandler::getPageLanguage()
@@ -57,6 +58,8 @@ class CssContentHandler extends TextContentHandler {
        /**
         * Returns the english language, because CSS is english, and should be handled as such.
         *
+        * @param Title $title
+        * @param Content $content
         * @return Language wfGetLangObj( 'en' )
         *
         * @see ContentHandler::getPageViewLanguage()
index 33fa917..064c422 100644 (file)
@@ -28,7 +28,6 @@
  * @todo make ScriptContentHandler base class, do highlighting stuff there?
  */
 class JavaScriptContentHandler extends TextContentHandler {
-
        public function __construct( $modelId = CONTENT_MODEL_JAVASCRIPT ) {
                parent::__construct( $modelId, array( CONTENT_FORMAT_JAVASCRIPT ) );
        }
@@ -46,6 +45,8 @@ class JavaScriptContentHandler extends TextContentHandler {
        /**
         * Returns the english language, because JS is english, and should be handled as such.
         *
+        * @param Title $title
+        * @param Content $content
         * @return Language wfGetLangObj( 'en' )
         *
         * @see ContentHandler::getPageLanguage()
@@ -57,6 +58,8 @@ class JavaScriptContentHandler extends TextContentHandler {
        /**
         * Returns the english language, because JS is english, and should be handled as such.
         *
+        * @param Title $title
+        * @param Content $content
         * @return Language wfGetLangObj( 'en' )
         *
         * @see ContentHandler::getPageViewLanguage()
index b36b670..e780846 100644 (file)
  * @ingroup Content
  */
 class MessageContent extends AbstractContent {
-
        /**
         * @var Message
         */
        protected $mMessage;
 
        /**
-        * @param Message|String $msg    A Message object, or a message key
-        * @param array|null     $params An optional array of message parameters
+        * @param Message|String $msg A Message object, or a message key
+        * @param array|null $params An optional array of message parameters
         */
        public function __construct( $msg, $params = null ) {
                # XXX: messages may be wikitext, html or plain text! and maybe even something else entirely.
@@ -130,6 +129,7 @@ class MessageContent extends AbstractContent {
        /**
         * @see Content::isCountable
         *
+        * @param bool $hasLinks
         * @return bool false
         */
        public function isCountable( $hasLinks = null ) {
@@ -139,6 +139,10 @@ class MessageContent extends AbstractContent {
        /**
         * @see Content::getParserOutput
         *
+        * @param Title $title
+        * @param int $revId Optional revision ID
+        * @param ParserOptions $options
+        * @param bool $generateHtml Wether to generate HTML
         * @return ParserOutput
         */
        public function getParserOutput(
@@ -153,6 +157,7 @@ class MessageContent extends AbstractContent {
                }
 
                $po = new ParserOutput( $html );
+
                return $po;
        }
 }
index 87ebc9f..d03d61e 100644 (file)
  * @ingroup Content
  */
 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." );
+                               . "This may indicate an error in the caller's scope." );
 
                        $text = '';
                }
@@ -74,6 +73,7 @@ class TextContent extends AbstractContent {
         */
        public function getSize() {
                $text = $this->getNativeData();
+
                return strlen( $text );
        }
 
@@ -107,6 +107,7 @@ class TextContent extends AbstractContent {
         */
        public function getNativeData() {
                $text = $this->mText;
+
                return $text;
        }
 
@@ -185,6 +186,7 @@ class TextContent extends AbstractContent {
                $nta = explode( "\n", $lang->segmentForDiff( $ntext ) );
 
                $diff = new Diff( $ota, $nta );
+
                return $diff;
        }
 
@@ -224,6 +226,7 @@ class TextContent extends AbstractContent {
                }
 
                $po->setText( $html );
+
                return $po;
        }
 
@@ -259,8 +262,8 @@ class TextContent extends AbstractContent {
         * This implementation provides lossless conversion between content models based
         * on TextContent.
         *
-        * @param string  $toModel the desired content model, use the CONTENT_MODEL_XXX flags.
-        * @param string  $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is
+        * @param string $toModel the desired content model, use the CONTENT_MODEL_XXX flags.
+        * @param string $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is
         * not allowed, full round-trip conversion is expected to work without losing information.
         *
         * @return Content|bool A content object with the content model $toModel, or false if
index e7f41e1..c4584ae 100644 (file)
@@ -29,8 +29,9 @@
  * @ingroup Content
  */
 class TextContentHandler extends ContentHandler {
-
-       public function __construct( $modelId = CONTENT_MODEL_TEXT, $formats = array( CONTENT_FORMAT_TEXT ) ) {
+       public function __construct( $modelId = CONTENT_MODEL_TEXT,
+               $formats = array( CONTENT_FORMAT_TEXT )
+       ) {
                parent::__construct( $modelId, $formats );
        }
 
@@ -43,6 +44,7 @@ class TextContentHandler extends ContentHandler {
         */
        public function serializeContent( Content $content, $format = null ) {
                $this->checkFormat( $format );
+
                return $content->getNativeData();
        }
 
@@ -83,6 +85,7 @@ class TextContentHandler extends ContentHandler {
                }
 
                $mergedContent = $this->unserializeContent( $result, $format );
+
                return $mergedContent;
        }
 
index 26337db..1f96bdc 100644 (file)
@@ -31,7 +31,6 @@
  * @ingroup Content
  */
 class WikitextContent extends TextContent {
-
        public function __construct( $text ) {
                parent::__construct( $text, CONTENT_MODEL_WIKITEXT );
        }
@@ -73,11 +72,14 @@ class WikitextContent extends TextContent {
 
                if ( $section === '' ) {
                        wfProfileOut( __METHOD__ );
+
                        return $with; # XXX: copy first?
-               } if ( $section == 'new' ) {
+               }
+
+               if ( $section == 'new' ) {
                        # Inserting a new section
                        $subject = $sectionTitle ? wfMessage( 'newsectionheaderdefaultlevel' )
-                               ->rawParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : '';
+                                       ->rawParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : '';
                        if ( wfRunHooks( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) {
                                $text = strlen( trim( $oldtext ) ) > 0
                                        ? "{$oldtext}\n\n{$subject}{$text}"
@@ -93,6 +95,7 @@ class WikitextContent extends TextContent {
                $newContent = new WikitextContent( $text );
 
                wfProfileOut( __METHOD__ );
+
                return $newContent;
        }
 
@@ -183,14 +186,16 @@ class WikitextContent extends TextContent {
                                if ( !$title instanceof Title || !$title->isValidRedirectTarget() ) {
                                        return null;
                                }
+
                                return $title;
                        }
                }
+
                return null;
        }
 
        /**
-        * @see   Content::updateRedirect()
+        * @see Content::updateRedirect()
         *
         * This implementation replaces the first link on the page with the given new target
         * if this Content object is a redirect. Otherwise, this method returns $this.
@@ -199,7 +204,8 @@ class WikitextContent extends TextContent {
         *
         * @param Title $target
         *
-        * @return Content a new Content object with the updated redirect (or $this if this Content object isn't a redirect)
+        * @return Content a new Content object with the updated redirect (or $this
+        *   if this Content object isn't a redirect)
         */
        public function updateRedirect( Title $target ) {
                if ( !$this->isRedirect() ) {
@@ -220,7 +226,7 @@ class WikitextContent extends TextContent {
         * Returns true if this content is not a redirect, and this content's text
         * is countable according to the criteria defined by $wgArticleCountMethod.
         *
-        * @param bool $hasLinks  if it is known whether this content contains
+        * @param bool $hasLinks if it is known whether this content contains
         *    links, provide this information here, to avoid redundant parsing to
         *    find out (default: null).
         * @param $title Title: (default: null)
@@ -298,6 +304,7 @@ class WikitextContent extends TextContent {
                }
 
                $po = $wgParser->parse( $this->getNativeData(), $title, $options, true, true, $revId );
+
                return $po;
        }
 
index b1b461f..1e8fd05 100644 (file)
@@ -29,7 +29,6 @@
  * @ingroup Content
  */
 class WikitextContentHandler extends TextContentHandler {
-
        public function __construct( $modelId = CONTENT_MODEL_WIKITEXT ) {
                parent::__construct( $modelId, array( CONTENT_FORMAT_WIKITEXT ) );
        }
@@ -72,7 +71,9 @@ class WikitextContentHandler extends TextContentHandler {
                }
 
                $mwRedir = MagicWord::get( 'redirect' );
-               $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $optionalColon . $destination->getFullText() . ']]';
+               $redirectText = $mwRedir->getSynonym( 0 ) .
+                       ' [[' . $optionalColon . $destination->getFullText() . ']]';
+
                if ( $text != '' ) {
                        $redirectText .= "\n" . $text;
                }
index e13cfa8..0a3f18f 100644 (file)
@@ -41,9 +41,11 @@ abstract class ContextSource implements IContextSource {
        public function getContext() {
                if ( $this->context === null ) {
                        $class = get_class( $this );
-                       wfDebug( __METHOD__ . " ($class): called and \$context is null. Using RequestContext::getMain() for sanity\n" );
+                       wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
+                               "Using RequestContext::getMain() for sanity\n" );
                        $this->context = RequestContext::getMain();
                }
+
                return $this->context;
        }
 
@@ -130,6 +132,7 @@ abstract class ContextSource implements IContextSource {
         */
        public function getLang() {
                wfDeprecated( __METHOD__, '1.19' );
+
                return $this->getLanguage();
        }
 
@@ -162,6 +165,7 @@ abstract class ContextSource implements IContextSource {
         */
        public function msg( /* $args */ ) {
                $args = func_get_args();
+
                return call_user_func_array( array( $this->getContext(), 'msg' ), $args );
        }
 
index fd9bf96..e96269d 100644 (file)
@@ -99,6 +99,7 @@ class DerivativeContext extends ContextSource {
         * Set the Title object
         *
         * @param Title $t
+        * @throws MWException
         */
        public function setTitle( $t ) {
                if ( $t !== null && !$t instanceof Title ) {
@@ -298,6 +299,7 @@ class DerivativeContext extends ContextSource {
         */
        public function msg() {
                $args = func_get_args();
+
                return call_user_func_array( 'wfMessage', $args )->setContext( $this );
        }
 }
index 01ec57c..04879e2 100644 (file)
@@ -82,6 +82,7 @@ class RequestContext implements IContextSource {
                        global $wgRequest; # fallback to $wg till we can improve this
                        $this->request = $wgRequest;
                }
+
                return $this->request;
        }
 
@@ -89,6 +90,7 @@ class RequestContext implements IContextSource {
         * Set the Title object
         *
         * @param Title $t
+        * @throws MWException
         */
        public function setTitle( $t ) {
                if ( $t !== null && !$t instanceof Title ) {
@@ -109,6 +111,7 @@ class RequestContext implements IContextSource {
                        global $wgTitle; # fallback to $wg till we can improve this
                        $this->title = $wgTitle;
                }
+
                return $this->title;
        }
 
@@ -169,6 +172,7 @@ class RequestContext implements IContextSource {
                        }
                        $this->wikipage = WikiPage::factory( $title );
                }
+
                return $this->wikipage;
        }
 
@@ -188,6 +192,7 @@ class RequestContext implements IContextSource {
                if ( $this->output === null ) {
                        $this->output = new OutputPage( $this );
                }
+
                return $this->output;
        }
 
@@ -209,6 +214,7 @@ class RequestContext implements IContextSource {
                if ( $this->user === null ) {
                        $this->user = User::newFromSession( $this->getRequest() );
                }
+
                return $this->user;
        }
 
@@ -269,6 +275,7 @@ class RequestContext implements IContextSource {
         */
        public function getLang() {
                wfDeprecated( __METHOD__, '1.19' );
+
                return $this->getLanguage();
        }
 
@@ -364,6 +371,7 @@ class RequestContext implements IContextSource {
                        $this->skin->setContext( $this );
                        wfProfileOut( __METHOD__ . '-createskin' );
                }
+
                return $this->skin;
        }
 
@@ -377,6 +385,7 @@ class RequestContext implements IContextSource {
         */
        public function msg() {
                $args = func_get_args();
+
                return call_user_func_array( 'wfMessage', $args )->setContext( $this );
        }
 
@@ -392,6 +401,7 @@ class RequestContext implements IContextSource {
                if ( $instance === null ) {
                        $instance = new self;
                }
+
                return $instance;
        }
 
@@ -446,7 +456,7 @@ class RequestContext implements IContextSource {
                        $user = User::newFromName( $params['ip'], false );
                }
 
-               $importSessionFunction = function( User $user, array $params ) {
+               $importSessionFunction = function ( User $user, array $params ) {
                        global $wgRequest, $wgUser;
 
                        $context = RequestContext::getMain();
@@ -482,7 +492,7 @@ class RequestContext implements IContextSource {
                $importSessionFunction( $user, $params );
 
                // Set callback to save and close the new session and reload the old one
-               return new ScopedCallback( function() use ( $importSessionFunction, $oUser, $oParams ) {
+               return new ScopedCallback( function () use ( $importSessionFunction, $oUser, $oParams ) {
                        $importSessionFunction( $oUser, $oParams );
                } );
        }
@@ -510,6 +520,7 @@ class RequestContext implements IContextSource {
                        $context->setRequest( new FauxRequest( $request ) );
                }
                $context->user = User::newFromName( '127.0.0.1', false );
+
                return $context;
        }
 }
index 6c009de..a9f7b7f 100644 (file)
@@ -28,7 +28,6 @@
  * @author Daniel Kinzler
  */
 abstract class DBAccessBase implements IDBAccessObject {
-
        /**
         * @var String|bool $wiki The target wiki's name. This must be an ID
         * that LBFactory can understand.
@@ -58,6 +57,7 @@ abstract class DBAccessBase implements IDBAccessObject {
         */
        protected function getConnection( $id, $groups = array() ) {
                $loadBalancer = wfGetLB( $this->wiki );
+
                return $loadBalancer->getConnection( $id, $groups, $this->wiki );
        }
 
@@ -68,7 +68,7 @@ abstract class DBAccessBase implements IDBAccessObject {
         *
         * @since 1.21
         *
-        * @param DatabaseBase  $db the database connection to release.
+        * @param DatabaseBase $db the database connection to release.
         */
        protected function releaseConnection( DatabaseBase $db ) {
                if ( $this->wiki !== false ) {
index 5be460f..6a3ebcb 100644 (file)
@@ -480,7 +480,7 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
        public function addIdentifierQuotes( $s ) {
                // Characters in the range \u0001-\uFFFF are valid in a quoted identifier
                // Remove NUL bytes and escape backticks by doubling
-               return '`' . str_replace( array( "\0", '`' ), array( '', '``' ), $s )  . '`';
+               return '`' . str_replace( array( "\0", '`' ), array( '', '``' ), $s ) . '`';
        }
 
        /**
@@ -1024,12 +1024,12 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                        // Query for the VIEWS
                        $result = $this->query( 'SHOW FULL TABLES WHERE TABLE_TYPE = "VIEW"' );
                        $this->allViews = array();
-                       while ( ($row = $this->fetchRow($result)) !== false ) {
+                       while ( ( $row = $this->fetchRow( $result ) ) !== false ) {
                                array_push( $this->allViews, $row[$propertyName] );
                        }
                }
 
-               if ( is_null($prefix) || $prefix === '' ) {
+               if ( is_null( $prefix ) || $prefix === '' ) {
                        return $this->allViews;
                }
 
index 5b2e11d..a47c804 100644 (file)
@@ -187,7 +187,7 @@ class DatabaseMysqli extends DatabaseMysqlBase {
        }
 
        protected function mysqlError( $conn = null ) {
-               if ($conn === null) {
+               if ( $conn === null ) {
                        return mysqli_connect_error();
                } else {
                        return $conn->error;
index 857109d..011c083 100644 (file)
@@ -373,7 +373,9 @@ class LoadBalancer {
                wfProfileIn( __METHOD__ );
                $this->mWaitForPos = $pos;
                for ( $i = 1; $i < count( $this->mServers ); $i++ ) {
-                       $this->doWait( $i, true );
+                       if ( $this->mLoads[$i] > 0 ) {
+                               $this->doWait( $i, true );
+                       }
                }
                wfProfileOut( __METHOD__ );
        }
index fe769be..b609f43 100644 (file)
@@ -539,7 +539,7 @@ class LocalFile extends File {
                                'img_media_type' => $this->media_type,
                                'img_major_mime' => $major,
                                'img_minor_mime' => $minor,
-                               'img_metadata' => $dbw->encodeBlob($this->metadata),
+                               'img_metadata' => $dbw->encodeBlob( $this->metadata ),
                                'img_sha1' => $this->sha1,
                        ),
                        array( 'img_name' => $this->getName() ),
@@ -1225,7 +1225,7 @@ class LocalFile extends File {
                                'img_description' => $comment,
                                'img_user' => $user->getId(),
                                'img_user_text' => $user->getName(),
-                               'img_metadata' => $dbw->encodeBlob($this->metadata),
+                               'img_metadata' => $dbw->encodeBlob( $this->metadata ),
                                'img_sha1' => $this->sha1
                        ),
                        __METHOD__,
@@ -1276,7 +1276,7 @@ class LocalFile extends File {
                                        'img_description' => $comment,
                                        'img_user'        => $user->getId(),
                                        'img_user_text'   => $user->getName(),
-                                       'img_metadata'    => $dbw->encodeBlob($this->metadata),
+                                       'img_metadata'    => $dbw->encodeBlob( $this->metadata ),
                                        'img_sha1'        => $this->sha1
                                ),
                                array( 'img_name' => $this->getName() ),
index 41cbf50..3f2e2cb 100644 (file)
@@ -1045,7 +1045,7 @@ abstract class DatabaseUpdater {
        protected function disableContentHandlerUseDB() {
                global $wgContentHandlerUseDB;
 
-               if( $wgContentHandlerUseDB ) {
+               if ( $wgContentHandlerUseDB ) {
                        $this->output( "Turning off Content Handler DB fields for this part of upgrade.\n" );
                        $this->holdContentHandlerUseDB = $wgContentHandlerUseDB;
                        $wgContentHandlerUseDB = false;
@@ -1058,7 +1058,7 @@ abstract class DatabaseUpdater {
        protected function enableContentHandlerUseDB() {
                global $wgContentHandlerUseDB;
 
-               if( $this->holdContentHandlerUseDB ) {
+               if ( $this->holdContentHandlerUseDB ) {
                        $this->output( "Content Handler DB fields should be usable now.\n" );
                        $wgContentHandlerUseDB = $this->holdContentHandlerUseDB;
                }
index 91c4c9a..1b1841c 100644 (file)
@@ -977,7 +977,7 @@ class FormatMetadata extends ContextSource {
                                        $defaultItem = $vals['x-default'];
                                        unset( $vals['x-default'] );
                                }
-                               foreach( $priorityLanguages as $pLang ) {
+                               foreach ( $priorityLanguages as $pLang ) {
                                        if ( isset( $vals[$pLang] ) ) {
                                                $isDefault = false;
                                                if ( $vals[$pLang] === $defaultItem ) {
@@ -1506,7 +1506,7 @@ class FormatMetadata extends ContextSource {
                        // This is an API-specific function so it would be cleaner to call it from
                        // outside fetchExtendedMetadata, but this way we don't need to redo the
                        // computation on a cache hit.
-                       $this->sanitizeArrayForXml($extendedMetadata);
+                       $this->sanitizeArrayForXml( $extendedMetadata );
                        $valueToCache = array( 'data' => $extendedMetadata, 'timestamp' => wfTimestampNow() );
                        $wgMemc->set( $cacheKey, $valueToCache, $maxCacheTime );
                }
@@ -1628,7 +1628,7 @@ class FormatMetadata extends ContextSource {
 
                // choose the language best matching user or site settings
                $priorityLanguages = $this->getPriorityLanguages();
-               foreach( $priorityLanguages as $lang ) {
+               foreach ( $priorityLanguages as $lang ) {
                        if ( isset( $value[$lang] ) ) {
                                return $value[$lang];
                        }
@@ -1640,9 +1640,9 @@ class FormatMetadata extends ContextSource {
                }
 
                // otherwise just return any one language
-               unset($value['_type']);
-               if (!empty($value)) {
-                       return reset($value);
+               unset( $value['_type'] );
+               if ( !empty( $value ) ) {
+                       return reset( $value );
                }
 
                // this should not happen; signal error
index 502f0fd..2950227 100644 (file)
@@ -83,7 +83,7 @@ class ParserOutput extends CacheTime {
                        $text = str_replace( array( Parser::TOC_START, Parser::TOC_END ), '', $text );
                } else {
                        $text = preg_replace(
-                               '#'. preg_quote( Parser::TOC_START ) . '.*?' . preg_quote( Parser::TOC_END ) . '#s',
+                               '#' . preg_quote( Parser::TOC_START ) . '.*?' . preg_quote( Parser::TOC_END ) . '#s',
                                '',
                                $text
                        );
index 7b85001..8183999 100644 (file)
@@ -585,7 +585,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         */
        public function getAllStyleFiles() {
                $files = array();
-               foreach( (array)$this->styles as $key => $value ) {
+               foreach ( (array)$this->styles as $key => $value ) {
                        if ( is_array( $value ) ) {
                                $path = $key;
                        } else {
index d02886f..e1531cc 100644 (file)
@@ -75,11 +75,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                $user = $this->getUser();
                $request = $this->getRequest();
 
-               if ( !$user->isLoggedIn() ) {
-                       $this->error( 'changeemail-no-info' );
-
-                       return;
-               }
+               $this->requireLogin( 'changeemail-no-info' );
 
                if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
                        $this->doReturnTo();
@@ -92,7 +88,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
                // This could also let someone check the current email address, so
                // require both permissions.
-               if ( !$this->getUser()->isAllowed( 'viewmyprivateinfo' ) ) {
+               if ( !$user->isAllowed( 'viewmyprivateinfo' ) ) {
                        throw new PermissionsError( 'viewmyprivateinfo' );
                }
 
index 7fcab19..8b96e6c 100644 (file)
@@ -45,6 +45,11 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $this->getOutput()->disallowUserJs();
 
                $request = $this->getRequest();
+
+               if ( !$request->wasPosted() ) {
+                       $this->requireLogin( 'resetpass-no-info' );
+               }
+
                $this->mUserName = trim( $request->getVal( 'wpName' ) );
                $this->mOldpass = $request->getVal( 'wpPassword' );
                $this->mNewpass = $request->getVal( 'wpNewPassword' );
@@ -52,11 +57,6 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $this->mDomain = $request->getVal( 'wpDomain' );
 
                $user = $this->getUser();
-               if ( !$request->wasPosted() && !$user->isLoggedIn() ) {
-                       $this->error( $this->msg( 'resetpass-no-info' )->text() );
-
-                       return;
-               }
 
                if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
                        $titleObj = Title::newFromText( $request->getVal( 'returnto' ) );
index 6757990..bef155c 100644 (file)
@@ -45,6 +45,8 @@ class EmailConfirmation extends UnlistedSpecialPage {
                $this->checkReadOnly();
                $this->checkPermissions();
 
+               $this->requireLogin( 'confirmemail_needlogin' );
+
                // This could also let someone check the current email address, so
                // require both permissions.
                if ( !$this->getUser()->isAllowed( 'viewmyprivateinfo' ) ) {
@@ -52,22 +54,10 @@ class EmailConfirmation extends UnlistedSpecialPage {
                }
 
                if ( $code === null || $code === '' ) {
-                       if ( $this->getUser()->isLoggedIn() ) {
-                               if ( Sanitizer::validateEmail( $this->getUser()->getEmail() ) ) {
-                                       $this->showRequestForm();
-                               } else {
-                                       $this->getOutput()->addWikiMsg( 'confirmemail_noemail' );
-                               }
+                       if ( Sanitizer::validateEmail( $this->getUser()->getEmail() ) ) {
+                               $this->showRequestForm();
                        } else {
-                               $llink = Linker::linkKnown(
-                                       SpecialPage::getTitleFor( 'Userlogin' ),
-                                       $this->msg( 'loginreqlink' )->escaped(),
-                                       array(),
-                                       array( 'returnto' => $this->getTitle()->getPrefixedText() )
-                               );
-                               $this->getOutput()->addHTML(
-                                       $this->msg( 'confirmemail_needlogin' )->rawParams( $llink )->parse()
-                               );
+                               $this->getOutput()->addWikiMsg( 'confirmemail_noemail' );
                        }
                } else {
                        $this->attemptConfirm( $code );
index ca2daaf..e085240 100644 (file)
@@ -61,21 +61,10 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
        public function execute( $mode ) {
                $this->setHeaders();
 
-               $out = $this->getOutput();
-
                # Anons don't get a watchlist
-               if ( $this->getUser()->isAnon() ) {
-                       $out->setPageTitle( $this->msg( 'watchnologin' ) );
-                       $llink = Linker::linkKnown(
-                               SpecialPage::getTitleFor( 'Userlogin' ),
-                               $this->msg( 'loginreqlink' )->escaped(),
-                               array(),
-                               array( 'returnto' => $this->getTitle()->getPrefixedText() )
-                       );
-                       $out->addHTML( $this->msg( 'watchlistanontext' )->rawParams( $llink )->parse() );
+               $this->requireLogin( 'watchlistanontext', 'watchnologin' );
 
-                       return;
-               }
+               $out = $this->getOutput();
 
                $this->checkPermissions();
                $this->checkReadOnly();
index dff1cf7..7484995 100644 (file)
@@ -240,7 +240,7 @@ class ImageListPager extends TablePager {
                                }
                                $field = $prefix . substr( $field, 3 ) . ' AS ' . $field;
                        }
-                       $fields[array_search('top', $fields)] = "'no' AS top";
+                       $fields[array_search( 'top', $fields )] = "'no' AS top";
                } else {
                        if ( $this->mShowAll ) {
                                $fields[array_search( 'top', $fields )] = "'yes' AS top";
index ecee0bb..5f4b208 100644 (file)
@@ -37,14 +37,7 @@ class SpecialPreferences extends SpecialPage {
                $out = $this->getOutput();
                $out->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
 
-               $user = $this->getUser();
-               if ( $user->isAnon() ) {
-                       throw new ErrorPageError(
-                               'prefsnologin',
-                               'prefsnologintext',
-                               array( $this->getTitle()->getPrefixedDBkey() )
-                       );
-               }
+               $this->requireLogin( 'prefsnologintext2', 'prefsnologin' );
                $this->checkReadOnly();
 
                if ( $par == 'reset' ) {
@@ -62,7 +55,7 @@ class SpecialPreferences extends SpecialPage {
                        );
                }
 
-               $htmlForm = Preferences::getFormObject( $user, $this->getContext() );
+               $htmlForm = Preferences::getFormObject( $this->getUser(), $this->getContext() );
                $htmlForm->setSubmitCallback( array( 'Preferences', 'tryUISubmit' ) );
 
                $htmlForm->show();
index ef2a45d..db98bea 100644 (file)
@@ -61,6 +61,7 @@ class SpecialResetTokens extends FormSpecialPage {
        public function execute( $par ) {
                // This is a preferences page, so no user JS for y'all.
                $this->getOutput()->disallowUserJs();
+               $this->requireLogin();
 
                parent::execute( $par );
 
index 47c89d0..0042b43 100644 (file)
@@ -144,6 +144,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
                }
 
                if ( $includesRestrictedPages || $includesCachedPages ) {
+                       $out->wrapWikiMsg( "<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top' );
                        $out->wrapWikiMsg( "<div class=\"mw-specialpages-notes\">\n$1\n</div>", 'specialpages-note' );
                }
        }
index 62c33a2..c51b61b 100644 (file)
@@ -41,18 +41,7 @@ class SpecialWatchlist extends SpecialPage {
                $output = $this->getOutput();
 
                # Anons don't get a watchlist
-               if ( $user->isAnon() ) {
-                       $output->setPageTitle( $this->msg( 'watchnologin' ) );
-                       $output->setRobotPolicy( 'noindex,nofollow' );
-                       $llink = Linker::linkKnown(
-                               SpecialPage::getTitleFor( 'Userlogin' ),
-                               $this->msg( 'loginreqlink' )->escaped(),
-                               array(),
-                               array( 'returnto' => $this->getTitle()->getPrefixedText() )
-                       );
-                       $output->addHTML( $this->msg( 'watchlistanontext' )->rawParams( $llink )->parse() );
-                       return;
-               }
+               $this->requireLogin( 'watchlistanontext', 'watchnologin' );
 
                // Check permissions
                $this->checkPermissions();
index 091bd78..b572499 100644 (file)
@@ -127,7 +127,7 @@ class UploadFromChunks extends UploadFromFile {
                // Get a 0-byte temp file to perform the concatenation at
                $tmpFile = TempFSFile::factory( 'chunkedupload_', $ext );
                $tmpPath = false; // fail in concatenate()
-               if( $tmpFile ) {
+               if ( $tmpFile ) {
                        // keep alive with $this
                        $tmpPath = $tmpFile->bind( $this )->getPath();
                }
index f4a8b68..85474ff 100644 (file)
@@ -1085,7 +1085,8 @@ The administrator who locked it offered this explanation: "$3".',
 'invalidtitle-knownnamespace'   => 'Invalid title with namespace "$2" and text "$3"',
 'invalidtitle-unknownnamespace' => 'Invalid title with unknown namespace number $1 and text "$2"',
 'exception-nologin'             => 'Not logged in',
-'exception-nologin-text'        => 'This page or action requires you to be logged in on this wiki.',
+'exception-nologin-text'        => 'Please [[Special:Userlogin|log in]] to be able to access this page or action.',
+'exception-nologin-text-manual' => 'Please $1 to be able to access this page or action.',
 
 # Virus scanner
 'virus-badscanner'     => "Bad configuration: Unknown virus scanner: ''$1''",
@@ -1899,7 +1900,7 @@ Note that their indexes of {{SITENAME}} content may be out of date.',
 'mypreferences'                 => 'Preferences',
 'prefs-edits'                   => 'Number of edits:',
 'prefsnologin'                  => 'Not logged in',
-'prefsnologintext'              => 'You must be <span class="plainlinks">[{{fullurl:{{#Special:UserLogin}}|returnto=$1}} logged in]</span> to set user preferences.',
+'prefsnologintext2'             => 'Please $1 to set user preferences.',
 'changepassword'                => 'Change password',
 'changepassword-summary'        => '', # do not translate or duplicate this message to other languages
 'prefs-skin'                    => 'Skin',
@@ -3017,9 +3018,9 @@ Contact the editor:
 mail: $PAGEEDITOR_EMAIL
 wiki: $PAGEEDITOR_WIKI
 
-There will be no other notifications in case of further activity unless you visit this page. You could also reset the notification flags for all your watched pages on your watchlist.
+There will be no other notifications in case of further activity unless you visit this page while logged in. You could also reset the notification flags for all your watched pages on your watchlist.
 
-                        Your friendly {{SITENAME}} notification system
+Your friendly {{SITENAME}} notification system
 
 --
 To change your email notification settings, visit
@@ -4899,8 +4900,8 @@ You should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING a copy of the GNU Gen
 # Special:SpecialPages
 'specialpages'                   => 'Special pages',
 'specialpages-summary'           => '', # do not translate or duplicate this message to other languages
-'specialpages-note'              => '----
-* Normal special pages.
+'specialpages-note-top'          => 'Legend',
+'specialpages-note'              => '* Normal special pages.
 * <span class="mw-specialpagerestricted">Restricted special pages.</span>',
 'specialpages-group-maintenance' => 'Maintenance reports',
 'specialpages-group-other'       => 'Other special pages',
index e361b93..46112d1 100644 (file)
@@ -1223,6 +1223,10 @@ Parameters:
 'exception-nologin' => 'Generic page title used on error page when a user is not logged in. Message used by the UserNotLoggedIn exception.
 {{Identical|Not logged in}}',
 'exception-nologin-text' => 'Generic reason displayed on error page when a user is not logged in. Message used by the UserNotLoggedIn exception.',
+'exception-nologin-text-manual' => 'Generic reason displayed on error page when a user is not logged in.
+
+Parameters:
+* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description',
 
 # Virus scanner
 'virus-badscanner' => 'Used as error message. Parameters:
@@ -2964,8 +2968,8 @@ See also:
 {{Identical|Preferences}}',
 'prefs-edits' => 'In user preferences.',
 'prefsnologin' => '{{Identical|Not logged in}}',
-'prefsnologintext' => 'Parameters:
-* $1 - URI for "returnto" argument',
+'prefsnologintext2' => 'Parameters:
+* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description',
 'changepassword' => "Section heading on [[Special:Preferences]], tab 'User profile'.
 {{Identical|Change password}}",
 'prefs-skin' => 'Used in user preferences.
@@ -10021,6 +10025,7 @@ See also:
 * {{msg-mw|Accesskey-t-specialpages}}
 * {{msg-mw|Tooltip-t-specialpages}}
 {{Identical|Special page}}',
+'specialpages-note-top' => 'Heading for {{msg-mw|specialpages-note}}',
 'specialpages-note' => 'Footer note for the [[Special:SpecialPages]] page',
 'specialpages-group-maintenance' => '{{doc-special-group|like=[[Special:DoubleRedirects]], [[Special:LonelyPages]] and [[Special:WantedPages]]}}',
 'specialpages-group-other' => '{{doc-special-group|like=[[Special:AdminLinks]] and [[Special:BookSources]]}}',
index 1cd2016..76cea2c 100644 (file)
@@ -47,7 +47,7 @@ class bench_wfIsWindows extends Benchmarker {
        }
 
        static function is_win() {
-               return substr( php_uname(), 0, 7 ) == 'Windows' ;
+               return substr( php_uname(), 0, 7 ) == 'Windows';
        }
 
        // bench function 1
index 164b5b0..b6ca281 100644 (file)
@@ -3127,7 +3127,7 @@ prefixsearchdisabled
 prefs
 prefsection
 prefsnologin
-prefsnologintext
+prefsnologintext2
 prefsubmit
 preload
 preloads
index 09bd302..dcd84cf 100644 (file)
@@ -433,6 +433,7 @@ $wgMessageStructure = array(
                'invalidtitle-unknownnamespace',
                'exception-nologin',
                'exception-nologin-text',
+               'exception-nologin-text-manual',
        ),
        'virus' => array(
                'virus-badscanner',
@@ -1027,7 +1028,7 @@ $wgMessageStructure = array(
                'mypreferences',
                'prefs-edits',
                'prefsnologin',
-               'prefsnologintext',
+               'prefsnologintext2',
                'changepassword',
                'changepassword-summary',
                'prefs-skin',
@@ -3734,6 +3735,7 @@ $wgMessageStructure = array(
        'special-specialpages' => array(
                'specialpages',
                'specialpages-summary',
+               'specialpages-note-top',
                'specialpages-note',
                'specialpages-group-maintenance',
                'specialpages-group-other',
diff --git a/maintenance/language/zhtable/trad2simp_supp_unset.manual b/maintenance/language/zhtable/trad2simp_supp_unset.manual
deleted file mode 100644 (file)
index e69de29..0000000
index e918337..5bf04c6 100644 (file)
@@ -148,7 +148,7 @@ foreach ( $mmfl['setupFiles'] as $fileName ) {
                fwrite( STDERR, "Loading data from $fileName\n" );
        }
        // Include the extension to update $wgExtensionMessagesFiles
-       if ( !( include_once( $fileName ) ) ) {
+       if ( !( include_once $fileName ) ) {
                fwrite( STDERR, "Unable to read $fileName\n" );
                exit( 1 );
        }
index 7356c38..8a565d5 100644 (file)
@@ -674,13 +674,13 @@ CREATE UNIQUE INDEX /*$wgDBprefix*/qcc_titletwo ON /*$wgDBprefix*/querycachetwo(
 
 --- Used for storing page restrictions (i.e. protection levels)
 CREATE TABLE /*$wgDBprefix*/page_restrictions (
+   pr_id INT UNIQUE IDENTITY,
    pr_page INT NOT NULL REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE,
    pr_type NVARCHAR(200) NOT NULL,
    pr_level NVARCHAR(200) NOT NULL,
    pr_cascade SMALLINT NOT NULL,
    pr_user INT NULL,
    pr_expiry DATETIME NULL,
-   pr_id INT UNIQUE IDENTITY,
    CONSTRAINT /*$wgDBprefix*/pr_pagetype PRIMARY KEY(pr_page,pr_type),
 );
 CREATE INDEX /*$wgDBprefix*/pr_page      ON /*$wgDBprefix*/page_restrictions(pr_page);
index 64c2848..cd99f7c 100644 (file)
@@ -67,7 +67,7 @@ CREATE TABLE &mw_prefix.msg_resource (
   mr_lang varchar2(32) NOT NULL,
   mr_blob BLOB NOT NULL,
   mr_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL
-) ;
+);
 CREATE UNIQUE INDEX &mw_prefix.msg_resource_u01 ON &mw_prefix.msg_resource (mr_resource, mr_lang);
 
 ALTER TABLE &mw_prefix.oldimage MODIFY oi_name DEFAULT 0;
index 607d7b9..2395bc5 100644 (file)
@@ -663,7 +663,7 @@ CREATE TABLE &mw_prefix.msg_resource (
   mr_lang varchar2(32) NOT NULL,
   mr_blob BLOB NOT NULL,
   mr_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL
-) ;
+);
 CREATE UNIQUE INDEX &mw_prefix.msg_resource_u01 ON &mw_prefix.msg_resource (mr_resource, mr_lang);
 
 CREATE TABLE &mw_prefix.msg_resource_links (
index c21301b..91c36f2 100644 (file)
@@ -121,7 +121,7 @@ class PurgeChangedFiles extends Maintenance {
                        $this->mOptions['verbose'] = 1;
                }
 
-               $this->verbose( 'Purging files that were: ' . implode( ', ', $typeList ) . "\n");
+               $this->verbose( 'Purging files that were: ' . implode( ', ', $typeList ) . "\n" );
                foreach ( $typeList as $type ) {
                        $this->verbose( "Checking for {$type} files...\n" );
                        $this->purgeFromLogType( $type );
@@ -186,7 +186,7 @@ class PurgeChangedFiles extends Maintenance {
                                        // Purge items from fileachive table (rows are likely here)
                                        $this->purgeFromArchiveTable( $repo, $file );
 
-                               } else if ( $logType === 'move' ) {
+                               } elseif ( $logType === 'move' ) {
                                        // Purge the target file as well
 
                                        $params = unserialize( $row->log_params );
index 1a59be5..954c85d 100644 (file)
@@ -237,13 +237,13 @@ CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki_tmp (iw_prefix);
 
 
 CREATE TABLE /*_*/page_restrictions_tmp (
+  pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
   pr_page int NOT NULL,
   pr_type varbinary(60) NOT NULL,
   pr_level varbinary(60) NOT NULL,
   pr_cascade tinyint NOT NULL,
   pr_user int NULL,
-  pr_expiry varbinary(14) NULL,
-  pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT
+  pr_expiry varbinary(14) NULL
 );
 
 CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions_tmp (pr_page,pr_type);
index 14468f3..18139b2 100644 (file)
@@ -1376,6 +1376,8 @@ CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,
 
 -- Used for storing page restrictions (i.e. protection levels)
 CREATE TABLE /*_*/page_restrictions (
+  -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)
+  pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
   -- Page to apply restrictions to (Foreign Key to page).
   pr_page int NOT NULL,
   -- The protection type (edit, move, etc)
@@ -1387,9 +1389,7 @@ CREATE TABLE /*_*/page_restrictions (
   -- Field for future support of per-user restriction.
   pr_user int NULL,
   -- Field for time-limited protection.
-  pr_expiry varbinary(14) NULL,
-  -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages)
-  pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT
+  pr_expiry varbinary(14) NULL
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type);
index e39661a..6b08480 100644 (file)
@@ -169,7 +169,7 @@ class UpdateMediaWiki extends Maintenance {
                $time2 = new MWTimestamp();
 
                $this->output( "\nDone.\n" );
-               $this->output( "\nThe job took ". $time2->diff( $time1 )->format( "%i:%S" ). "\n" );
+               $this->output( "\nThe job took " . $time2->diff( $time1 )->format( "%i:%S" ) . "\n" );
        }
 
        function afterFinalSetup() {
diff --git a/skins/common/images/feed-icon.svg b/skins/common/images/feed-icon.svg
new file mode 100644 (file)
index 0000000..0aa76f5
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>\r
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\r
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="128px" height="128px" id="RSSicon" viewBox="0 0 256 256">\r
+<defs>\r
+<linearGradient x1="0.085" y1="0.085" x2="0.915" y2="0.915" id="RSSg">\r
+<stop  offset="0.0" stop-color="#E3702D"/><stop  offset="0.1071" stop-color="#EA7D31"/>\r
+<stop  offset="0.3503" stop-color="#F69537"/><stop  offset="0.5" stop-color="#FB9E3A"/>\r
+<stop  offset="0.7016" stop-color="#EA7C31"/><stop  offset="0.8866" stop-color="#DE642B"/>\r
+<stop  offset="1.0" stop-color="#D95B29"/>\r
+</linearGradient>\r
+</defs>\r
+<rect width="256" height="256" rx="55" ry="55" x="0"  y="0"  fill="#CC5D15"/>\r
+<rect width="246" height="246" rx="50" ry="50" x="5"  y="5"  fill="#F49C52"/>\r
+<rect width="236" height="236" rx="47" ry="47" x="10" y="10" fill="url(#RSSg)"/>\r
+<circle cx="68" cy="189" r="24" fill="#FFF"/>\r
+<path d="M160 213h-34a82 82 0 0 0 -82 -82v-34a116 116 0 0 1 116 116z" fill="#FFF"/>\r
+<path d="M184 213A140 140 0 0 0 44 73 V 38a175 175 0 0 1 175 175z" fill="#FFF"/>\r
+</svg>\r
index ac7265a..f5b6231 100644 (file)
@@ -485,7 +485,11 @@ a.new {
 /* feed links */
 a.feedlink {
        /* @embed */
-       background: url(images/feed-icon.png) center left no-repeat;
+       background-image: url(images/feed-icon.png);
+       background-image: linear-gradient(transparent, transparent), url(images/feed-icon.svg);
+       background-position: center left;
+       background-repeat: no-repeat;
+       background-size: 12px 12px;
        padding-left: 16px;
 }
 
index 66847ab..2efb7a0 100644 (file)
@@ -50,12 +50,12 @@ CREATE TABLE /*$wgDBprefix*/revision (
   rev_minor_edit tinyint  default '0',
   rev_deleted tinyint  default '0',
   rev_len int,
-  rev_parent_id INTEGER default NULL) /*$wgDBTableOptions*/  ;
+  rev_parent_id INTEGER default NULL) /*$wgDBTableOptions*/;
 
 CREATE TABLE /*$wgDBprefix*/text (
   old_id INTEGER  PRIMARY KEY AUTOINCREMENT,
   old_text mediumblob ,
-  old_flags tinyblob ) /*$wgDBTableOptions*/  ;
+  old_flags tinyblob ) /*$wgDBTableOptions*/;
 
 CREATE TABLE /*$wgDBprefix*/archive (
   ar_namespace INTEGER  default '0',
@@ -124,7 +124,7 @@ CREATE TABLE /*$wgDBprefix*/site_stats (
 
 CREATE TABLE /*$wgDBprefix*/hitcounter (
   hc_id INTEGER
-)  ;
+);
 
 CREATE TABLE /*$wgDBprefix*/ipblocks (
   ipb_id INTEGER  PRIMARY KEY AUTOINCREMENT,
@@ -245,7 +245,7 @@ CREATE TABLE /*$wgDBprefix*/math (
 CREATE TABLE /*$wgDBprefix*/searchindex (
   si_page INTEGER ,
   si_title varchar(255)  default '',
-  si_text mediumtext ) ;
+  si_text mediumtext );
 
 CREATE TABLE /*$wgDBprefix*/interwiki (
   iw_prefix varchar(32) ,
index 9e76045..63fff6e 100644 (file)
@@ -49,7 +49,7 @@ class ExceptionTest extends MediaWikiTestCase {
         * @param $key String Name of the key to validate in the serialized JSON
         * @dataProvider provideJsonSerializedKeys
         */
-       function testJsonserializeexceptionKeys($expectedKeyType, $exClass, $key) {
+       function testJsonserializeexceptionKeys( $expectedKeyType, $exClass, $key ) {
 
                # Make sure we log a backtrace:
                $this->setMwGlobals( array( 'wgLogExceptionBacktrace' => true ) );
@@ -61,7 +61,7 @@ class ExceptionTest extends MediaWikiTestCase {
                        "JSON serialized exception is missing key '$key'"
                );
                $this->assertInternalType( $expectedKeyType, $json->$key,
-                       "JSON serialized key '$key' has type " . gettype($json->$key)
+                       "JSON serialized key '$key' has type " . gettype( $json->$key )
                        . " (expected: $expectedKeyType)."
                );
        }
@@ -71,7 +71,7 @@ class ExceptionTest extends MediaWikiTestCase {
         */
        function provideJsonSerializedKeys() {
                $testCases = array();
-               foreach( array( 'Exception', 'MWException' ) as $exClass ) {
+               foreach ( array( 'Exception', 'MWException' ) as $exClass ) {
                        $exTests = array(
                                array( 'string',  $exClass,  'id' ),
                                array( 'string',  $exClass,  'file' ),
@@ -81,7 +81,7 @@ class ExceptionTest extends MediaWikiTestCase {
                                # Backtrace only enabled with wgLogExceptionBacktrace = true
                                array( 'array',   $exClass,  'backtrace' ),
                        );
-                       $testCases = array_merge($testCases, $exTests);
+                       $testCases = array_merge( $testCases, $exTests );
                }
                return $testCases;
        }
index f408f47..910b766 100644 (file)
@@ -69,5 +69,4 @@ class FallbackTest extends MediaWikiTestCase {
                        );
                }
        }
-
-}
\ No newline at end of file
+}
index aebd65f..dd76e3b 100644 (file)
@@ -19,7 +19,7 @@ class MWExceptionHandlerTest extends MediaWikiTestCase {
                        $array = array( 'a', 'b' );
                        $object = new StdClass();
                        self::helperThrowAnException( $array, $object, $refvar );
-               } catch (Exception $e) {
+               } catch ( Exception $e ) {
                }
 
                # Make sure our strack trace contains an array and an object passed to
@@ -37,7 +37,7 @@ class MWExceptionHandlerTest extends MediaWikiTestCase {
                                $hasArray = $hasArray || is_array( $arg );
                        }
 
-                       if( $hasObject && $hasArray ) {
+                       if ( $hasObject && $hasArray ) {
                                break;
                        }
                }
@@ -55,8 +55,8 @@ class MWExceptionHandlerTest extends MediaWikiTestCase {
                                continue;
                        }
                        foreach ( $frame['args'] as $arg ) {
-                               $this->assertNotInternalType( 'array', $arg);
-                               $this->assertNotInternalType( 'object', $arg);
+                               $this->assertNotInternalType( 'array', $arg );
+                               $this->assertNotInternalType( 'object', $arg );
                        }
                }
 
index 0a7cc04..08a5495 100644 (file)
@@ -5,7 +5,7 @@
  */
 class StatusTest extends MediaWikiTestCase {
 
-       public function testCanConstruct(){
+       public function testCanConstruct() {
                new Status();
                $this->assertTrue( true );
        }
@@ -13,18 +13,15 @@ class StatusTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideValues
         * @covers Status::newGood
-        * @covers Status::getValue
-        * @covers Status::isGood
-        * @covers Status::isOK
         */
-       public function testNewGood( $value = null ){
+       public function testNewGood( $value = null ) {
                $status = Status::newGood( $value );
                $this->assertTrue( $status->isGood() );
                $this->assertTrue( $status->isOK() );
                $this->assertEquals( $value, $status->getValue() );
        }
 
-       public static function provideValues(){
+       public static function provideValues() {
                return array(
                        array(),
                        array( 'foo' ),
@@ -36,9 +33,6 @@ class StatusTest extends MediaWikiTestCase {
 
        /**
         * @covers Status::newFatal
-        * @covers Status::isGood
-        * @covers Status::isOK
-        * @covers Status::getMessage
         */
        public function testNewFatalWithMessage() {
                $message = $this->getMockBuilder( 'Message' )
@@ -53,23 +47,18 @@ class StatusTest extends MediaWikiTestCase {
 
        /**
         * @covers Status::newFatal
-        * @covers Status::isGood
-        * @covers Status::isOK
-        * @covers Status::getMessage
         */
        public function testNewFatalWithString() {
                $message = 'foo';
                $status = Status::newFatal( $message );
                $this->assertFalse( $status->isGood() );
                $this->assertFalse( $status->isOK() );
-               $newMessage = $status->getMessage();
-               $this->assertEquals( $message, $newMessage->getKey() );
+               $this->assertEquals( $message, $status->getMessage()->getKey() );
        }
 
        /**
         * @dataProvider provideSetResult
-        * @covers Status::getValue
-        * @covers Status::isOK
+        * @covers Status::setResult
         */
        public function testSetResult( $ok, $value = null ) {
                $status = new Status();
@@ -87,6 +76,52 @@ class StatusTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @dataProvider provideIsOk
+        * @covers Status::isOk
+        */
+       public function testIsOk( $ok ) {
+               $status = new Status();
+               $status->ok = $ok;
+               $this->assertEquals( $ok, $status->isOK() );
+       }
+
+       public static function provideIsOk() {
+               return array(
+                       array( true ),
+                       array( false ),
+               );
+       }
+
+       /**
+        * @covers Status::getValue
+        */
+       public function testGetValue() {
+               $status = new Status();
+               $status->value = 'foobar';
+               $this->assertEquals( 'foobar', $status->getValue() );
+       }
+
+       /**
+        * @dataProvider provideIsGood
+        * @covers Status::isGood
+        */
+       public function testIsGood( $ok, $errors, $expected ) {
+               $status = new Status();
+               $status->ok = $ok;
+               $status->errors = $errors;
+               $this->assertEquals( $expected, $status->isGood() );
+       }
+
+       public static function provideIsGood() {
+               return array(
+                       array( true, array(), true ),
+                       array( true, array( 'foo' ), false ),
+                       array( false, array(), false ),
+                       array( false, array( 'foo' ), false ),
+               );
+       }
+
        /**
         * @dataProvider provideMockMessageDetails
         * @covers Status::warning
@@ -96,13 +131,13 @@ class StatusTest extends MediaWikiTestCase {
                $status = new Status();
                $messages = $this->getMockMessages( $mockDetails );
 
-               foreach( $messages as $message ){
+               foreach ( $messages as $message ) {
                        $status->warning( $message );
                }
                $warnings = $status->getWarningsArray();
 
                $this->assertEquals( count( $messages ), count( $warnings ) );
-               foreach( $messages as $key => $message ) {
+               foreach ( $messages as $key => $message ) {
                        $expectedArray = array_merge( array( $message->getKey() ), $message->getParams() );
                        $this->assertEquals( $warnings[$key], $expectedArray );
                }
@@ -117,13 +152,13 @@ class StatusTest extends MediaWikiTestCase {
                $status = new Status();
                $messages = $this->getMockMessages( $mockDetails );
 
-               foreach( $messages as $message ){
+               foreach ( $messages as $message ) {
                        $status->error( $message );
                }
                $errors = $status->getErrorsArray();
 
                $this->assertEquals( count( $messages ), count( $errors ) );
-               foreach( $messages as $key => $message ) {
+               foreach ( $messages as $key => $message ) {
                        $expectedArray = array_merge( array( $message->getKey() ), $message->getParams() );
                        $this->assertEquals( $errors[$key], $expectedArray );
                }
@@ -146,15 +181,15 @@ class StatusTest extends MediaWikiTestCase {
         * @param array $messageDetails eg. array( 'KEY' => array(/PARAMS/) )
         * @return Message[]
         */
-       protected function getMockMessages( $messageDetails ){
+       protected function getMockMessages( $messageDetails ) {
                $messages = array();
-               foreach( $messageDetails as $key => $paramsArray ){
+               foreach ( $messageDetails as $key => $paramsArray ) {
                        $messages[] = $this->getMockMessage( $key, $paramsArray );
                }
                return $messages;
        }
 
-       public static function provideMockMessageDetails(){
+       public static function provideMockMessageDetails() {
                return array(
                        array( array( 'key1' => array( 'foo' => 'bar' ) ) ),
                        array( array( 'key1' => array( 'foo' => 'bar' ), 'key2' => array( 'foo2' => 'bar2' ) ) ),
@@ -165,7 +200,7 @@ class StatusTest extends MediaWikiTestCase {
         * @covers Status::merge
         * @todo test merge with $overwriteValue true
         */
-       public function testMerge(){
+       public function testMerge() {
                $status1 = new Status();
                $status2 = new Status();
                $message1 = $this->getMockMessage( 'warn1' );
@@ -185,11 +220,94 @@ class StatusTest extends MediaWikiTestCase {
                $status->fatal( 'bad' );
                $this->assertTrue( $status->hasMessage( 'bad' ) );
                $this->assertFalse( $status->hasMessage( 'good' ) );
+       }
 
+       /**
+        * @dataProvider provideCleanParams
+        * @covers Status::cleanParams
+        */
+       public function testCleanParams( $cleanCallback, $params, $expected ) {
+               $method = new ReflectionMethod( 'Status', 'cleanParams' );
+               $method->setAccessible(TRUE);
+               $status = new Status();
+               $status->cleanCallback = $cleanCallback;
+
+               $this->assertEquals( $expected, $method->invoke( $status, $params ) );
+       }
+
+       /**
+        * @todo test cleanParams with a callback
+        */
+       public static function provideCleanParams() {
+               return array(
+                       array( false, array( 'foo' => 'bar' ), array( 'foo' => 'bar' ) ),
+               );
+       }
+
+       /**
+        * @dataProvider provideGetWikiText
+        * @covers Status::getWikiText
+        * @todo test long and short context messages generated through this method
+        *       this can not really be done now due to use of wfMessage()->plain()
+        *       It is possible to mock such methods but only if namespaces are used
+        */
+       public function testGetWikiText( Status $status, $expected ) {
+               $this->assertEquals( $expected, $status->getWikiText() );
+       }
+
+       /**
+        * @return array of arrays with values;
+        *    0 => status object
+        *    1 => expected string (with no context)
+        */
+       public static function provideGetWikiText() {
+               $testCases = array();
+
+               $testCases[ 'GoodStatus' ] = array(
+                       new Status(),
+                       "Internal error: Status::getWikiText called for a good result, this is incorrect\n",
+               );
+
+               $status = new Status();
+               $status->ok = false;
+               $testCases[ 'GoodButNoError' ] = array(
+                       $status,
+                       "Internal error: Status::getWikiText: Invalid result object: no error text but not OK\n",
+               );
+
+               $status = new Status();
+               $status->warning( 'fooBar!' );
+               $testCases[ '1StringWarning' ] = array(
+                       $status,
+                       "<fooBar!>",
+               );
+
+               $status = new Status();
+               $status->warning( 'fooBar!' );
+               $status->warning( 'fooBar2!' );
+               $testCases[ '2StringWarnings' ] = array(
+                       $status,
+                       "* <fooBar!>\n* <fooBar2!>\n",
+               );
+
+               $status = new Status();
+               $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' )  ) );
+               $testCases[ '1MessageWarning' ] = array(
+                       $status,
+                       "<fooBar!>",
+               );
+
+               $status = new Status();
+               $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) );
+               $status->warning( new Message( 'fooBar2!' ) );
+               $testCases[ '2MessageWarnings' ] = array(
+                       $status,
+                       "* <fooBar!>\n* <fooBar2!>\n",
+               );
+
+               return $testCases;
        }
 
-       //todo test cleanParams
-       //todo test getWikiText
        //todo test getMessage
        //todo test getErrorMessage
        //todo test getHTML
@@ -197,6 +315,5 @@ class StatusTest extends MediaWikiTestCase {
        //todo test getStatusArray
        //todo test getErrorsByType
        //todo test replaceMessage
-       //todo test replaceMessage
 
 }
index 278edfa..dca8aeb 100644 (file)
@@ -11,4 +11,4 @@ class UserMailerTest extends MediaWikiLangTestCase {
                        UserMailer::quotedPrintable( "\xc4\x88u legebla?", "UTF-8" ) );
        }
 
-}
\ No newline at end of file
+}
index 161468e..907ce79 100644 (file)
@@ -14,7 +14,7 @@ class XmlJs extends MediaWikiTestCase {
                $this->assertEquals( $value, $obj->value );
        }
 
-       public function provideConstruction(){
+       public function provideConstruction() {
                return array(
                        array( null ),
                        array( '' ),
index 7521dcf..8fe08e1 100644 (file)
@@ -212,7 +212,7 @@ class ApiEditPageTest extends ApiTestCase {
                        'text' => "==section 1==\nnew content 1",
                ) );
                $this->assertEquals( 'Success', $re['edit']['result'] );
-               $newtext = WikiPage::factory( Title::newFromText( $name) )->getContent( Revision::RAW )->getNativeData();
+               $newtext = WikiPage::factory( Title::newFromText( $name ) )->getContent( Revision::RAW )->getNativeData();
                $this->assertEquals( $newtext, "==section 1==\nnew content 1\n\n==section 2==\ncontent2" );
 
                // Test that we raise a 'nosuchsection' error
index 3168f32..6e5edbf 100644 (file)
@@ -10,7 +10,7 @@
 class ApiOptionsTest extends MediaWikiLangTestCase {
 
        /** @var PHPUnit_Framework_MockObject_MockObject */
-       private $mUserMock ;
+       private $mUserMock;
        /** @var ApiOptions */
        private $mTested;
        private $mSession;
index 43637c2..80d7ea6 100644 (file)
@@ -18,4 +18,4 @@ class ApiTestContext extends RequestContext {
 
                return $context;
        }
-}
\ No newline at end of file
+}
index 3686048..d94aa2c 100644 (file)
@@ -17,4 +17,4 @@ class MockApi extends ApiBase {
                        'sessionkey' => null,
                );
        }
-}
\ No newline at end of file
+}
index 3262e6c..f8da0ff 100644 (file)
@@ -22,4 +22,4 @@ class UserWrapper {
                }
                $this->user->saveSettings();
        }
-}
\ No newline at end of file
+}
index 2162a02..58f2014 100644 (file)
@@ -65,7 +65,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
        public function testAddIdentifierQuotes( $expected, $in ) {
                $db = new FakeDatabaseMysqlBase();
                $quoted = $db->addIdentifierQuotes( $in );
-               $this->assertEquals($expected, $quoted);
+               $this->assertEquals( $expected, $quoted );
        }
 
 
@@ -121,7 +121,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
                );
        }
 
-       private static function createUnicodeString($str) {
+       private static function createUnicodeString( $str ) {
                return json_decode( '"' . $str . '"' );
        }
 
@@ -156,9 +156,9 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
                $db = $this->getMockForViews();
 
                // The first call populate an internal cache of views
-               $this->assertEquals( array( 'view1', 'view2', 'myview'),
+               $this->assertEquals( array( 'view1', 'view2', 'myview' ),
                        $db->listViews() );
-               $this->assertEquals( array( 'view1', 'view2', 'myview'),
+               $this->assertEquals( array( 'view1', 'view2', 'myview' ),
                        $db->listViews() );
 
                // Prefix filtering
@@ -168,7 +168,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
                        $db->listViews( 'my' ) );
                $this->assertEquals( array(),
                        $db->listViews( 'UNUSED_PREFIX' ) );
-               $this->assertEquals( array( 'view1', 'view2', 'myview'),
+               $this->assertEquals( array( 'view1', 'view2', 'myview' ),
                        $db->listViews( '' ) );
        }
 
@@ -179,7 +179,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
        function testIsView( $isView, $viewName ) {
                $db = $this->getMockForViews();
 
-               switch( $isView ) {
+               switch ( $isView ) {
                        case true:
                                $this->assertTrue( $db->isView( $viewName ),
                                        "$viewName should be considered a view" );
index 301fc99..35a8e4c 100644 (file)
@@ -109,7 +109,7 @@ class DatabaseTest extends MediaWikiTestCase {
                }
 
                if ( $this->db->getType() === 'oracle' ) {
-                       return strtoupper($database . $quote . $prefix . $table);
+                       return strtoupper( $database . $quote . $prefix . $table );
                } else {
                        return $database . $quote . $prefix . $table . $quote;
                }
index 738121a..5c3f36a 100644 (file)
@@ -47,7 +47,7 @@ class DifferenceEngineTest extends MediaWikiTestCase {
                $strings = array( "it is a kitten", "two kittens", "three kittens", "four kittens" );
                $revisions = array();
 
-               foreach( $strings as $string ) {
+               foreach ( $strings as $string ) {
                        $content = ContentHandler::makeContent( $string, $title );
                        $page->doEditContent( $content, 'edit page' );
                        $revisions[] = $page->getLatest();
@@ -59,7 +59,7 @@ class DifferenceEngineTest extends MediaWikiTestCase {
        public function testMapDiffPrevNext() {
                $cases = $this->getMapDiffPrevNextCases();
 
-               foreach( $cases as $case ) {
+               foreach ( $cases as $case ) {
                        list( $expected, $old, $new, $message ) = $case;
 
                        $diffEngine = new DifferenceEngine( $this->context, $old, $new, 2, true, false );
@@ -81,7 +81,7 @@ class DifferenceEngineTest extends MediaWikiTestCase {
        public function testLoadRevisionData() {
                $cases = $this->getLoadRevisionDataCases();
 
-               foreach( $cases as $case ) {
+               foreach ( $cases as $case ) {
                        list( $expectedOld, $expectedNew, $old, $new, $message ) = $case;
 
                        $diffEngine = new DifferenceEngine( $this->context, $old, $new, 2, true, false );
index 7926000..7bc785e 100644 (file)
@@ -25,4 +25,4 @@ class FakeDimensionFile extends File {
        public function getPath() {
                return '';
        }
-}
\ No newline at end of file
+}
index 6ff928e..a4f71db 100644 (file)
@@ -65,20 +65,20 @@ class FormatMetadataTest extends MediaWikiTestCase {
 
        public static function provideFlattenArray() {
                return array(
-                       array (
-                               array(1 ,2 ,3), 'ul', false, false,
+                       array(
+                               array( 1, 2, 3 ), 'ul', false, false,
                                "<ul><li>1</li>\n<li>2</li>\n<li>3</li></ul>",
                        ),
-                       array (
-                               array(1 ,2 ,3), 'ol', false, false,
+                       array(
+                               array( 1, 2, 3 ), 'ol', false, false,
                                "<ol><li>1</li>\n<li>2</li>\n<li>3</li></ol>",
                        ),
-                       array (
-                               array(1 ,2 ,3), 'ul', true, false,
+                       array(
+                               array( 1, 2, 3 ), 'ul', true, false,
                                "\n*1\n*2\n*3",
                        ),
-                       array (
-                               array(1 ,2 ,3), 'ol', true, false,
+                       array(
+                               array( 1, 2, 3 ), 'ol', true, false,
                                "\n#1\n#2\n#3",
                        ),
                        // TODO: more test cases
index 57a88b9..d2ab4d3 100644 (file)
@@ -41,4 +41,4 @@ class TidyTest extends MediaWikiTestCase {
                        array( "<meta foo=\"bar\" />\nfoo", '<meta foo="bar"/>foo', '<meta> should survive tidy' ),
                );
        }
-}
\ No newline at end of file
+}
index 733368d..d8b90d5 100644 (file)
@@ -90,6 +90,6 @@ class AutoLoaderTest extends MediaWikiTestCase {
                $dummyCereal = 'O:29:"testautoloadedserializedclass":0:{}';
                $uncerealized = unserialize( $dummyCereal );
                $this->assertFalse( $uncerealized instanceof __PHP_Incomplete_Class,
-                       "unserialize() can load classes case-insensitively.");
+                       "unserialize() can load classes case-insensitively." );
        }
 }
index be362e2..90cd546 100644 (file)
@@ -554,7 +554,7 @@ QUnit.test( 'formatnum', formatnumTests.length, function ( assert ) {
                                return;
                        }
                        mw.messages.set(test.message );
-                       mw.config.set( 'wgUserLanguage', test.lang ) ;
+                       mw.config.set( 'wgUserLanguage', test.lang );
                        var parser = new mw.jqueryMsg.parser( { language: langClass } );
                        assert.equal(
                                parser.parse( test.integer ? 'formatnum-msg-int' : 'formatnum-msg',