diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
commit | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch) | |
tree | 577a29fb579188d16003a209ce2a2e9c5b0aa2bd /includes/filerepo/file/UnregisteredLocalFile.php | |
parent | cacc939b34e315b85e2d72997811eb6677996cc1 (diff) |
Update to MediaWiki 1.21.1
Diffstat (limited to 'includes/filerepo/file/UnregisteredLocalFile.php')
-rw-r--r-- | includes/filerepo/file/UnregisteredLocalFile.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index 8d4a3f88..47ba6d6b 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -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; } } |