Merge "Avoid usage of deprecated setTags() method, use addTags() instead"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 1 Sep 2019 15:25:02 +0000 (15:25 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 1 Sep 2019 15:25:02 +0000 (15:25 +0000)
1  2 
includes/FileDeleteForm.php
includes/MovePage.php
includes/filerepo/file/LocalFile.php
includes/page/WikiPage.php
includes/specials/helpers/ImportReporter.php

@@@ -181,7 -181,7 +181,7 @@@ class FileDeleteForm 
                                $logEntry->setPerformer( $user );
                                $logEntry->setTarget( $title );
                                $logEntry->setComment( $logComment );
-                               $logEntry->setTags( $tags );
+                               $logEntry->addTags( $tags );
                                $logid = $logEntry->insert();
                                $logEntry->publish( $logid );
  
                                                $logEntry->setPerformer( $user );
                                                $logEntry->setTarget( clone $title );
                                                $logEntry->setComment( $reason );
-                                               $logEntry->setTags( $tags );
+                                               $logEntry->addTags( $tags );
                                                $logid = $logEntry->insert();
                                                $dbw->onTransactionPreCommitOrIdle(
                                                        function () use ( $logEntry, $logid ) {
                );
                $options = Xml::listDropDownOptionsOoui( $options );
  
 +              $fields = [];
                $fields[] = new OOUI\LabelWidget( [ 'label' => new OOUI\HtmlSnippet(
                        $this->prepareMessage( 'filedelete-intro' ) ) ]
                );
diff --combined includes/MovePage.php
@@@ -446,7 -446,7 +446,7 @@@ class MovePage 
                                $status = Status::newFatal( 'movepage-max-pages', $wgMaximumMovedPages );
                                $perTitleStatus[$oldSubpage->getPrefixedText()] = $status;
                                $topStatus->merge( $status );
 -                              $topStatus->setOk( true );
 +                              $topStatus->setOK( true );
                                break;
                        }
  
                        }
                        $perTitleStatus[$oldSubpage->getPrefixedText()] = $status;
                        $topStatus->merge( $status );
 -                      $topStatus->setOk( true );
 +                      $topStatus->setOK( true );
                }
  
                $topStatus->value = $perTitleStatus;
                                '4::oldtitle' => $this->oldTitle->getPrefixedText(),
                        ] );
                        $logEntry->setRelations( [ 'pr_id' => $logRelationsValues ] );
-                       $logEntry->setTags( $changeTags );
+                       $logEntry->addTags( $changeTags );
                        $logId = $logEntry->insert();
                        $logEntry->publish( $logId );
                }
                # Log the move
                $logid = $logEntry->insert();
  
-               $logEntry->setTags( $changeTags );
+               $logEntry->addTags( $changeTags );
                $logEntry->publish( $logid );
  
                return $nullRevision;
@@@ -344,7 -344,6 +344,7 @@@ class LocalFile extends File 
                                $this->loadFromDB( self::READ_NORMAL );
  
                                $fields = $this->getCacheFields( '' );
 +                              $cacheVal = [];
                                $cacheVal['fileExists'] = $this->fileExists;
                                if ( $this->fileExists ) {
                                        foreach ( $fields as $field ) {
        /**
         * Delete cached transformed files for the current version only.
         * @param array $options
 +       * @phan-param array{forThumbRefresh?:bool} $options
         */
        public function purgeThumbnails( $options = [] ) {
                $files = $this->getThumbnails();
                array_shift( $urls ); // don't purge directory
  
                // Give media handler a chance to filter the file purge list
 +              // @phan-suppress-next-line PhanTypeInvalidDimOffset
                if ( !empty( $options['forThumbRefresh'] ) ) {
                        $handler = $this->getHandler();
                        if ( $handler ) {
  
                                        # Add change tags, if any
                                        if ( $tags ) {
-                                               $logEntry->setTags( $tags );
+                                               $logEntry->addTags( $tags );
                                        }
  
                                        # Uploads can be patrolled
  
                wfDebugLog( 'imagemove', "Finished moving {$this->name}" );
  
 -              // Purge the source and target files...
 +              // Purge the source and target files outside the transaction...
                $oldTitleFile = $localRepo->newFile( $this->title );
                $newTitleFile = $localRepo->newFile( $target );
 -              // To avoid slow purges in the transaction, move them outside...
                DeferredUpdates::addUpdate(
                        new AutoCommitUpdate(
                                $this->getRepo()->getMasterDB(),
                                function () use ( $oldTitleFile, $newTitleFile, $archiveNames ) {
                                        $oldTitleFile->purgeEverything();
                                        foreach ( $archiveNames as $archiveName ) {
 +                                              /** @var OldLocalFile $oldTitleFile */
                                                $oldTitleFile->purgeOldThumbnails( $archiveName );
                                        }
                                        $newTitleFile->purgeEverything();
                        // Now switch the object
                        $this->title = $target;
                        // Force regeneration of the name and hashpath
 -                      unset( $this->name );
 -                      unset( $this->hashPath );
 +                      $this->name = null;
 +                      $this->hashPath = null;
                }
  
                return $status;
@@@ -68,9 -68,7 +68,9 @@@ class WikiPage implements Page, IDBAcce
         */
        public $mLatest = false;
  
 -      /** @var PreparedEdit Map of cache fields (text, parser output, ect) for a proposed/new edit */
 +      /**
 +       * @var PreparedEdit|false Map of cache fields (text, parser output, ect) for a proposed/new edit
 +       */
        public $mPreparedEdit = false;
  
        /**
                if ( !is_null( $nullRevision ) ) {
                        $logEntry->setAssociatedRevId( $nullRevision->getId() );
                }
-               $logEntry->setTags( $tags );
+               $logEntry->addTags( $tags );
                if ( $logRelationsField !== null && count( $logRelationsValues ) ) {
                        $logEntry->setRelations( [ $logRelationsField => $logRelationsValues ] );
                }
                        $logEntry->setPerformer( $deleter );
                        $logEntry->setTarget( $logTitle );
                        $logEntry->setComment( $reason );
-                       $logEntry->setTags( $tags );
+                       $logEntry->addTags( $tags );
                        $logid = $logEntry->insert();
  
                        $dbw->onTransactionPreCommitOrIdle(
@@@ -30,9 -30,6 +30,9 @@@ class ImportReporter extends ContextSou
        private $mOriginalLogCallback = null;
        private $mOriginalPageOutCallback = null;
        private $mLogItemCount = 0;
 +      private $mPageCount;
 +      private $mIsUpload;
 +      private $mInterwiki;
  
        /**
         * @param WikiImporter $importer
                        // Make sure the null revision will be tagged as well
                        $logEntry->setAssociatedRevId( $nullRevId );
                        if ( count( $this->logTags ) ) {
-                               $logEntry->setTags( $this->logTags );
+                               $logEntry->addTags( $this->logTags );
                        }
                        $logid = $logEntry->insert();
                        $logEntry->publish( $logid );