Merge "rebuildLocalisationCache: Implement --lang option"
[lhc/web/wiklou.git] / includes / filerepo / file / UnregisteredLocalFile.php
index 8d4a3f8..47ba6d6 100644 (file)
@@ -42,7 +42,7 @@ class UnregisteredLocalFile extends File {
        var $handler;
 
        /**
-        * @param $path string Storage path
+        * @param string $path Storage path
         * @param $mime string
         * @return UnregisteredLocalFile
         */
@@ -71,7 +71,7 @@ class UnregisteredLocalFile extends File {
         */
        function __construct( $title = false, $repo = false, $path = false, $mime = false ) {
                if ( !( $title && $repo ) && !$path ) {
-                       throw new MWException( __METHOD__.': not enough parameters, must specify title and repo, or a full path' );
+                       throw new MWException( __METHOD__ . ': not enough parameters, must specify title and repo, or a full path' );
                }
                if ( $title instanceof Title ) {
                        $this->title = File::normalizeTitle( $title, 'exception' );
@@ -179,10 +179,18 @@ class UnregisteredLocalFile extends File {
         */
        function getSize() {
                $this->assertRepoDefined();
-               $props = $this->repo->getFileProps( $this->path );
-               if ( isset( $props['size'] ) ) {
-                       return $props['size'];
-               }
-               return false; // doesn't exist
+               return $this->repo->getFileSize( $this->path );
+       }
+
+       /**
+        * Optimize getLocalRefPath() by using an existing local reference.
+        * The file at the path of $fsFile should not be deleted (or at least
+        * not until the end of the request). This is mostly a performance hack.
+        *
+        * @param $fsFile FSFile
+        * @return void
+        */
+       public function setLocalReference( FSFile $fsFile ) {
+               $this->fsFile = $fsFile;
        }
 }