Merge "Remove support for wgUseESI"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 8 Sep 2019 22:27:43 +0000 (22:27 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 8 Sep 2019 22:27:43 +0000 (22:27 +0000)
26 files changed:
includes/FileDeleteForm.php
includes/api/ApiExpandTemplates.php
includes/auth/AuthenticationRequest.php
includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
includes/context/RequestContext.php
includes/debug/logger/ConsoleLogger.php
includes/import/ImportStreamSource.php
includes/import/ImportStringSource.php
includes/libs/filebackend/FSFileBackend.php
includes/libs/filebackend/SwiftFileBackend.php
includes/page/ImagePage.php
includes/parser/PPDPart.php
includes/parser/PPDStack.php
includes/parser/PPDStackElement.php
includes/parser/PPFrame.php
includes/parser/PPFrame_DOM.php
includes/parser/PPTemplateFrame_Hash.php
includes/parser/Preprocessor.php
includes/parser/Preprocessor_Hash.php
includes/watcheditem/NoWriteWatchedItemStore.php
languages/messages/MessagesHyw.php
maintenance/cleanupImages.php
maintenance/preprocessDump.php
maintenance/preprocessorFuzzTest.php
maintenance/rebuildImages.php
maintenance/storage/recompressTracked.php

index 1241e1c..e31f9d2 100644 (file)
@@ -36,18 +36,18 @@ class FileDeleteForm {
        private $title = null;
 
        /**
-        * @var File
+        * @var LocalFile
         */
        private $file = null;
 
        /**
-        * @var File
+        * @var LocalFile
         */
        private $oldfile = null;
        private $oldimage = '';
 
        /**
-        * @param File $file File object we're deleting
+        * @param LocalFile $file File object we're deleting
         */
        public function __construct( $file ) {
                $this->title = $file->getTitle();
@@ -451,9 +451,9 @@ class FileDeleteForm {
         * value was provided, does it correspond to an
         * existing, local, old version of this file?
         *
-        * @param File &$file
-        * @param File &$oldfile
-        * @param File $oldimage
+        * @param LocalFile &$file
+        * @param LocalFile &$oldfile
+        * @param LocalFile $oldimage
         * @return bool
         */
        public static function haveDeletableFile( &$file, &$oldfile, $oldimage ) {
index a5e7437..4b74a3d 100644 (file)
@@ -76,10 +76,6 @@ class ApiExpandTemplates extends ApiBase {
                                        $this->addWarning( [ 'apierror-revwrongpage', $rev->getId(),
                                                wfEscapeWikiText( $pTitleObj->getPrefixedText() ) ] );
                                }
-                       } else {
-                               // Consider the title derived from the revid as having
-                               // been provided.
-                               $titleProvided = true;
                        }
                }
 
index e7527d1..168ae85 100644 (file)
@@ -246,13 +246,18 @@ abstract class AuthenticationRequest {
        }
 
        /**
+        * @codingStandardsIgnoreStart
+        * @template T
+        * @codingStandardsIgnoreEnd
         * Select a request by class name.
         * @param AuthenticationRequest[] $reqs
         * @param string $class Class name
+        * @phan-param class-string<T> $class
         * @param bool $allowSubclasses If true, also returns any request that's a subclass of the given
         *   class.
         * @return AuthenticationRequest|null Returns null if there is not exactly
         *  one matching request.
+        * @phan-return T|null
         */
        public static function getRequestByClass( array $reqs, $class, $allowSubclasses = false ) {
                $requests = array_filter( $reqs, function ( $req ) use ( $class, $allowSubclasses ) {
index c831fc8..25a1754 100644 (file)
@@ -96,7 +96,9 @@ class ResetPasswordSecondaryAuthenticationProvider extends AbstractSecondaryAuth
                        }
                }
 
+               /** @var PasswordAuthenticationRequest $needReq */
                $needReq = $data->req ?? new PasswordAuthenticationRequest();
+               '@phan-var PasswordAuthenticationRequest $needReq';
                if ( !$needReq->action ) {
                        $needReq->action = AuthManager::ACTION_CHANGE;
                }
index e6a856c..cbcaba1 100644 (file)
@@ -81,6 +81,12 @@ class RequestContext implements IContextSource, MutableContext {
         */
        private static $instance = null;
 
+       /**
+        * Boolean flag to guard against recursion in getLanguage
+        * @var bool
+        */
+       private $languageRecursion = false;
+
        /**
         * @param Config $config
         */
@@ -318,7 +324,7 @@ class RequestContext implements IContextSource, MutableContext {
         * @since 1.19
         */
        public function getLanguage() {
-               if ( isset( $this->recursion ) ) {
+               if ( $this->languageRecursion === true ) {
                        trigger_error( "Recursion detected in " . __METHOD__, E_USER_WARNING );
                        $e = new Exception;
                        wfDebugLog( 'recursion-guard', "Recursion detected:\n" . $e->getTraceAsString() );
@@ -326,7 +332,7 @@ class RequestContext implements IContextSource, MutableContext {
                        $code = $this->getConfig()->get( 'LanguageCode' ) ?: 'en';
                        $this->lang = Language::factory( $code );
                } elseif ( $this->lang === null ) {
-                       $this->recursion = true;
+                       $this->languageRecursion = true;
 
                        try {
                                $request = $this->getRequest();
@@ -348,7 +354,7 @@ class RequestContext implements IContextSource, MutableContext {
                                        $this->lang = $obj;
                                }
                        } finally {
-                               unset( $this->recursion );
+                               $this->languageRecursion = false;
                        }
                }
 
index 5a5e507..a48faf1 100644 (file)
@@ -10,10 +10,16 @@ use Psr\Log\AbstractLogger;
  * goal.
  */
 class ConsoleLogger extends AbstractLogger {
+       /**
+        * @param string $channel
+        */
        public function __construct( $channel ) {
                $this->channel = $channel;
        }
 
+       /**
+        * @inheritDoc
+        */
        public function log( $level, $message, array $context = [] ) {
                fwrite( STDERR, "[$level] " .
                        LegacyLogger::format( $this->channel, $message, $context ) );
index e6936cb..2f8f5dd 100644 (file)
@@ -30,6 +30,9 @@ use MediaWiki\MediaWikiServices;
  * @ingroup SpecialPage
  */
 class ImportStreamSource implements ImportSource {
+       /**
+        * @param resource $handle
+        */
        function __construct( $handle ) {
                $this->mHandle = $handle;
        }
index 85983b1..fdd1f77 100644 (file)
@@ -32,6 +32,9 @@
  * @ingroup SpecialPage
  */
 class ImportStringSource implements ImportSource {
+       /**
+        * @param string $string
+        */
        function __construct( $string ) {
                $this->mString = $string;
                $this->mRead = false;
index 0549d91..5534cbd 100644 (file)
@@ -122,7 +122,7 @@ class FSFileBackend extends FileBackendStore {
                        // See https://www.php.net/manual/en/migration71.windows-support.php
                        return 0;
                } else {
-                       return FileBackend::ATTR_UNICODE_PATHS;
+                       return self::ATTR_UNICODE_PATHS;
                }
        }
 
index 56a2177..edea75f 100644 (file)
@@ -146,9 +146,9 @@ class SwiftFileBackend extends FileBackendStore {
 
        public function getFeatures() {
                return (
-                       FileBackend::ATTR_UNICODE_PATHS |
-                       FileBackend::ATTR_HEADERS |
-                       FileBackend::ATTR_METADATA
+                       self::ATTR_UNICODE_PATHS |
+                       self::ATTR_HEADERS |
+                       self::ATTR_METADATA
                );
        }
 
@@ -1299,6 +1299,9 @@ class SwiftFileBackend extends FileBackendStore {
         * @return StatusValue[]
         */
        protected function doExecuteOpHandlesInternal( array $fileOpHandles ) {
+               /** @var SwiftFileOpHandle[] $fileOpHandles */
+               '@phan-var SwiftFileOpHandle[] $fileOpHandles';
+
                /** @var StatusValue[] $statuses */
                $statuses = [];
 
@@ -1314,7 +1317,6 @@ class SwiftFileBackend extends FileBackendStore {
                // Split the HTTP requests into stages that can be done concurrently
                $httpReqsByStage = []; // map of (stage => index => HTTP request)
                foreach ( $fileOpHandles as $index => $fileOpHandle ) {
-                       /** @var SwiftFileOpHandle $fileOpHandle */
                        $reqs = $fileOpHandle->httpOp;
                        // Convert the 'url' parameter to an actual URL using $auth
                        foreach ( $reqs as $stage => &$req ) {
index 2f6d4da..653e443 100644 (file)
@@ -987,6 +987,7 @@ EOT
                        parent::delete();
                        return;
                }
+               '@phan-var LocalFile $file';
 
                $deleter = new FileDeleteForm( $file );
                $deleter->execute();
index b56527a..6b63a0d 100644 (file)
 
 /**
  * @ingroup Parser
+ *
+ * @property int $eqpos
+ * @property int $commentEnd
+ * @property int $visualEnd
  */
 class PPDPart {
        /**
index 68f1bb2..b9d796d 100644 (file)
@@ -27,6 +27,8 @@ class PPDStack {
        /** @var PPDStackElement[] */
        public $stack;
        public $rootAccum;
+       /** @var string|array */
+       public $accum;
 
        /**
         * @var PPDStackElement|false
index 116244d..fe2b04e 100644 (file)
@@ -21,6 +21,8 @@
 
 /**
  * @ingroup Parser
+ *
+ * @property int $startPos
  */
 class PPDStackElement {
        /**
index 3f147f0..b50fcfc 100644 (file)
@@ -21,6 +21,9 @@
 
 /**
  * @ingroup Parser
+ *
+ * @property int $depth
+ * @property PPFrame $parent
  */
 interface PPFrame {
        const NO_ARGS = 1;
index ac3a266..a0ec326 100644 (file)
@@ -82,7 +82,7 @@ class PPFrame_DOM implements PPFrame {
         * Create a new child frame
         * $args is optionally a multi-root PPNode or array containing the template arguments
         *
-        * @param bool|array $args
+        * @param bool|array|PPNode_DOM $args
         * @param Title|bool $title
         * @param int $indexOffset
         * @return PPTemplateFrame_DOM
@@ -95,11 +95,12 @@ class PPFrame_DOM implements PPFrame {
                }
                if ( $args !== false ) {
                        $xpath = false;
-                       if ( $args instanceof PPNode ) {
+                       if ( $args instanceof PPNode_DOM ) {
                                $args = $args->node;
                        }
+                       // @phan-suppress-next-line PhanTypeSuspiciousNonTraversableForeach
                        foreach ( $args as $arg ) {
-                               if ( $arg instanceof PPNode ) {
+                               if ( $arg instanceof PPNode_DOM ) {
                                        $arg = $arg->node;
                                }
                                if ( !$xpath || $xpath->document !== $arg->ownerDocument ) {
@@ -153,7 +154,7 @@ class PPFrame_DOM implements PPFrame {
 
        /**
         * @throws MWException
-        * @param string|PPNode_DOM|DOMNode $root
+        * @param string|PPNode_DOM|DOMNode|DOMNodeList $root
         * @param int $flags
         * @return string
         */
index df740cf..902e4f1 100644 (file)
@@ -40,6 +40,8 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
                $namedArgs = [], $title = false
        ) {
                parent::__construct( $preprocessor );
+               /** @var PPFrame_Hash parent */
+               '@phan-var PPFrame_Hash $parent';
 
                $this->parent = $parent;
                $this->numberedArgs = $numberedArgs;
index 99ca1be..19dd96e 100644 (file)
@@ -31,6 +31,11 @@ abstract class Preprocessor {
 
        const CACHE_VERSION = 1;
 
+       /**
+        * @var Parser
+        */
+       public $parser;
+
        /**
         * @var array Brace matching rules.
         */
index 9f4b7c7..7c372ee 100644 (file)
  */
 // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
 class Preprocessor_Hash extends Preprocessor {
-
-       /**
-        * @var Parser
-        */
-       public $parser;
-
        const CACHE_PREFIX = 'preprocess-hash';
        const CACHE_VERSION = 2;
 
index 72f6086..69dcec8 100644 (file)
@@ -57,7 +57,10 @@ class NoWriteWatchedItemStore implements WatchedItemStoreInterface {
        }
 
        public function countWatchersMultiple( array $targets, array $options = [] ) {
-               return $this->actualStore->countVisitingWatchersMultiple( $targets, $options );
+               return $this->actualStore->countVisitingWatchersMultiple(
+                       $targets,
+                       $options['minimumWatchers'] ?? null
+               );
        }
 
        public function countVisitingWatchersMultiple(
index 59e9c86..55bf54c 100644 (file)
@@ -9,3 +9,7 @@
  */
 
 $fallback = 'hy';
+
+$magicWords['redirect'] = [ '0', '#ՎԵՐԱՅՂՈՒՄ', '#ՎԵՐԱՀՂՈՒՄ', '#REDIRECT' ];
+
+$namespaceNames[NS_CATEGORY] = 'Ստորոգութիւն';
index 305a41d..4d0c0e6 100644 (file)
@@ -111,6 +111,10 @@ class CleanupImages extends TableCleanup {
                }
        }
 
+       /**
+        * @param string $name
+        * @return string
+        */
        private function filePath( $name ) {
                if ( !isset( $this->repo ) ) {
                        $this->repo = RepoGroup::singleton()->getLocalRepo();
index 963bfec..05b78d4 100644 (file)
@@ -73,8 +73,9 @@ class PreprocessDump extends DumpIterator {
                        $name = Preprocessor_DOM::class;
                }
 
-               MediaWikiServices::getInstance()->getParser()->firstCallInit();
-               $this->mPreprocessor = new $name( $this );
+               $parser = MediaWikiServices::getInstance()->getParser();
+               $parser->firstCallInit();
+               $this->mPreprocessor = new $name( $parser );
        }
 
        /**
index 68fb643..39b2ff0 100644 (file)
@@ -150,6 +150,9 @@ class PPFuzzTester {
 class PPFuzzTest {
        public $templates, $mainText, $title, $entryPoint, $output;
 
+       /**
+        * @param PPFuzzTester $tester
+        */
        function __construct( $tester ) {
                global $wgMaxSigChars;
                $this->parent = $tester;
index bfbee9b..3de0070 100644 (file)
@@ -91,6 +91,10 @@ class ImageBuilder extends Maintenance {
                $this->buildOldImage();
        }
 
+       /**
+        * @param int $count
+        * @param string $table
+        */
        function init( $count, $table ) {
                $this->processed = 0;
                $this->updated = 0;
index 316d2d2..0d506ef 100644 (file)
@@ -275,7 +275,7 @@ class RecompressTracked {
        /**
         * Dispatch a command to the next available replica DB.
         * This may block until a replica DB finishes its work and becomes available.
-        * @param array ...$args
+        * @param array|string ...$args
         */
        function dispatch( ...$args ) {
                $pipes = $this->replicaPipes;