filebackend: optimize the chmod() calls in FSFileBackend
[lhc/web/wiklou.git] / maintenance / rebuildImages.php
index c0de334..bfbee9b 100644 (file)
@@ -76,7 +76,7 @@ class ImageBuilder extends Maintenance {
        }
 
        /**
-        * @return FileRepo
+        * @return LocalRepo
         */
        function getRepo() {
                if ( !isset( $this->repo ) ) {
@@ -195,15 +195,16 @@ class ImageBuilder extends Maintenance {
 
        function addMissingImage( $filename, $fullpath ) {
                $timestamp = $this->dbw->timestamp( $this->getRepo()->getFileTimestamp( $fullpath ) );
+               $services = MediaWikiServices::getInstance();
 
-               $altname = MediaWikiServices::getInstance()->getContentLanguage()->
-                       checkTitleEncoding( $filename );
+               $altname = $services->getContentLanguage()->checkTitleEncoding( $filename );
                if ( $altname != $filename ) {
                        if ( $this->dryrun ) {
                                $filename = $altname;
                                $this->output( "Estimating transcoding... $altname\n" );
                        } else {
-                               # @todo FIXME: create renameFile()
+                               // @fixme create renameFile()
+                               // @phan-suppress-next-line PhanUndeclaredMethod See comment above...
                                $filename = $this->renameFile( $filename );
                        }
                }
@@ -214,7 +215,7 @@ class ImageBuilder extends Maintenance {
                        return;
                }
                if ( !$this->dryrun ) {
-                       $file = wfLocalFile( $filename );
+                       $file = $services->getRepoGroup()->getLocalRepo()->newFile( $filename );
                        if ( !$file->recordUpload(
                                '',
                                '(recovered file, missing upload log entry)',