Merge "resourceloader: Add Doxygen group and improve overall docs"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 15 Sep 2019 19:58:46 +0000 (19:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 15 Sep 2019 19:58:46 +0000 (19:58 +0000)
108 files changed:
.phan/config.php
RELEASE-NOTES-1.34
docs/hooks.txt
includes/EditPage.php
includes/FeedUtils.php
includes/GlobalFunctions.php
includes/Linker.php
includes/OutputPage.php
includes/Revision/RevisionStoreFactory.php
includes/ServiceWiring.php
includes/Status.php
includes/Storage/SqlBlobStore.php
includes/Title.php
includes/WebRequest.php
includes/actions/Action.php
includes/actions/InfoAction.php
includes/actions/RollbackAction.php
includes/actions/SpecialPageAction.php
includes/api/ApiComparePages.php
includes/api/ApiEditPage.php
includes/api/ApiFormatXmlRsd.php
includes/api/ApiHelpParamValueMessage.php
includes/api/ApiImageRotate.php
includes/api/ApiParse.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryQueryPage.php
includes/block/BlockManager.php
includes/changes/CategoryMembershipChange.php
includes/changes/ChangesFeed.php
includes/changes/ChangesList.php
includes/changes/EnhancedChangesList.php
includes/changes/RCCacheEntryFactory.php
includes/changetags/ChangeTagsLogItem.php
includes/collation/CustomUppercaseCollation.php
includes/content/ContentHandler.php
includes/debug/logger/ConsoleLogger.php
includes/export/WikiExporter.php
includes/filerepo/FileRepo.php
includes/filerepo/file/ArchivedFile.php
includes/filerepo/file/LocalFileDeleteBatch.php
includes/historyblob/ConcatenatedGzipHistoryBlob.php
includes/historyblob/HistoryBlobCurStub.php
includes/historyblob/HistoryBlobStub.php
includes/htmlform/HTMLFormField.php
includes/htmlform/fields/HTMLSelectAndOtherField.php
includes/http/MWCallbackStream.php
includes/import/ImportStreamSource.php
includes/import/WikiImporter.php
includes/installer/InstallDocFormatter.php
includes/installer/LocalSettingsGenerator.php
includes/installer/MysqlUpdater.php
includes/installer/PostgresInstaller.php
includes/logging/DeleteLogFormatter.php
includes/media/DjVuHandler.php
includes/media/DjVuImage.php
includes/objectcache/ObjectCache.php
includes/page/PageArchive.php
includes/page/WikiFilePage.php
includes/page/WikiPage.php
includes/parser/CoreParserFunctions.php
includes/resourceloader/ResourceLoaderImage.php
includes/resourceloader/ResourceLoaderWikiModule.php
includes/revisiondelete/RevDelArchivedFileItem.php
includes/revisiondelete/RevDelFileItem.php
includes/revisiondelete/RevDelList.php
includes/revisiondelete/RevDelLogItem.php
includes/revisiondelete/RevDelLogList.php
includes/revisiondelete/RevDelRevisionItem.php
includes/revisiondelete/RevDelRevisionList.php
includes/revisiondelete/RevisionDeleteUser.php
includes/revisiondelete/RevisionDeleter.php
includes/revisionlist/RevisionItem.php
includes/site/MediaWikiSite.php
includes/site/Site.php
includes/specialpage/ChangesListSpecialPage.php
includes/specials/SpecialBlockList.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialRevisionDelete.php
includes/specials/SpecialTags.php
includes/specials/forms/PreferencesFormOOUI.php
includes/specials/pagers/ContribsPager.php
includes/specials/pagers/DeletedContribsPager.php
includes/title/MediaWikiTitleCodec.php
includes/utils/AvroValidator.php
includes/watcheditem/WatchedItemQueryService.php
languages/LanguageConverter.php
languages/data/Names.php
maintenance/Doxyfile
maintenance/archives/upgradeLogging.php
maintenance/cleanupSpam.php
maintenance/findDeprecated.php
maintenance/getText.php
maintenance/populateRevisionLength.php
maintenance/preprocessDump.php
maintenance/refreshLinks.php
maintenance/userDupes.inc
resources/Resources.php
resources/src/jquery/jquery.checkboxShiftClick.js [deleted file]
resources/src/mediawiki.page.ready.js [deleted file]
resources/src/mediawiki.page.ready/checkboxShift.js [new file with mode: 0644]
resources/src/mediawiki.page.ready/ready.js [new file with mode: 0644]
tests/phpunit/includes/Revision/RevisionStoreFactoryTest.php
tests/phpunit/includes/RevisionTest.php
tests/phpunit/includes/block/BlockManagerTest.php
tests/phpunit/includes/filebackend/FileBackendTest.php
tests/phpunit/maintenance/fetchTextTest.php
thumb.php

index fc775fe..56a8ccb 100644 (file)
@@ -104,8 +104,6 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
 
        // approximate error count: 45
        "PhanTypeMismatchArgument",
-       // approximate error count: 693
-       "PhanUndeclaredProperty",
 ] );
 
 // This helps a lot in discovering bad code, but unfortunately it will always fail for
@@ -113,6 +111,10 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
 // @todo Enable when the issue above is resolved and we update our config!
 $cfg['redundant_condition_detection'] = false;
 
+// Do not use aliases in core.
+// Use the correct name, because we don't need backward compatibility
+$cfg['enable_class_alias_support'] = false;
+
 $cfg['ignore_undeclared_variables_in_global_scope'] = true;
 // @todo It'd be great if we could just make phan read these from DefaultSettings, to avoid
 // duplicating the types.
index 2da3b55..a99fd31 100644 (file)
@@ -430,6 +430,8 @@ because of Phabricator reports.
   * Revision::selectPageFields()
   * Revision::selectUserFields()
 * User::setNewpassword(), deprecated in 1.27 has been removed.
+* The ObjectCache::getMainWANInstance and ObjectCache::getMainStashInstance
+  functions, deprecated since 1.28, have been removed.
 
 === Deprecations in 1.34 ===
 * The MWNamespace class is deprecated. Use NamespaceInfo.
index 43bfd8d..55ba06e 100644 (file)
@@ -2921,7 +2921,7 @@ result augmentors.
 Note that lists should be in the format name => object and the names in both
   lists should be distinct.
 
-'SecondaryDataUpdates': DEPRECATED! Use RevisionDataUpdates or override
+'SecondaryDataUpdates': DEPRECATED since 1.32! Use RevisionDataUpdates or override
 ContentHandler::getSecondaryDataUpdates instead.
 Allows modification of the list of DataUpdates to perform when page content is modified.
 $title: Title of the page that is being edited.
@@ -3969,7 +3969,7 @@ dumps. One, and only one hook should set this, and return false.
 &$opts: Options to use for the query
 &$join: Join conditions
 
-'WikiPageDeletionUpdates': DEPRECATED! Use PageDeletionDataUpdates or
+'WikiPageDeletionUpdates': DEPRECATED since 1.32! Use PageDeletionDataUpdates or
 override ContentHandler::getDeletionDataUpdates instead.
 Manipulates the list of DeferrableUpdates to be applied when a page is deleted.
 $page: the WikiPage
