summaryrefslogtreecommitdiff
path: root/includes/filerepo/file/UnregisteredLocalFile.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/filerepo/file/UnregisteredLocalFile.php')
-rw-r--r--includes/filerepo/file/UnregisteredLocalFile.php22
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;
}
}