Unsuppress another phan issue (part 7)
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index 54fc251..4751a59 100644 (file)
@@ -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 ) {
@@ -1079,6 +1080,7 @@ class LocalFile extends File {
        /**
         * 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();
@@ -1090,6 +1092,7 @@ class LocalFile extends File {
                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 ) {
@@ -1758,7 +1761,7 @@ class LocalFile extends File {
 
                                        # Add change tags, if any
                                        if ( $tags ) {
-                                               $logEntry->setTags( $tags );
+                                               $logEntry->addTags( $tags );
                                        }
 
                                        # Uploads can be patrolled
@@ -1865,6 +1868,7 @@ class LocalFile extends File {
                                : FSFile::getSha1Base36FromPath( $srcPath );
                        /** @var FileBackendDBRepoWrapper $wrapperBackend */
                        $wrapperBackend = $repo->getBackend();
+                       '@phan-var FileBackendDBRepoWrapper $wrapperBackend';
                        $dst = $wrapperBackend->getPathForSHA1( $sha1 );
                        $status = $repo->quickImport( $src, $dst );
                        if ( $flags & File::DELETE_SOURCE ) {
@@ -1923,10 +1927,9 @@ class LocalFile extends File {
 
                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(),
@@ -1934,6 +1937,8 @@ class LocalFile extends File {
                                function () use ( $oldTitleFile, $newTitleFile, $archiveNames ) {
                                        $oldTitleFile->purgeEverything();
                                        foreach ( $archiveNames as $archiveName ) {
+                                               /** @var OldLocalFile $oldTitleFile */
+                                               '@phan-var OldLocalFile $oldTitleFile';
                                                $oldTitleFile->purgeOldThumbnails( $archiveName );
                                        }
                                        $newTitleFile->purgeEverything();
@@ -1946,8 +1951,8 @@ class LocalFile extends File {
                        // 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;