index c346b75..9d89785 100644 (file)
@@ -25,7 +25,7 @@ use MediaWiki\EditPage\TextboxBuilder;
 use MediaWiki\EditPage\TextConflictHelper;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\ScopedCallback;
 
 /**
@@ -2742,7 +2742,7 @@ ERROR;
         * content.
         *
         * @param Content|null|bool|string $content
-        * @return string The editable text form of the content.
+        * @return string|false|null The editable text form of the content.
         *
         * @throws MWException If $content is not an instance of TextContent and
         *   $this->allowNonTextContent is not true.
index 8efae4f..bfd1e2a 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Feed
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Helper functions for feeds
index 38daab5..3b4e657 100644 (file)
@@ -1816,10 +1816,11 @@ function mimeTypeMatch( $type, $avail ) {
  *
  * @param array $cprefs Client's acceptable type list
  * @param array $sprefs Server's offered types
- * @return string
+ * @return string|null
  *
  * @todo FIXME: Doesn't handle params like 'text/plain; charset=UTF-8'
  * XXX: generalize to negotiate other stuff
+ * @todo The function appears unused. Is it worth to keep?
  */
 function wfNegotiateType( $cprefs, $sprefs ) {
        $combine = [];
index 1a5058d..324b1f5 100644 (file)
@@ -21,7 +21,7 @@
  */
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Some internal bits split of from Skin.php. These functions are used
index 9dbbf13..c9b4193 100644 (file)
@@ -332,7 +332,7 @@ class OutputPage extends ContextSource {
         * a OutputPage tied to that context.
         * @param IContextSource $context
         */
-       function __construct( IContextSource $context ) {
+       public function __construct( IContextSource $context ) {
                $this->setContext( $context );
        }
 
@@ -385,8 +385,8 @@ class OutputPage extends ContextSource {
         * @param string $name Name of the meta tag
         * @param string $val Value of the meta tag
         */
-       function addMeta( $name, $val ) {
-               array_push( $this->mMetatags, [ $name, $val ] );
+       public function addMeta( $name, $val ) {
+               $this->mMetatags[] = [ $name, $val ];
        }
 
        /**
@@ -406,8 +406,8 @@ class OutputPage extends ContextSource {
         *
         * @param array $linkarr Associative array of attributes.
         */
-       function addLink( array $linkarr ) {
-               array_push( $this->mLinktags, $linkarr );
+       public function addLink( array $linkarr ) {
+               $this->mLinktags[] = $linkarr;
        }
 
        /**
@@ -425,7 +425,7 @@ class OutputPage extends ContextSource {
         * in preference to addLink(), to avoid duplicate link tags.
         * @param string $url
         */
-       function setCanonicalUrl( $url ) {
+       public function setCanonicalUrl( $url ) {
                $this->mCanonicalUrl = $url;
        }
 
@@ -447,7 +447,7 @@ class OutputPage extends ContextSource {
         *
         * @param string $script Raw HTML
         */
-       function addScript( $script ) {
+       public function addScript( $script ) {
                $this->mScripts .= $script;
        }
 
@@ -621,7 +621,7 @@ class OutputPage extends ContextSource {
         *
         * @return array
         */
-       function getHeadItemsArray() {
+       public function getHeadItemsArray() {
                return $this->mHeadItems;
        }
 
@@ -1598,6 +1598,7 @@ class OutputPage extends ContextSource {
         * @param ParserOptions|null $options Either the ParserOption to use or null to only get the
         *   current ParserOption object. This parameter is deprecated since 1.31.
         * @return ParserOptions
+        * @suppress PhanUndeclaredProperty For isBogus
         */
        public function parserOptions( $options = null ) {
                if ( $options !== null ) {
@@ -1954,7 +1955,7 @@ class OutputPage extends ContextSource {
         * @param ParserOutput $parserOutput
         * @param array $poOptions Options to ParserOutput::getText()
         */
-       function addParserOutput( ParserOutput $parserOutput, $poOptions = [] ) {
+       public function addParserOutput( ParserOutput $parserOutput, $poOptions = [] ) {
                $this->addParserOutputMetadata( $parserOutput );
                $this->addParserOutputText( $parserOutput, $poOptions );
        }
@@ -2188,7 +2189,7 @@ class OutputPage extends ContextSource {
         *
         * @return array
         */
-       function getCacheVaryCookies() {
+       public function getCacheVaryCookies() {
                if ( self::$cacheVaryCookies === null ) {
                        $config = $this->getConfig();
                        self::$cacheVaryCookies = array_values( array_unique( array_merge(
@@ -2209,7 +2210,7 @@ class OutputPage extends ContextSource {
         *
         * @return bool
         */
-       function haveCacheVaryCookies() {
+       public function haveCacheVaryCookies() {
                $request = $this->getRequest();
                foreach ( $this->getCacheVaryCookies() as $cookieName ) {
                        if ( $request->getCookie( $cookieName, '', '' ) !== '' ) {
index acecee1..1de4d7f 100644 (file)
@@ -27,7 +27,7 @@ namespace MediaWiki\Revision;
 
 use ActorMigration;
 use CommentStore;
-use MediaWiki\Logger\Spi as LoggerSpi;
+use Psr\Log\LoggerInterface;
 use MediaWiki\Storage\BlobStoreFactory;
 use MediaWiki\Storage\NameTableStoreFactory;
 use WANObjectCache;
@@ -54,8 +54,8 @@ class RevisionStoreFactory {
        private $dbLoadBalancerFactory;
        /** @var WANObjectCache */
        private $cache;
-       /** @var LoggerSpi */
-       private $loggerProvider;
+       /** @var LoggerInterface */
+       private $logger;
 
        /** @var CommentStore */
        private $commentStore;
@@ -84,7 +84,7 @@ class RevisionStoreFactory {
         * @param CommentStore $commentStore
         * @param ActorMigration $actorMigration
         * @param int $migrationStage
-        * @param LoggerSpi $loggerProvider
+        * @param LoggerInterface $logger
         * @param bool $contentHandlerUseDB see {@link $wgContentHandlerUseDB}. Must be the same
         *        for all wikis in the cluster. Will go away after MCR migration.
         */
@@ -97,7 +97,7 @@ class RevisionStoreFactory {
                CommentStore $commentStore,
                ActorMigration $actorMigration,
                $migrationStage,
-               LoggerSpi $loggerProvider,
+               LoggerInterface $logger,
                $contentHandlerUseDB
        ) {
                Assert::parameterType( 'integer', $migrationStage, '$migrationStage' );
@@ -109,7 +109,7 @@ class RevisionStoreFactory {
                $this->commentStore = $commentStore;
                $this->actorMigration = $actorMigration;
                $this->mcrMigrationStage = $migrationStage;
-               $this->loggerProvider = $loggerProvider;
+               $this->logger = $logger;
                $this->contentHandlerUseDB = $contentHandlerUseDB;
        }
 
@@ -118,7 +118,7 @@ class RevisionStoreFactory {
         *
         * @param bool|string $dbDomain DB domain of the relevant wiki or false for the current one
         *
-        * @return RevisionStore for the given wikiId with all necessary services and a logger
+        * @return RevisionStore for the given wikiId with all necessary services
         */
        public function getRevisionStore( $dbDomain = false ) {
                Assert::parameterType( 'string|boolean', $dbDomain, '$dbDomain' );
@@ -137,7 +137,7 @@ class RevisionStoreFactory {
                        $dbDomain
                );
 
-               $store->setLogger( $this->loggerProvider->getLogger( 'RevisionStore' ) );
+               $store->setLogger( $this->logger );
                $store->setContentHandlerUseDB( $this->contentHandlerUseDB );
 
                return $store;
index 689a98e..4cd3d85 100644 (file)
@@ -111,7 +111,8 @@ return [
                        new ServiceOptions(
                                BlockManager::$constructorOptions, $services->getMainConfig()
                        ),
-                       $services->getPermissionManager()
+                       $services->getPermissionManager(),
+                       LoggerFactory::getInstance( 'BlockManager' )
                );
        },
 
@@ -632,7 +633,7 @@ return [
                        $services->getCommentStore(),
                        $services->getActorMigration(),
                        $config->get( 'MultiContentRevisionSchemaMigrationStage' ),
-                       LoggerFactory::getProvider(),
+                       LoggerFactory::getInstance( 'RevisionStore' ),
                        $config->get( 'ContentHandlerUseDB' )
                );
 
index 76b905e..932fd2a 100644 (file)
@@ -115,6 +115,7 @@ class Status extends StatusValue {
         * ]
         *
         * @return Status[]
+        * @suppress PhanUndeclaredProperty Status vs StatusValue
         */
        public function splitByErrorType() {
                list( $errorsOnlyStatus, $warningsOnlyStatus ) = parent::splitByErrorType();
index 8c011df..bcbc9e8 100644 (file)
@@ -103,10 +103,10 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
         * @param ExternalStoreAccess $extStoreAccess Access layer for external storage
         * @param WANObjectCache $cache A cache manager for caching blobs. This can be the local
         *        wiki's default instance even if $dbDomain refers to a different wiki, since
-        *        makeGlobalKey() is used to constructed a key that allows cached blobs from the
-        *        same database to be re-used between wikis. For example, enwiki and frwiki will
-        *        use the same cache keys for blobs from the wikidatawiki database, regardless of
-        *        the cache's default key space.
+        *        makeGlobalKey() is used to construct a key that allows cached blobs from the
+        *        same database to be re-used between wikis. For example, wiki A and wiki B will
+        *        use the same cache keys for blobs fetched from wiki C, regardless of the
+        *        wiki-specific default key space.
         * @param bool|string $dbDomain The ID of the target wiki database. Use false for the local wiki.
         */
        public function __construct(
@@ -449,16 +449,15 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
         * Get a cache key for a given Blob address.
         *
         * The cache key is constructed in a way that allows cached blobs from the same database
-        * to be re-used between wikis. For example, enwiki and frwiki will use the same cache keys
-        * for blobs from the wikidatawiki database.
+        * to be re-used between wikis. For example, wiki A and wiki B will use the same cache keys
+        * for blobs fetched from wiki C.
         *
         * @param string $blobAddress
         * @return string
         */
        private function getCacheKey( $blobAddress ) {
                return $this->cache->makeGlobalKey(
-                       'BlobStore',
-                       'address',
+                       'SqlBlobStore-blob',
                        $this->dbLoadBalancer->resolveDomainID( $this->dbDomain ),
                        $blobAddress
                );
index bdff7a7..de418a7 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 use MediaWiki\Permissions\PermissionManager;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Assert\Assert;
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
index a48d032..c94e8d4 100644 (file)
@@ -547,7 +547,7 @@ class WebRequest {
         *
         * @param string $name
         * @param array|null $default Option default (or null)
-        * @return array Array of ints
+        * @return int[]|null
         */
        public function getIntArray( $name, $default = null ) {
                $val = $this->getArray( $name, $default );
index f892c5e..4be2f7d 100644 (file)
@@ -22,7 +22,7 @@
 use MediaWiki\MediaWikiServices;
 
 /**
- * @defgroup Actions Action done on pages
+ * @defgroup Actions Actions
  */
 
 /**
index 9a8949f..0360fe4 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\Database;
 
 /**
index 519da61..1c9e63b 100644 (file)
@@ -20,7 +20,7 @@
  * @ingroup Actions
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * User interface for the rollback action
index 8a231cb..56be456 100644 (file)
@@ -35,6 +35,9 @@ class SpecialPageAction extends FormlessAction {
                'editchangetags' => 'EditTags',
        ];
 
+       /**
+        * @inheritDoc
+        */
        public function getName() {
                $request = $this->getRequest();
                $actionName = $request->getVal( 'action', 'view' );
index 05eb438..6e788d5 100644 (file)
@@ -26,6 +26,9 @@ use MediaWiki\Revision\RevisionArchiveRecord;
 use MediaWiki\Revision\RevisionStore;
 use MediaWiki\Revision\SlotRecord;
 
+/**
+ * @ingroup API
+ */
 class ApiComparePages extends ApiBase {
 
        /** @var RevisionStore */
@@ -249,6 +252,7 @@ class ApiComparePages extends ApiBase {
                        );
                        if ( $row ) {
                                $rev = $this->revisionStore->newRevisionFromArchiveRow( $row );
+                               // @phan-suppress-next-line PhanUndeclaredProperty
                                $rev->isArchive = true;
                        }
                }
@@ -617,6 +621,7 @@ class ApiComparePages extends ApiBase {
                                }
                        }
 
+                       // @phan-suppress-next-line PhanUndeclaredProperty
                        if ( !empty( $rev->isArchive ) ) {
                                $this->getMain()->setCacheMode( 'private' );
                                $vals["{$prefix}archive"] = true;
index 06f6f60..1936407 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * A module that allows for editing and creating pages.
index 6b892fa..3052b89 100644 (file)
@@ -21,6 +21,9 @@
  * @file
  */
 
+/**
+ * @ingroup API
+ */
 class ApiFormatXmlRsd extends ApiFormatXml {
        public function __construct( ApiMain $main, $format ) {
                parent::__construct( $main, $format );
index 7aebf90..0272dcd 100644 (file)
@@ -28,6 +28,7 @@
  * 'APIGetParamDescriptionMessages' hook simple.
  *
  * @since 1.25
+ * @ingroup API
  */
 class ApiHelpParamValueMessage extends Message {
 
index 1f8b012..8a0e8c9 100644 (file)
@@ -1,7 +1,4 @@
 <?php
-
-use MediaWiki\MediaWikiServices;
-
 /**
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +18,11 @@ use MediaWiki\MediaWikiServices;
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
+/**
+ * @ingroup API
+ */
 class ApiImageRotate extends ApiBase {
        private $mPageSet = null;
 
index 40edafa..2e7db78 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * @ingroup API
index d21f111..a6b15e9 100644 (file)
@@ -41,6 +41,9 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
        private $redirect;
        private $bl_ns, $bl_from, $bl_from_ns, $bl_table, $bl_code, $bl_title, $bl_fields, $hasNS;
 
+       /** @var string */
+       private $helpUrl;
+
        /**
         * Maps ns and title to pageid
         *
index eb787d1..b8caeb9 100644 (file)
@@ -22,7 +22,7 @@
 
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Storage\NameTableAccessException;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Query module to enumerate all deleted revisions.
index 26c17c5..12e908f 100644 (file)
@@ -61,7 +61,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
         * @param string $name
         * @return QueryPage
         */
-       private function getSpecialPage( $name ) {
+       private function getSpecialPage( $name ) : QueryPage {
                $qp = $this->specialPageFactory->getPage( $name );
                if ( !$qp ) {
                        self::dieDebug(
index 2e20529..4c2f27e 100644 (file)
@@ -29,6 +29,7 @@ use MediaWiki\Config\ServiceOptions;
 use MediaWiki\Permissions\PermissionManager;
 use MediaWiki\User\UserIdentity;
 use MWCryptHash;
+use Psr\Log\LoggerInterface;
 use User;
 use WebRequest;
 use WebResponse;
@@ -41,6 +42,12 @@ use Wikimedia\IPSet;
  * @since 1.34 Refactored from User and Block.
  */
 class BlockManager {
+       /** @var PermissionManager */
+       private $permissionManager;
+
+       /** @var ServiceOptions */
+       private $options;
+
        /**
         * TODO Make this a const when HHVM support is dropped (T192166)
         *
@@ -59,17 +66,23 @@ class BlockManager {
                'SoftBlockRanges',
        ];
 
+       /** @var LoggerInterface */
+       private $logger;
+
        /**
         * @param ServiceOptions $options
         * @param PermissionManager $permissionManager
+        * @param LoggerInterface $logger
         */
        public function __construct(
                ServiceOptions $options,
-               PermissionManager $permissionManager
+               PermissionManager $permissionManager,
+               LoggerInterface $logger
        ) {
                $options->assertRequiredOptions( self::$constructorOptions );
                $this->options = $options;
                $this->permissionManager = $permissionManager;
+               $this->logger = $logger;
        }
 
        /**
@@ -392,15 +405,14 @@ class BlockManager {
                                $ipList = $this->checkHost( $hostname );
 
                                if ( $ipList ) {
-                                       wfDebugLog(
-                                               'dnsblacklist',
+                                       $this->logger->info(
                                                "Hostname $hostname is {$ipList[0]}, it's a proxy says $basename!"
                                        );
                                        $found = true;
                                        break;
                                }
 
-                               wfDebugLog( 'dnsblacklist', "Requested $hostname, not found in $basename." );
+                               $this->logger->debug( "Requested $hostname, not found in $basename." );
                        }
                }
 
index 14e391d..5a7f45e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Helper class for category membership changes
index 79092ee..e60cc09 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Feed to Special:RecentChanges and Special:RecentChangesLinked.
index a48e191..fbcbc35 100644 (file)
@@ -23,7 +23,7 @@
  */
 use MediaWiki\Linker\LinkRenderer;
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IResultWrapper;
 
 class ChangesList extends ContextSource {
index e461762..d2c4dd4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Generates a list of changes using an Enhanced system (uses javascript).
index a048a22..83720d3 100644 (file)
@@ -20,7 +20,7 @@
  * @file
  */
 use MediaWiki\Linker\LinkRenderer;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 class RCCacheEntryFactory {
 
@@ -56,7 +56,6 @@ class RCCacheEntryFactory {
         */
        public function newFromRecentChange( RecentChange $baseRC, $watched ) {
                $user = $this->context->getUser();
-               $counter = $baseRC->counter;
 
                $cacheEntry = RCCacheEntry::newFromParent( $baseRC );
 
@@ -73,8 +72,8 @@ class RCCacheEntryFactory {
                // called too many times (50% of CPU time on RecentChanges!).
                $showDiffLinks = $this->showDiffLinks( $cacheEntry, $user );
 
-               $cacheEntry->difflink = $this->buildDiffLink( $cacheEntry, $showDiffLinks, $counter );
-               $cacheEntry->curlink = $this->buildCurLink( $cacheEntry, $showDiffLinks, $counter );
+               $cacheEntry->difflink = $this->buildDiffLink( $cacheEntry, $showDiffLinks );
+               $cacheEntry->curlink = $this->buildCurLink( $cacheEntry, $showDiffLinks );
                $cacheEntry->lastlink = $this->buildLastLink( $cacheEntry, $showDiffLinks );
 
                // Make user links
@@ -182,11 +181,10 @@ class RCCacheEntryFactory {
        /**
         * @param RecentChange $cacheEntry
         * @param bool $showDiffLinks
-        * @param int $counter
         *
         * @return string
         */
-       private function buildCurLink( RecentChange $cacheEntry, $showDiffLinks, $counter ) {
+       private function buildCurLink( RecentChange $cacheEntry, $showDiffLinks ) {
                $queryParams = $this->buildCurQueryParams( $cacheEntry );
                $curMessage = $this->getMessage( 'cur' );
                $logTypes = [ RC_LOG ];
@@ -217,11 +215,10 @@ class RCCacheEntryFactory {
        /**
         * @param RecentChange $cacheEntry
         * @param bool $showDiffLinks
-        * @param int $counter
         *
         * @return string
         */
-       private function buildDiffLink( RecentChange $cacheEntry, $showDiffLinks, $counter ) {
+       private function buildDiffLink( RecentChange $cacheEntry, $showDiffLinks ) {
                $queryParams = $this->buildDiffQueryParams( $cacheEntry );
                $diffMessage = $this->getMessage( 'diff' );
                $logTypes = [ RC_NEW, RC_LOG ];
index 1827aab..ce82b71 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Item class for a logging table row with its associated change tags.
index 170d5c2..8f4f058 100644 (file)
@@ -45,6 +45,9 @@ class CustomUppercaseCollation extends NumericUppercaseCollation {
        /** @var array $puaSubset List of private use area codes */
        private $puaSubset;
 
+       /** @var array */
+       private $firstLetters;
+
        /**
         * @note This assumes $alphabet does not contain U+F3000-U+F3FFF
         *
index 9fbb72c..533f639 100644 (file)
@@ -26,7 +26,7 @@
  * @author Daniel Kinzler
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Assert\Assert;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
index a48faf1..56fc0b3 100644 (file)
@@ -10,6 +10,9 @@ use Psr\Log\AbstractLogger;
  * goal.
  */
 class ConsoleLogger extends AbstractLogger {
+       /** @var string */
+       private $channel;
+
        /**
         * @param string $channel
         */
index c1b3595..fd200d1 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 use MediaWiki\MediaWikiServices as MediaWikiServicesAlias;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
index 42e78ff..ff8f056 100644 (file)
@@ -142,6 +142,12 @@ class FileRepo {
        /** @var WANObjectCache */
        protected $wanCache;
 
+       /**
+        * @var string
+        * @protected Use $this->getName(). Public for back-compat only
+        */
+       public $name;
+
        /**
         * @param array|null $info
         * @throws MWException
index 17fa146..b4fd176 100644 (file)
@@ -94,6 +94,9 @@ class ArchivedFile {
        /** @var Title */
        protected $title; # image title
 
+       /** @var bool */
+       private $exists;
+
        /**
         * @throws MWException
         * @param Title $title
index 85988f6..f363beb 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Helper class for file deletion
index 6e760fa..a5d7145 100644 (file)
@@ -149,6 +149,5 @@ if ( false ) {
        // autoload entries for the lowercase variants of these classes (T166759).
        // The code below is never executed, but it is picked up by the AutoloadGenerator
        // parser, which scans for class_alias() calls.
-       // @phan-suppress-next-line PhanRedefineClassAlias
        class_alias( ConcatenatedGzipHistoryBlob::class, 'concatenatedgziphistoryblob' );
 }
index cd2a935..8858c8d 100644 (file)
@@ -69,6 +69,5 @@ if ( false ) {
        // autoload entries for the lowercase variants of these classes (T166759).
        // The code below is never executed, but it is picked up by the AutoloadGenerator
        // parser, which scans for class_alias() calls.
-       // @phan-suppress-next-line PhanRedefineClassAlias
        class_alias( HistoryBlobCurStub::class, 'historyblobcurstub' );
 }
index c92e1b5..9a4df1f 100644 (file)
@@ -149,6 +149,5 @@ if ( false ) {
        // autoload entries for the lowercase variants of these classes (T166759).
        // The code below is never executed, but it is picked up by the AutoloadGenerator
        // parser, which scans for class_alias() calls.
-       // @phan-suppress-next-line PhanRedefineClassAlias
        class_alias( HistoryBlobStub::class, 'historyblobstub' );
 }
index 048abbb..b55b652 100644 (file)
@@ -657,6 +657,7 @@ abstract class HTMLFormField {
         * @param OOUI\Widget $inputField
         * @param array $config
         * @return OOUI\FieldLayout|OOUI\ActionFieldLayout
+        * @suppress PhanUndeclaredProperty Only some subclasses declare mClassWithButton
         */
        protected function getFieldLayoutOOUI( $inputField, $config ) {
                if ( isset( $this->mClassWithButton ) ) {
index 354432b..05ab0bb 100644 (file)
@@ -11,6 +11,9 @@
  * @todo FIXME: If made 'required', only the text field should be compulsory.
  */
 class HTMLSelectAndOtherField extends HTMLSelectField {
+       /** @var string[] */
+       private $mFlatOptions;
+
        public function __construct( $params ) {
                if ( array_key_exists( 'other', $params ) ) {
                        // Do nothing
index a4120a3..13ab9b7 100644 (file)
@@ -29,6 +29,7 @@ use GuzzleHttp\Psr7\StreamDecoratorTrait;
  *
  * @private for use by GuzzleHttpRequest only
  * @since 1.33
+ * @property StreamInterface $stream Defined in StreamDecoratorTrait via @property, not read by phan
  */
 class MWCallbackStream implements StreamInterface {
        use StreamDecoratorTrait;
index 2f8f5dd..81e414e 100644 (file)
@@ -30,6 +30,9 @@ use MediaWiki\MediaWikiServices;
  * @ingroup SpecialPage
  */
 class ImportStreamSource implements ImportSource {
+       /** @var resource */
+       private $mHandle;
+
        /**
         * @param resource $handle
         */
index 0d1cc68..6eba4f3 100644 (file)
@@ -33,7 +33,8 @@ use MediaWiki\MediaWikiServices;
  * @ingroup SpecialPage
  */
 class WikiImporter {
-       private $reader = null;
+       /** @var XMLReader */
+       private $reader;
        private $foreignNamespaces = null;
        private $mLogItemCallback, $mUploadCallback, $mRevisionCallback, $mPageCallback;
        private $mSiteInfoCallback, $mPageOutCallback;
index 08cfd86..eb96e05 100644 (file)
@@ -21,6 +21,9 @@
  */
 
 class InstallDocFormatter {
+       /** @var string */
+       private $text;
+
        public static function format( $text ) {
                $obj = new self( $text );
 
index a2179c6..6921361 100644 (file)
@@ -30,6 +30,7 @@
 class LocalSettingsGenerator {
 
        protected $extensions = [];
+       protected $skins = [];
        protected $values = [];
        protected $groupPermissions = [];
        protected $dbSettings = '';
index 64c017b..ea88411 100644 (file)
@@ -29,7 +29,7 @@ use MediaWiki\MediaWikiServices;
  *
  * @ingroup Deployment
  * @since 1.17
- * @property DatabaseMysqlBase $db
+ * @property Wikimedia\Rdbms\DatabaseMysqlBase $db
  */
 class MysqlUpdater extends DatabaseUpdater {
        protected function getCoreUpdateList() {
index 9a3d4a3..e9b0c56 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\DatabasePostgres;
 use Wikimedia\Rdbms\DBQueryError;
 use Wikimedia\Rdbms\DBConnectionError;
 
index 652c36a..565a65f 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * This class formats delete log entries.
index 3b904e8..d54dd6b 100644 (file)
@@ -240,6 +240,7 @@ class DjVuHandler extends ImageHandler {
         * @param File|FSFile $image
         * @param string $path
         * @return DjVuImage
+        * @suppress PhanUndeclaredProperty Custom property
         */
        function getDjVuImage( $image, $path ) {
                if ( !$image ) {
@@ -290,6 +291,7 @@ class DjVuHandler extends ImageHandler {
         * @param File $image
         * @param bool $gettext DOCUMENT (Default: false)
         * @return bool|SimpleXMLElement
+        * @suppress PhanUndeclaredProperty Custom property
         */
        public function getMetaTree( $image, $gettext = false ) {
                if ( $gettext && isset( $image->djvuTextTree ) ) {
index 92fad52..50b13a4 100644 (file)
@@ -42,6 +42,9 @@ class DjVuImage {
         */
        const DJVUTXT_MEMORY_LIMIT = 300000;
 
+       /** @var string */
+       private $mFilename;
+
        /**
         * @param string $filename The DjVu file name.
         */
index 5e99ac9..87edc8b 100644 (file)
@@ -351,30 +351,6 @@ class ObjectCache {
                return self::getInstance( $wgMainCacheType );
        }
 
-       /**
-        * Get the main WAN cache object.
-        *
-        * @since 1.26
-        * @return WANObjectCache
-        * @deprecated Since 1.28 Use MediaWikiServices::getInstance()->getMainWANObjectCache()
-        */
-       public static function getMainWANInstance() {
-               wfDeprecated( __METHOD__, '1.28' );
-               return MediaWikiServices::getInstance()->getMainWANObjectCache();
-       }
-
-       /**
-        * Get the cache object for the main stash.
-        *
-        * @return BagOStuff
-        * @since 1.26
-        * @deprecated Since 1.28 Use MediaWikiServices::getInstance()->getMainObjectStash()
-        */
-       public static function getMainStashInstance() {
-               wfDeprecated( __METHOD__, '1.28' );
-               return MediaWikiServices::getInstance()->getMainObjectStash();
-       }
-
        /**
         * Clear all the cached instances.
         */
index 40c63d2..8b2ff6b 100644 (file)
@@ -756,10 +756,14 @@ class PageArchive {
 
                        Hooks::run( 'ArticleUndelete',
                                [ &$this->title, $created, $comment, $oldPageId, $restoredPages ] );
+
                        if ( $this->title->getNamespace() == NS_FILE ) {
-                               DeferredUpdates::addUpdate(
-                                       new HTMLCacheUpdate( $this->title, 'imagelinks', 'file-restore' )
+                               $job = HTMLCacheUpdateJob::newForBacklinks(
+                                       $this->title,
+                                       'imagelinks',
+                                       [ 'causeAction' => 'file-restore' ]
                                );
+                               JobQueueGroup::singleton()->lazyPush( $job );
                        }
                }
 
index acd506b..fd9f7b2 100644 (file)
@@ -176,9 +176,12 @@ class WikiFilePage extends WikiPage {
 
                if ( $this->mFile->exists() ) {
                        wfDebug( 'ImagePage::doPurge purging ' . $this->mFile->getName() . "\n" );
-                       DeferredUpdates::addUpdate(
-                               new HTMLCacheUpdate( $this->mTitle, 'imagelinks', 'file-purge' )
+                       $job = HTMLCacheUpdateJob::newForBacklinks(
+                               $this->mTitle,
+                               'imagelinks',
+                               [ 'causeAction' => 'file-purge' ]
                        );
+                       JobQueueGroup::singleton()->lazyPush( $job );
                } else {
                        wfDebug( 'ImagePage::doPurge no image for '
                                . $this->mFile->getName() . "; limiting purge to cache only\n" );
index f0a656d..c8566ac 100644 (file)
@@ -3404,9 +3404,12 @@ class WikiPage implements Page, IDBAccessObject {
                MediaWikiServices::getInstance()->getLinkCache()->invalidateTitle( $title );
 
                // Invalidate caches of articles which include this page
-               DeferredUpdates::addUpdate(
-                       new HTMLCacheUpdate( $title, 'templatelinks', 'page-create' )
+               $job = HTMLCacheUpdateJob::newForBacklinks(
+                       $title,
+                       'templatelinks',
+                       [ 'causeAction' => 'page-create' ]
                );
+               JobQueueGroup::singleton()->lazyPush( $job );
 
                if ( $title->getNamespace() == NS_CATEGORY ) {
                        // Load the Category object, which will schedule a job to create
@@ -3448,9 +3451,12 @@ class WikiPage implements Page, IDBAccessObject {
 
                // Images
                if ( $title->getNamespace() == NS_FILE ) {
-                       DeferredUpdates::addUpdate(
-                               new HTMLCacheUpdate( $title, 'imagelinks', 'page-delete' )
+                       $job = HTMLCacheUpdateJob::newForBacklinks(
+                               $title,
+                               'imagelinks',
+                               [ 'causeAction' => 'page-delete' ]
                        );
+                       JobQueueGroup::singleton()->lazyPush( $job );
                }
 
                // User talk pages
@@ -3482,20 +3488,24 @@ class WikiPage implements Page, IDBAccessObject {
                $slotsChanged = null
        ) {
                // TODO: move this into a PageEventEmitter service
-
-               if ( $slotsChanged === null || in_array( SlotRecord::MAIN,  $slotsChanged ) ) {
+               $jobs = [];
+               if ( $slotsChanged === null || in_array( SlotRecord::MAIN, $slotsChanged ) ) {
                        // Invalidate caches of articles which include this page.
                        // Only for the main slot, because only the main slot is transcluded.
                        // TODO: MCR: not true for TemplateStyles! [SlotHandler]
-                       DeferredUpdates::addUpdate(
-                               new HTMLCacheUpdate( $title, 'templatelinks', 'page-edit' )
+                       $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
+                               $title,
+                               'templatelinks',
+                               [ 'causeAction' => 'page-edit' ]
                        );
                }
-
                // Invalidate the caches of all pages which redirect here
-               DeferredUpdates::addUpdate(
-                       new HTMLCacheUpdate( $title, 'redirect', 'page-edit' )
+               $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
+                       $title,
+                       'redirect',
+                       [ 'causeAction' => 'page-edit' ]
                );
+               JobQueueGroup::singleton()->lazyPush( $jobs );
 
                MediaWikiServices::getInstance()->getLinkCache()->invalidateTitle( $title );
 
index e1f4f38..b803241 100644 (file)
@@ -1121,7 +1121,7 @@ class CoreParserFunctions {
         * @param Parser $parser
         * @param Title $title
         * @param string $vary ParserOuput vary-* flag
-        * @return Revision
+        * @return Revision|null
         * @since 1.23
         */
        private static function getCachedRevisionObject( $parser, $title, $vary ) {
index 6474b7d..2b0f5ed 100644 (file)
@@ -336,6 +336,7 @@ class ResourceLoaderImage {
                // Reattach all direct children of the `<svg>` root node to the `<g>` wrapper
                while ( $root->firstChild ) {
                        $node = $root->firstChild;
+                       // @phan-suppress-next-line PhanUndeclaredProperty False positive
                        if ( !$titleNode && $node->nodeType === XML_ELEMENT_NODE && $node->tagName === 'title' ) {
                                // Remember the first encountered `<title>` node
                                $titleNode = $node;
index edbd44b..37501d4 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 use MediaWiki\Linker\LinkTarget;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Assert\Assert;
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
index 5b03ad0..ab5d954 100644 (file)
@@ -19,7 +19,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Item class for a filearchive table row
index 8c080ba..33ce11b 100644 (file)
@@ -19,7 +19,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Item class for an oldimage table row
index f4ea54f..746ca27 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Abstract base class for a list of deletable items. The list class
index edb86da..829eefa 100644 (file)
@@ -19,7 +19,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Item class for a logging table row
index fcdcb9a..adb3974 100644 (file)
@@ -19,7 +19,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IDatabase;
 
 /**
index f61d378..604ab2c 100644 (file)
@@ -19,7 +19,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Item class for a live revision table row
index 0705503..011386e 100644 (file)
@@ -19,7 +19,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\FakeResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
index 9a9ab19..00e77e1 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IDatabase;
 
 /**
index 3ab96cb..6361a7a 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup RevisionDelete
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * General controller for RevDel, used by both SpecialRevisiondelete and
index bf90c06..85c01c8 100644 (file)
@@ -20,7 +20,7 @@
  * @file
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Item class for a live revision table row
index 14c9a73..3e2a9a2 100644 (file)
@@ -176,7 +176,7 @@ class MediaWikiSite extends Site {
         *
         * @param string|bool $pageName Page name or false (default: false)
         *
-        * @return string
+        * @return string|bool|null
         */
        public function getPageUrl( $pageName = false ) {
                $url = $this->getLinkPath();
index bcf8b32..10711a6 100644 (file)
@@ -365,7 +365,7 @@ class Site implements Serializable {
         *
         * @param bool|string $pageName
         *
-        * @return string|bool
+        * @return string|bool|null
         */
        public function getPageUrl( $pageName = false ) {
                $url = $this->getLinkPath();
index 0954c45..bf5734a 100644 (file)
@@ -884,87 +884,85 @@ abstract class ChangesListSpecialPage extends SpecialPage {
        }
 
        /**
-        * Get (cheap to compute) information about change tags.
+        * Get information about change tags, without parsing messages, for getRcFiltersConfigSummary().
+        *
+        * Message contents are the raw values (->plain()), because parsing messages is expensive.
+        * Even though we're not parsing messages, building a data structure with the contents of
+        * hundreds of i18n messages is still not cheap (see T223260#5370610), so the result of this
+        * function is cached in WANCache for 24 hours.
         *
         * Returns an array of associative arrays with information about each tag:
         * - name: Tag name (string)
         * - labelMsg: Short description message (Message object)
+        * - label: Short description message (raw message contents)
         * - descriptionMsg: Long description message (Message object)
+        * - description: Long description message (raw message contents)
         * - cssClass: CSS class to use for RC entries with this tag
         * - hits: Number of RC entries that have this tag
         *
         * @param ResourceLoaderContext $context
         * @return array[] Information about each tag
         */
-       protected static function getChangeTagInfo( ResourceLoaderContext $context ) {
-               $explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
-               $softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), 0 );
-
-               $tagStats = ChangeTags::tagUsageStatistics();
-               $tagHitCounts = array_merge( $explicitlyDefinedTags, $softwareActivatedTags, $tagStats );
-
-               $result = [];
-               foreach ( $tagHitCounts as $tagName => $hits ) {
-                       if (
-                               (
-                                       // Only get active tags
-                                       isset( $explicitlyDefinedTags[ $tagName ] ) ||
-                                       isset( $softwareActivatedTags[ $tagName ] )
-                               ) &&
-                               // Only get tags with more than 0 hits
-                               $hits > 0
-                       ) {
-                               $labelMsg = ChangeTags::tagShortDescriptionMessage( $tagName, $context );
-                               if ( $labelMsg === false ) {
-                                       // Tag is hidden, skip it
-                                       continue;
-                               }
-                               $result[] = [
-                                       'name' => $tagName,
-                                       // 'label' and 'description' filled in by getChangeTagList()
-                                       'labelMsg' => $labelMsg,
-                                       'descriptionMsg' => ChangeTags::tagLongDescriptionMessage( $tagName, $context ),
-                                       'cssClass' => Sanitizer::escapeClass( 'mw-tag-' . $tagName ),
-                                       'hits' => $hits,
-                               ];
-                       }
-               }
-               return $result;
-       }
-
-       /**
-        * Get information about change tags for use in getRcFiltersConfigSummary().
-        *
-        * This expands labelMsg and descriptionMsg to the raw values of each message, which captures
-        * changes in the messages but avoids the expensive step of parsing them.
-        *
-        * @param ResourceLoaderContext $context
-        * @return array[] Result of getChangeTagInfo(), with messages expanded to raw contents
-        */
        protected static function getChangeTagListSummary( ResourceLoaderContext $context ) {
-               $tags = self::getChangeTagInfo( $context );
-               foreach ( $tags as &$tagInfo ) {
-                       $tagInfo['labelMsg'] = $tagInfo['labelMsg']->plain();
-                       if ( $tagInfo['descriptionMsg'] ) {
-                               $tagInfo['descriptionMsg'] = $tagInfo['descriptionMsg']->plain();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+               return $cache->getWithSetCallback(
+                       $cache->makeKey( 'ChangesListSpecialPage-changeTagListSummary', $context->getLanguage() ),
+                       WANObjectCache::TTL_DAY,
+                       function ( $oldValue, &$ttl, array &$setOpts ) use ( $context ) {
+                               $explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
+                               $softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), 0 );
+
+                               $tagStats = ChangeTags::tagUsageStatistics();
+                               $tagHitCounts = array_merge( $explicitlyDefinedTags, $softwareActivatedTags, $tagStats );
+
+                               $result = [];
+                               foreach ( $tagHitCounts as $tagName => $hits ) {
+                                       if (
+                                               (
+                                                       // Only get active tags
+                                                       isset( $explicitlyDefinedTags[ $tagName ] ) ||
+                                                       isset( $softwareActivatedTags[ $tagName ] )
+                                               ) &&
+                                               // Only get tags with more than 0 hits
+                                               $hits > 0
+                                       ) {
+                                               $labelMsg = ChangeTags::tagShortDescriptionMessage( $tagName, $context );
+                                               if ( $labelMsg === false ) {
+                                                       // Tag is hidden, skip it
+                                                       continue;
+                                               }
+                                               $descriptionMsg = ChangeTags::tagLongDescriptionMessage( $tagName, $context );
+                                               $result[] = [
+                                                       'name' => $tagName,
+                                                       'labelMsg' => $labelMsg,
+                                                       'label' => $labelMsg->plain(),
+                                                       'descriptionMsg' => $descriptionMsg,
+                                                       'description' => $descriptionMsg ? $descriptionMsg->plain() : '',
+                                                       'cssClass' => Sanitizer::escapeClass( 'mw-tag-' . $tagName ),
+                                                       'hits' => $hits,
+                                               ];
+                                       }
+                               }
+                               return $result;
                        }
-               }
-               return $tags;
+               );
        }
 
        /**
         * Get information about change tags to export to JS via getRcFiltersConfigVars().
         *
-        * This removes labelMsg and descriptionMsg, and adds label and description, which are parsed,
-        * stripped and (in the case of description) truncated versions of these messages. Message
+        * This manipulates the label and description of each tag, which are parsed, stripped
+        * and (in the case of description) truncated versions of these messages. Message
         * parsing is expensive, so to detect whether the tag list has changed, use
         * getChangeTagListSummary() instead.
         *
+        * The result of this function is cached in WANCache for 24 hours.
+        *
         * @param ResourceLoaderContext $context
-        * @return array[] Result of getChangeTagInfo(), with messages parsed, stripped and truncated
+        * @return array[] Same as getChangeTagListSummary(), with messages parsed, stripped and truncated
         */
        protected static function getChangeTagList( ResourceLoaderContext $context ) {
-               $tags = self::getChangeTagInfo( $context );
+               $tags = self::getChangeTagListSummary( $context );
                $language = Language::factory( $context->getLanguage() );
                foreach ( $tags as &$tagInfo ) {
                        $tagInfo['label'] = Sanitizer::stripAllTags( $tagInfo['labelMsg']->parse() );
index 2dd682f..4ba9b65 100644 (file)
@@ -23,6 +23,7 @@
 
 use MediaWiki\Block\DatabaseBlock;
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\IDatabase;
 
 /**
  * A special page that lists existing blocks
index 5b77d5a..1babf8c 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup SpecialPage
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Special page allowing users with the appropriate permissions to
index 698e590..67177b7 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use MediaWiki\Permissions\PermissionManager;
 
 /**
index 2c8d432..34665dd 100644 (file)
@@ -381,6 +381,7 @@ class SpecialTags extends SpecialPage {
 
                $form = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
                $form->setAction( $this->getPageTitle( 'delete' )->getLocalURL() );
+               // @phan-suppress-next-line PhanUndeclaredProperty
                $form->tagAction = 'delete'; // custom property on HTMLForm object
                $form->setSubmitCallback( [ $this, 'processTagForm' ] );
                $form->setSubmitTextMsg( 'tags-delete-submit' );
@@ -433,6 +434,7 @@ class SpecialTags extends SpecialPage {
 
                $form = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
                $form->setAction( $this->getPageTitle( $actionStr )->getLocalURL() );
+               // @phan-suppress-next-line PhanUndeclaredProperty
                $form->tagAction = $actionStr;
                $form->setSubmitCallback( [ $this, 'processTagForm' ] );
                // tags-activate-submit, tags-deactivate-submit
@@ -441,6 +443,12 @@ class SpecialTags extends SpecialPage {
                $form->show();
        }
 
+       /**
+        * @param array $data
+        * @param HTMLForm $form
+        * @return bool
+        * @suppress PhanUndeclaredProperty $form->tagAction
+        */
        public function processTagForm( array $data, HTMLForm $form ) {
                $context = $form->getContext();
                $out = $context->getOutput();
index b1bfd0b..445f0c3 100644 (file)
@@ -111,6 +111,8 @@ class PreferencesFormOOUI extends OOUIHTMLForm {
        function filterDataForSubmit( $data ) {
                foreach ( $this->mFlatFields as $fieldname => $field ) {
                        if ( $field instanceof HTMLNestedFilterable ) {
+                               // @phan-suppress-next-next-line PhanUndeclaredProperty All HTMLForm fields have mParams,
+                               // but the instanceof confuses phan, which doesn't support intersections
                                $info = $field->mParams;
                                $prefix = $info['prefix'] ?? $fieldname;
                                foreach ( $field->filterDataForSubmit( $data[$fieldname] ) as $key => $value ) {
index 3a56a87..95749ba 100644 (file)
@@ -25,7 +25,7 @@
  */
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Linker\LinkRenderer;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\FakeResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
index 2893759..0ff54fd 100644 (file)
@@ -24,7 +24,7 @@
  */
 use MediaWiki\Linker\LinkRenderer;
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IDatabase;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\FakeResultWrapper;
index 3bd66d4..3ebb443 100644 (file)
@@ -237,6 +237,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser {
         * @param LinkTarget $title
         *
         * @return string
+        * @suppress PhanUndeclaredProperty
         */
        public function getPrefixedText( LinkTarget $title ) {
                if ( !isset( $title->prefixedText ) ) {
index f3a8810..77ea3d9 100644 (file)
@@ -34,7 +34,7 @@ class AvroValidator {
         * @return string|string[] An error or list of errors in the
         *  provided $datum. When no errors exist the empty array is
         *  returned.
-        * @suppress PhanUndeclaredMethod
+        * @suppress PhanUndeclaredMethod,PhanUndeclaredProperty
         */
        public static function getErrors( AvroSchema $schema, $datum ) {
                switch ( $schema->type ) {
index df5ea70..13f2b52 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 use MediaWiki\Linker\LinkTarget;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use MediaWiki\User\UserIdentity;
 use Wikimedia\Assert\Assert;
 use Wikimedia\Rdbms\IDatabase;
index 9886425..f42bb88 100644 (file)
@@ -21,7 +21,7 @@
 use MediaWiki\MediaWikiServices;
 
 use MediaWiki\Logger\LoggerFactory;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * Base class for language conversion.
index 353127d..783a211 100644 (file)
@@ -80,7 +80,7 @@ class Names {
                'az' => 'azərbaycanca', # Azerbaijani
                'azb' => 'تۆرکجه', # South Azerbaijani
                'ba' => 'башҡортса', # Bashkir
-               'ban' => 'Basa Bali', # Balinese
+               'ban' => 'Bali', # Balinese
                'bar' => 'Boarisch', # Bavarian (Austro-Bavarian and South Tyrolean)
                'bat-smg' => 'žemaitėška', # Samogitian (deprecated code, 'sgs' in ISO 639-3 since 2010-06-30 )
                'bbc' => 'Batak Toba', # Batak Toba (falls back to bbc-latn)
index 1a5daca..6ea046e 100644 (file)
@@ -59,11 +59,6 @@ ALIASES                = "type{1}=<b> \1 </b>:" \
                          "codeCoverageIgnore=" \
                          "codingStandardsIgnoreEnd=" \
                          "codingStandardsIgnoreStart=" \
-                         "covers=" \
-                         "dataProvider=" \
-                         "expectedException=" \
-                         "expectedExceptionMessage=" \
-                         "group=" \
                          "phan=" \
                          "suppress="
 TCL_SUBST              =
@@ -112,8 +107,8 @@ SORT_GROUP_NAMES       = NO
 SORT_BY_SCOPE_NAME     = NO
 STRICT_PROTO_MATCHING  = NO
 GENERATE_TODOLIST      = YES
-GENERATE_TESTLIST      = YES
-GENERATE_BUGLIST       = YES
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
 GENERATE_DEPRECATEDLIST= YES
 ENABLED_SECTIONS       =
 MAX_INITIALIZER_LINES  = 30
index 6faeee8..98a2b59 100644 (file)
@@ -23,6 +23,8 @@
 
 require __DIR__ . '/../commandLine.inc';
 
+use Wikimedia\Rdbms\Database;
+
 /**
  * Maintenance script that upgrade for log_id/log_deleted fields in a
  * replication-safe way.
index 4cc52a4..60f3884 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Maintenance
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 require_once __DIR__ . '/Maintenance.php';
 
index d4f9c2d..03035f7 100644 (file)
@@ -20,6 +20,7 @@
  *
  * @file
  * @ingroup Maintenance
+ * @phan-file-suppress PhanUndeclaredProperty Lots of custom properties
  */
 
 require_once __DIR__ . '/Maintenance.php';
index ca67c83..3b7ba63 100644 (file)
@@ -23,7 +23,7 @@
  * @ingroup Maintenance
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 require_once __DIR__ . '/Maintenance.php';
 
index e48b6ab..1e73540 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Maintenance
  */
 
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IDatabase;
 
 require_once __DIR__ . '/Maintenance.php';
index fddac8a..ec759da 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 
 require_once __DIR__ . '/dumpIterator.php';
 
index 3f48abb..c1170fc 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use Wikimedia\Rdbms\IDatabase;
 
 require_once __DIR__ . '/Maintenance.php';
index 038ef23..5f7f9d5 100644 (file)
@@ -36,7 +36,7 @@ use Wikimedia\Rdbms\IMaintainableDatabase;
  */
 class UserDupes {
        /**
-        * @var Database
+        * @var IMaintainableDatabase
         */
        private $db;
        private $reassigned;
index 180ed65..bcbe96d 100644 (file)
@@ -163,7 +163,10 @@ return [
                'targets' => [ 'mobile', 'desktop' ],
        ],
        'jquery.checkboxShiftClick' => [
-               'scripts' => 'resources/src/jquery/jquery.checkboxShiftClick.js',
+               'deprecated' => 'Please use "mediawiki.page.ready" instead.',
+               'dependencies' => [
+                       'mediawiki.page.ready',
+               ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'jquery.chosen' => [
@@ -1663,9 +1666,11 @@ return [
                ]
        ],
        'mediawiki.page.ready' => [
-               'scripts' => 'resources/src/mediawiki.page.ready.js',
+               'scripts' => [
+                       'resources/src/mediawiki.page.ready/checkboxShift.js',
+                       'resources/src/mediawiki.page.ready/ready.js',
+               ],
                'dependencies' => [
-                       'jquery.checkboxShiftClick',
                        'mediawiki.util',
                        'mediawiki.notify',
                        'mediawiki.api'
diff --git a/resources/src/jquery/jquery.checkboxShiftClick.js b/resources/src/jquery/jquery.checkboxShiftClick.js
deleted file mode 100644 (file)
index 435e23f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @class jQuery.plugin.checkboxShiftClick
- */
-( function () {
-
-       /**
-        * Enable checkboxes to be checked or unchecked in a row by clicking one,
-        * holding shift and clicking another one.
-        *
-        * @return {jQuery}
-        * @chainable
-        */
-       $.fn.checkboxShiftClick = function () {
-               var prevCheckbox = null,
-                       $box = this;
-               // When our boxes are clicked..
-               $box.on( 'click', function ( e ) {
-                       // And one has been clicked before...
-                       if ( prevCheckbox !== null && e.shiftKey ) {
-                               // Check or uncheck this one and all in-between checkboxes,
-                               // except for disabled ones
-                               $box
-                                       .slice(
-                                               Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
-                                               Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
-                                       )
-                                       .filter( function () {
-                                               return !this.disabled;
-                                       } )
-                                       .prop( 'checked', !!e.target.checked );
-                       }
-                       // Either way, update the prevCheckbox variable to the one clicked now
-                       prevCheckbox = e.target;
-               } );
-               return $box;
-       };
-
-       /**
-        * @class jQuery
-        * @mixins jQuery.plugin.checkboxShiftClick
-        */
-
-}() );
diff --git a/resources/src/mediawiki.page.ready.js b/resources/src/mediawiki.page.ready.js
deleted file mode 100644 (file)
index 0e59da6..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-( function () {
-       mw.hook( 'wikipage.content' ).add( function ( $content ) {
-               var $sortable, $collapsible;
-
-               $collapsible = $content.find( '.mw-collapsible' );
-               if ( $collapsible.length ) {
-                       // Preloaded by Skin::getDefaultModules()
-                       mw.loader.using( 'jquery.makeCollapsible', function () {
-                               $collapsible.makeCollapsible();
-                       } );
-               }
-
-               $sortable = $content.find( 'table.sortable' );
-               if ( $sortable.length ) {
-                       // Preloaded by Skin::getDefaultModules()
-                       mw.loader.using( 'jquery.tablesorter', function () {
-                               $sortable.tablesorter();
-                       } );
-               }
-
-               // Run jquery.checkboxShiftClick
-               $content.find( 'input[type="checkbox"]:not(.noshiftselect)' ).checkboxShiftClick();
-       } );
-
-       // Things outside the wikipage content
-       $( function () {
-               var $nodes;
-
-               // Add accesskey hints to the tooltips
-               $( '[accesskey]' ).updateTooltipAccessKeys();
-
-               $nodes = $( '.catlinks[data-mw="interface"]' );
-               if ( $nodes.length ) {
-                       /**
-                        * Fired when categories are being added to the DOM
-                        *
-                        * It is encouraged to fire it before the main DOM is changed (when $content
-                        * is still detached).  However, this order is not defined either way, so you
-                        * should only rely on $content itself.
-                        *
-                        * This includes the ready event on a page load (including post-edit loads)
-                        * and when content has been previewed with LivePreview.
-                        *
-                        * @event wikipage_categories
-                        * @member mw.hook
-                        * @param {jQuery} $content The most appropriate element containing the content,
-                        *   such as .catlinks
-                        */
-                       mw.hook( 'wikipage.categories' ).fire( $nodes );
-               }
-
-               $( '#t-print a' ).on( 'click', function ( e ) {
-                       window.print();
-                       e.preventDefault();
-               } );
-
-               // Turn logout to a POST action
-               $( '#pt-logout a' ).on( 'click', function ( e ) {
-                       var api = new mw.Api(),
-                               returnUrl = $( '#pt-logout a' ).attr( 'href' );
-                       mw.notify(
-                               mw.message( 'logging-out-notify' ),
-                               { tag: 'logout', autoHide: false }
-                       );
-                       api.postWithToken( 'csrf', {
-                               action: 'logout'
-                       } ).then(
-                               function () {
-                                       location.href = returnUrl;
-                               },
-                               function ( e ) {
-                                       mw.notify(
-                                               mw.message( 'logout-failed', e ),
-                                               { type: 'error', tag: 'logout', autoHide: false }
-                                       );
-                               }
-                       );
-                       e.preventDefault();
-               } );
-       } );
-
-}() );
diff --git a/resources/src/mediawiki.page.ready/checkboxShift.js b/resources/src/mediawiki.page.ready/checkboxShift.js
new file mode 100644 (file)
index 0000000..435e23f
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * @class jQuery.plugin.checkboxShiftClick
+ */
+( function () {
+
+       /**
+        * Enable checkboxes to be checked or unchecked in a row by clicking one,
+        * holding shift and clicking another one.
+        *
+        * @return {jQuery}
+        * @chainable
+        */
+       $.fn.checkboxShiftClick = function () {
+               var prevCheckbox = null,
+                       $box = this;
+               // When our boxes are clicked..
+               $box.on( 'click', function ( e ) {
+                       // And one has been clicked before...
+                       if ( prevCheckbox !== null && e.shiftKey ) {
+                               // Check or uncheck this one and all in-between checkboxes,
+                               // except for disabled ones
+                               $box
+                                       .slice(
+                                               Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
+                                               Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
+                                       )
+                                       .filter( function () {
+                                               return !this.disabled;
+                                       } )
+                                       .prop( 'checked', !!e.target.checked );
+                       }
+                       // Either way, update the prevCheckbox variable to the one clicked now
+                       prevCheckbox = e.target;
+               } );
+               return $box;
+       };
+
+       /**
+        * @class jQuery
+        * @mixins jQuery.plugin.checkboxShiftClick
+        */
+
+}() );
diff --git a/resources/src/mediawiki.page.ready/ready.js b/resources/src/mediawiki.page.ready/ready.js
new file mode 100644 (file)
index 0000000..0e59da6
--- /dev/null
@@ -0,0 +1,82 @@
+( function () {
+       mw.hook( 'wikipage.content' ).add( function ( $content ) {
+               var $sortable, $collapsible;
+
+               $collapsible = $content.find( '.mw-collapsible' );
+               if ( $collapsible.length ) {
+                       // Preloaded by Skin::getDefaultModules()
+                       mw.loader.using( 'jquery.makeCollapsible', function () {
+                               $collapsible.makeCollapsible();
+                       } );
+               }
+
+               $sortable = $content.find( 'table.sortable' );
+               if ( $sortable.length ) {
+                       // Preloaded by Skin::getDefaultModules()
+                       mw.loader.using( 'jquery.tablesorter', function () {
+                               $sortable.tablesorter();
+                       } );
+               }
+
+               // Run jquery.checkboxShiftClick
+               $content.find( 'input[type="checkbox"]:not(.noshiftselect)' ).checkboxShiftClick();
+       } );
+
+       // Things outside the wikipage content
+       $( function () {
+               var $nodes;
+
+               // Add accesskey hints to the tooltips
+               $( '[accesskey]' ).updateTooltipAccessKeys();
+
+               $nodes = $( '.catlinks[data-mw="interface"]' );
+               if ( $nodes.length ) {
+                       /**
+                        * Fired when categories are being added to the DOM
+                        *
+                        * It is encouraged to fire it before the main DOM is changed (when $content
+                        * is still detached).  However, this order is not defined either way, so you
+                        * should only rely on $content itself.
+                        *
+                        * This includes the ready event on a page load (including post-edit loads)
+                        * and when content has been previewed with LivePreview.
+                        *
+                        * @event wikipage_categories
+                        * @member mw.hook
+                        * @param {jQuery} $content The most appropriate element containing the content,
+                        *   such as .catlinks
+                        */
+                       mw.hook( 'wikipage.categories' ).fire( $nodes );
+               }
+
+               $( '#t-print a' ).on( 'click', function ( e ) {
+                       window.print();
+                       e.preventDefault();
+               } );
+
+               // Turn logout to a POST action
+               $( '#pt-logout a' ).on( 'click', function ( e ) {
+                       var api = new mw.Api(),
+                               returnUrl = $( '#pt-logout a' ).attr( 'href' );
+                       mw.notify(
+                               mw.message( 'logging-out-notify' ),
+                               { tag: 'logout', autoHide: false }
+                       );
+                       api.postWithToken( 'csrf', {
+                               action: 'logout'
+                       } ).then(
+                               function () {
+                                       location.href = returnUrl;
+                               },
+                               function ( e ) {
+                                       mw.notify(
+                                               mw.message( 'logout-failed', e ),
+                                               { type: 'error', tag: 'logout', autoHide: false }
+                                       );
+                               }
+                       );
+                       e.preventDefault();
+               } );
+       } );
+
+}() );
index f4d324d..99332d2 100644 (file)
@@ -4,7 +4,6 @@ namespace MediaWiki\Tests\Revision;
 
 use ActorMigration;
 use CommentStore;
-use MediaWiki\Logger\Spi as LoggerSpi;
 use MediaWiki\Revision\RevisionStore;
 use MediaWiki\Revision\RevisionStoreFactory;
 use MediaWiki\Revision\SlotRoleRegistry;
@@ -35,7 +34,7 @@ class RevisionStoreFactoryTest extends \MediaWikiIntegrationTestCase {
                        $this->getMockCommentStore(),
                        ActorMigration::newMigration(),
                        MIGRATION_OLD,
-                       $this->getMockLoggerSpi(),
+                       new NullLogger(),
                        true
                );
                $this->assertTrue( true );
@@ -65,7 +64,7 @@ class RevisionStoreFactoryTest extends \MediaWikiIntegrationTestCase {
                $cache = $this->getHashWANObjectCache();
                $commentStore = $this->getMockCommentStore();
                $actorMigration = ActorMigration::newMigration();
-               $loggerProvider = $this->getMockLoggerSpi();
+               $logger = new NullLogger();
 
                $factory = new RevisionStoreFactory(
                        $lbFactory,
@@ -76,7 +75,7 @@ class RevisionStoreFactoryTest extends \MediaWikiIntegrationTestCase {
                        $commentStore,
                        $actorMigration,
                        $mcrMigrationStage,
-                       $loggerProvider,
+                       $logger,
                        $contentHandlerUseDb
                );
 
@@ -178,16 +177,4 @@ class RevisionStoreFactoryTest extends \MediaWikiIntegrationTestCase {
                return new WANObjectCache( [ 'cache' => new \HashBagOStuff() ] );
        }
 
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|LoggerSpi
-        */
-       private function getMockLoggerSpi() {
-               $mock = $this->getMock( LoggerSpi::class );
-
-               $mock->method( 'getLogger' )
-                       ->willReturn( new NullLogger() );
-
-               return $mock;
-       }
-
 }
index ed4a27f..249fa78 100644 (file)
@@ -850,8 +850,7 @@ class RevisionTest extends MediaWikiTestCase {
                );
 
                $cacheKey = $cache->makeGlobalKey(
-                       'BlobStore',
-                       'address',
+                       'SqlBlobStore-blob',
                        $lb->getLocalDomainID(),
                        'tt:7777'
                );
index 6a00e67..230d36a 100644 (file)
@@ -6,6 +6,7 @@ use MediaWiki\Block\CompositeBlock;
 use MediaWiki\Block\SystemBlock;
 use MediaWiki\MediaWikiServices;
 use Wikimedia\TestingAccessWrapper;
+use Psr\Log\LoggerInterface;
 
 /**
  * @group Blocking
@@ -48,13 +49,15 @@ class BlockManagerTest extends MediaWikiTestCase {
        private function getBlockManagerConstructorArgs( $overrideConfig ) {
                $blockManagerConfig = array_merge( $this->blockManagerConfig, $overrideConfig );
                $this->setMwGlobals( $blockManagerConfig );
+               $logger = $this->getMockBuilder( LoggerInterface::class )->getMock();
                return [
                        new LoggedServiceOptions(
                                self::$serviceOptionsAccessLog,
                                BlockManager::$constructorOptions,
                                MediaWikiServices::getInstance()->getMainConfig()
                        ),
-                       MediaWikiServices::getInstance()->getPermissionManager()
+                       MediaWikiServices::getInstance()->getPermissionManager(),
+                       $logger
                ];
        }
 
index 3b30d7e..e344d57 100644 (file)
@@ -2422,7 +2422,7 @@ class FileBackendTest extends MediaWikiTestCase {
                        "$base/subdir2/subdir/sub/120-px-file.txt",
                ];
 
-               for ( $i = 0; $i < 25; $i++ ) {
+               for ( $i = 0; $i < 2; $i++ ) {
                        $status = $this->backend->lockFiles( $paths, LockManager::LOCK_EX );
                        $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );
index 8eadb0e..ca71d32 100644 (file)
@@ -4,7 +4,7 @@ namespace MediaWiki\Tests\Maintenance;
 
 use ContentHandler;
 use FetchText;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
 use MediaWikiTestCase;
 use MWException;
 use Title;
index 5be1ed0..bedf171 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -524,7 +524,7 @@ function wfGenerateThumbnail( File $file, array $params, $thumbName, $thumbPath
  * /w/images/thumb/a/ab/Foo.png/120px-Foo.png. The $thumbRel parameter
  * of this function would be set to "a/ab/Foo.png/120px-Foo.png".
  * This method is responsible for turning that into an array
- * with the folowing keys:
+ * with the following keys:
  *  * f => the filename (Foo.png)
  *  * rel404 => the whole thing (a/ab/Foo.png/120px-Foo.png)
  *  * archived => 1 (If the request is for an archived thumb)