* @deprecated since 1.19
*/
class FSRepo extends FileRepo {
-
/**
* @param $info array
* @throws MWException
throw new MWException( "No '$zone' zone defined in the {$this->name} repo." );
}
}
+
return $status;
}
if ( $suffix !== false ) {
$path .= '/' . rawurlencode( $suffix );
}
+
return $path;
}
*/
public function getZoneHandlerUrl( $zone ) {
if ( isset( $this->zones[$zone]['handlerUrl'] )
- && in_array( $zone, array( 'public', 'temp', 'thumb', 'transcoded' ) ) )
- {
+ && in_array( $zone, array( 'public', 'temp', 'thumb', 'transcoded' ) )
+ ) {
return $this->zones[$zone]['handlerUrl'];
}
+
return false;
}
if ( !$base ) {
throw new MWException( __METHOD__ . ": invalid zone: $zone" );
}
+
return $base . '/' . rawurldecode( $rel );
}
if ( !isset( $this->zones[$zone] ) ) {
return array( null, null ); // bogus
}
+
return array( $this->zones[$zone]['container'], $this->zones[$zone]['directory'] );
}
if ( $base != '' ) { // may not be set
$base = "/{$base}";
}
+
return "mwstore://$backendName/{$container}{$base}";
}
}
if ( $img->exists() ) {
$img->redirectedFrom( $title->getDBkey() );
+
return $img;
}
}
+
return false;
}
$result[$file->getTitle()->getDBkey()] = $file;
}
}
+
return $result;
}
}
}
}
+
return false;
}
$result[$hash] = $files;
}
}
+
return $result;
}
} else {
$name = $title->getDBkey();
}
+
return $name;
}
for ( $i = 1; $i <= $levels; $i++ ) {
$path .= substr( $hash, 0, $i ) . '/';
}
+
return $path;
}
}
public function makeUrl( $query = '', $entry = 'index' ) {
if ( isset( $this->scriptDirUrl ) ) {
$ext = isset( $this->scriptExtension ) ? $this->scriptExtension : '.php';
+
return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
}
+
return false;
}
# and just sort of hope index.php is right. ;)
return $this->makeUrl( "title=Image:$encName" );
}
+
return false;
}
return $this->makeUrl( 'title=MediaWiki:Filepage.css&' .
wfArrayToCgi( Skin::getDynamicStylesheetQuery() ) );
}
+
return false;
}
$temp = $this->getVirtualUrl( 'temp' );
if ( substr( $virtualUrl, 0, strlen( $temp ) ) != $temp ) {
wfDebug( __METHOD__ . ": Invalid temp virtual URL\n" );
+
return false;
}
*/
public function fileExists( $file ) {
$result = $this->fileExistsBatch( array( $file ) );
+
return $result[0];
}
$file = $this->resolveToStoragePath( $file );
$result[$key] = $this->backend->fileExists( array( 'src' => $file ) );
}
+
return $result;
}
for ( $i = 0; $i < $this->deletedHashLevels; $i++ ) {
$path .= $key[$i] . '/';
}
+
return $path;
}
if ( $this->isVirtualUrl( $path ) ) {
return $this->resolveVirtualUrl( $path );
}
+
return $path;
}
*/
public function getLocalCopy( $virtualUrl ) {
$path = $this->resolveToStoragePath( $virtualUrl );
+
return $this->backend->getLocalCopy( array( 'src' => $path ) );
}
*/
public function getLocalReference( $virtualUrl ) {
$path = $this->resolveToStoragePath( $virtualUrl );
+
return $this->backend->getLocalReference( array( 'src' => $path ) );
}
*/
public function getFileProps( $virtualUrl ) {
$path = $this->resolveToStoragePath( $virtualUrl );
+
return $this->backend->getFileProps( array( 'src' => $path ) );
}
*/
public function getFileTimestamp( $virtualUrl ) {
$path = $this->resolveToStoragePath( $virtualUrl );
+
return $this->backend->getFileTimestamp( array( 'src' => $path ) );
}
*/
public function getFileSize( $virtualUrl ) {
$path = $this->resolveToStoragePath( $virtualUrl );
+
return $this->backend->getFileSize( array( 'src' => $path ) );
}
*/
public function getFileSha1( $virtualUrl ) {
$path = $this->resolveToStoragePath( $virtualUrl );
+
return $this->backend->getFileSha1Base36( array( 'src' => $path ) );
}
public function streamFile( $virtualUrl, $headers = array() ) {
$path = $this->resolveToStoragePath( $virtualUrl );
$params = array( 'src' => $path, 'headers' => $headers );
+
return $this->backend->streamFile( $params )->isOK();
}
if ( strval( $filename ) == '' ) {
return false;
}
+
return FileBackend::isPathTraversalFree( $filename );
}
public function newFatal( $message /*, parameters...*/ ) {
$params = func_get_args();
array_unshift( $params, $this );
+
return call_user_func_array( array( 'FileRepoStatus', 'newFatal' ), $params );
}
* STUB
* @param $title Title of image
*/
- public function invalidateImageRedirect( Title $title ) {}
+ public function invalidateImageRedirect( Title $title ) {
+ }
/**
* Get the human-readable name of the repo
if ( $this->isLocal() ) {
return null;
}
+
// 'shared-repo-name-wikimediacommons' is used when $wgUseInstantCommons = true
return wfMessageFallback( 'shared-repo-name-' . $this->name, 'shared-repo' )->text();
}
$ext = FileBackend::extensionFromPath( $name );
$name = ( $ext == '' ) ? 'thumbnail' : "thumbnail.$ext";
}
+
return $name;
}
public function getLocalCacheKey( /*...*/ ) {
$args = func_get_args();
array_unshift( $args, 'filerepo', $this->getName() );
+
return call_user_func_array( 'wfMemcKey', $args );
}
),
'thumb' => array(
'container' => $this->zones['thumb']['container'],
- 'directory' => ( $this->zones['thumb']['directory'] == '' )
+ 'directory' => $this->zones['thumb']['directory'] == ''
? 'temp'
: $this->zones['thumb']['directory'] . '/temp'
),
'transcoded' => array(
'container' => $this->zones['transcoded']['container'],
- 'directory' => ( $this->zones['transcoded']['directory'] == '' )
+ 'directory' => $this->zones['transcoded']['directory'] == ''
? 'temp'
: $this->zones['transcoded']['directory'] . '/temp'
)
* @return void
* @throws MWException
*/
- protected function assertWritableRepo() {}
+ protected function assertWritableRepo() {
+ }
/**
* Return information about the repository.
$result = new self( $repo );
call_user_func_array( array( &$result, 'error' ), $params );
$result->ok = false;
+
return $result;
}
static function newGood( $repo = false, $value = null ) {
$result = new self( $repo );
$result->value = $value;
+
return $result;
}
if ( $time ) {
return false;
}
+
return parent::newFile( $title, $time );
}
}
}
- $data = $this->fetchImageQuery( array( 'titles' => implode( $files, '|' ),
- 'prop' => 'imageinfo' ) );
+ $data = $this->fetchImageQuery( array(
+ 'titles' => implode( $files, '|' ),
+ 'prop' => 'imageinfo' )
+ );
+
if ( isset( $data['query']['pages'] ) ) {
# First, get results from the query. Note we only care whether the image exists,
# not whether it has a description page.
$results[$key] = $this->mFileExists[$file];
}
}
+
return $results;
}
}
}
}
+
return false;
}
$ret[] = new ForeignAPIFile( Title::makeTitle( NS_FILE, $img['name'] ), $this, $img );
}
}
+
return $ret;
}
if ( $data && $info && isset( $info['thumburl'] ) ) {
wfDebug( __METHOD__ . " got remote thumb " . $info['thumburl'] . "\n" );
$result = $info;
+
return $info['thumburl'];
} else {
return false;
if ( $data && $info && isset( $info['thumberror'] ) ) {
wfDebug( __METHOD__ . " got remote thumb error " . $info['thumberror'] . "\n" );
+
return new MediaTransformError(
'thumbnail_error_remote',
$width,
if ( isset( $knownThumbUrls[$sizekey] ) ) {
wfDebug( __METHOD__ . ': Got thumburl from local cache: ' .
"{$knownThumbUrls[$sizekey]} \n" );
+
return $knownThumbUrls[$sizekey];
}
/* This size is not yet known */
if ( !$foreignUrl ) {
wfDebug( __METHOD__ . " Could not find thumburl\n" );
+
return false;
}
$fileName = rawurldecode( pathinfo( $foreignUrl, PATHINFO_BASENAME ) );
if ( !$this->validateFilename( $fileName ) ) {
wfDebug( __METHOD__ . " The deduced filename $fileName is not safe\n" );
+
return false;
}
$localPath = $this->getZonePath( 'thumb' ) . "/" . $this->getHashPath( $name ) . $name;
$localUrl = $this->getZoneUrl( 'thumb' ) . "/" . $this->getHashPath( $name ) . rawurlencode( $name ) . "/" . rawurlencode( $fileName );
if ( $backend->fileExists( array( 'src' => $localFilename ) )
- && isset( $metadata['timestamp'] ) ) {
+ && isset( $metadata['timestamp'] )
+ ) {
wfDebug( __METHOD__ . " Thumbnail was already downloaded before\n" );
$modified = $backend->getFileTimestamp( array( 'src' => $localFilename ) );
$remoteModified = strtotime( $metadata['timestamp'] );
/* Use our current and already downloaded thumbnail */
$knownThumbUrls[$sizekey] = $localUrl;
$wgMemc->set( $key, $knownThumbUrls, $this->apiThumbCacheExpiry );
+
return $localUrl;
}
/* There is a new Commons file, or existing thumbnail older than a month */
$thumb = self::httpGet( $foreignUrl );
if ( !$thumb ) {
wfDebug( __METHOD__ . " Could not download thumb\n" );
+
return false;
}
$params = array( 'dst' => $localFilename, 'content' => $thumb );
if ( !$backend->quickCreate( $params )->isOK() ) {
wfDebug( __METHOD__ . " could not write to thumb path '$localFilename'\n" );
+
return $foreignUrl;
}
$knownThumbUrls[$sizekey] = $localUrl;
$wgMemc->set( $key, $knownThumbUrls, $this->apiThumbCacheExpiry );
wfDebug( __METHOD__ . " got local thumb $localUrl, saving to cache \n" );
+
return $localUrl;
}
if ( in_array( $zone, $supported ) ) {
return parent::getZonePath( $zone );
}
+
return false;
}
)
);
}
+
return $this->dbConn;
}
if ( $this->hasSharedCache() ) {
$args = func_get_args();
array_unshift( $args, $this->dbName, $this->tablePrefix );
+
return call_user_func_array( 'wfForeignMemcKey', $args );
} else {
return false;
if ( $this->hasSharedCache() ) {
$args = func_get_args();
array_unshift( $args, $this->wiki );
+
return implode( ':', $args );
} else {
return false;
* @ingroup FileRepo
*/
class LocalRepo extends FileRepo {
- var $fileFactory = array( 'LocalFile' , 'newFromTitle' );
- var $fileFactoryKey = array( 'LocalFile' , 'newFromKey' );
- var $fileFromRowFactory = array( 'LocalFile' , 'newFromRow' );
- var $oldFileFactory = array( 'OldLocalFile', 'newFromTitle' );
- var $oldFileFactoryKey = array( 'OldLocalFile', 'newFromKey' );
- var $oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' );
+ var $fileFactory = array( 'LocalFile', 'newFromTitle' );
+ var $fileFactoryKey = array( 'LocalFile', 'newFromKey' );
+ var $fileFromRowFactory = array( 'LocalFile', 'newFromRow' );
+ var $oldFileFactory = array( 'OldLocalFile', 'newFromTitle' );
+ var $oldFileFactoryKey = array( 'OldLocalFile', 'newFromKey' );
+ var $oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' );
/**
* @throws MWException
}
$dbw->commit( __METHOD__ );
}
+
return $status;
}
$options = ( $lock === 'lock' ) ? array( 'FOR UPDATE' ) : array();
$dbw = $this->getMasterDB();
+
return (bool)$dbw->selectField( 'filearchive', '1',
array( 'fa_storage_group' => 'deleted', 'fa_storage_key' => $key ),
__METHOD__, $options
$ext = File::normalizeExtension( substr( $key, strcspn( $key, '.' ) + 1 ) );
$dbw = $this->getMasterDB();
+
return (bool)$dbw->selectField( 'oldimage', '1',
array( 'oi_sha1' => $sha1,
'oi_archive_name ' . $dbw->buildLike( $dbw->anyString(), ".$ext" ),
$id = $this->getArticleID( $title );
if ( !$id ) {
$wgMemc->add( $memcKey, " ", $expiry );
+
return false;
}
$dbr = $this->getSlaveDB();
if ( $row && $row->rd_namespace == NS_FILE ) {
$targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title );
$wgMemc->add( $memcKey, $targetTitle->getDBkey(), $expiry );
+
return $targetTitle;
} else {
$wgMemc->add( $memcKey, '', $expiry );
+
return false;
}
}
),
__METHOD__ //Function name
);
+
return $id;
}
'img_name ' . $dbr->buildLike( $prefix, $dbr->anyString() ),
__METHOD__,
$selectOptions
- );
+ );
// Build file objects
$files = array();
foreach ( $res as $row ) {
$files[] = $this->newFileFromRow( $row );
}
+
return $files;
}
*/
function getSharedCacheKey( /*...*/ ) {
$args = func_get_args();
+
return call_user_func_array( 'wfMemcKey', $args );
}
/**
* @param $info array|null
*/
- function __construct( $info ) {}
+ function __construct( $info ) {
+ }
protected function assertWritableRepo() {
throw new MWException( get_class( $this ) . ': write operations are not supported.' );
}
global $wgLocalFileRepo, $wgForeignFileRepos;
self::$instance = new RepoGroup( $wgLocalFileRepo, $wgForeignFileRepos );
+
return self::$instance;
}
# Check the cache
if ( empty( $options['ignoreRedirect'] )
&& empty( $options['private'] )
- && empty( $options['bypassCache'] ) )
- {
+ && empty( $options['bypassCache'] )
+ ) {
$time = isset( $options['time'] ) ? $options['time'] : '';
$dbkey = $title->getDBkey();
if ( isset( $this->cache[$dbkey][$time] ) ) {
wfDebug( __METHOD__ . ": got File:$dbkey from process cache\n" );
# Move it to the end of the list so that we can delete the LRU entry later
$this->pingCache( $dbkey );
+
# Return the entry
return $this->cache[$dbkey][$time];
}
$images = array_merge( $images, $repo->findFiles( $items ) );
}
+
return $images;
}
return $redir;
}
}
+
return false;
}
}
}
}
+
return $file;
}
$result = array_merge( $result, $repo->findBySha1( $hash ) );
}
usort( $result, 'File::compare' );
+
return $result;
}
foreach ( $result as $hash => $files ) {
usort( $result[$hash], 'File::compare' );
}
+
return $result;
}
return $repo;
}
}
+
return false;
}
return true;
}
}
+
return false;
}
*/
protected function newRepo( $info ) {
$class = $info['class'];
+
return new $class( $info );
}
if ( count( $bits ) != 3 ) {
throw new MWException( __METHOD__ . ": invalid mwrepo URL: $url" );
}
+
return $bits;
}
$repoName = 'local';
}
$repo = $this->getRepo( $repoName );
+
return $repo->getFileProps( $fileName );
} else {
return FSFile::getPropsFromPath( $fileName );
*/
var $id, # filearchive row ID
$name, # image name
- $group, # FileStore storage group
+ $group, # FileStore storage group
$key, # FileStore sha1 key
$size, # file dimensions
- $bits, # size in bytes
+ $bits, # size in bytes
$width, # width
$height, # height
$metadata, # metadata string
public static function newFromRow( $row ) {
$file = new ArchivedFile( Title::makeTitle( NS_FILE, $row->fa_name ) );
$file->loadFromRow( $row );
+
return $file;
}
*/
public function getID() {
$this->load();
+
return $this->id;
}
*/
public function exists() {
$this->load();
+
return $this->exists;
}
*/
public function getKey() {
$this->load();
+
return $this->key;
}
*/
public function getWidth() {
$this->load();
+
return $this->width;
}
*/
public function getHeight() {
$this->load();
+
return $this->height;
}
*/
public function getMetadata() {
$this->load();
+
return $this->metadata;
}
*/
public function getSize() {
$this->load();
+
return $this->size;
}
*/
public function getBits() {
$this->load();
+
return $this->bits;
}
*/
public function getMimeType() {
$this->load();
+
return $this->mime;
}
if ( !isset( $this->handler ) ) {
$this->handler = MediaHandler::getHandler( $this->getMimeType() );
}
+
return $this->handler;
}
$this->pageCount = false;
}
}
+
return $this->pageCount;
}
*/
public function getMediaType() {
$this->load();
+
return $this->media_type;
}
*/
public function getTimestamp() {
$this->load();
+
return wfTimestamp( TS_MW, $this->timestamp );
}
*/
function getSha1() {
$this->load();
+
return $this->sha1;
}
*/
public function getRawUser() {
$this->load();
+
return $this->user;
}
*/
public function getRawUserText() {
$this->load();
+
return $this->user_text;
}
*/
public function getRawDescription() {
$this->load();
+
return $this->description;
}
*/
public function getVisibility() {
$this->load();
+
return $this->deleted;
}
*/
public function isDeleted( $field ) {
$this->load();
+
return ( $this->deleted & $field ) == $field;
}
*/
public function userCan( $field, User $user = null ) {
$this->load();
+
return Revision::userCanBitfield( $this->deleted, $field, $user );
}
}
if ( !$ret && $exception !== false ) {
throw new MWException( "`$title` is not a valid file title." );
}
+
return $ret;
}
return null;
} else {
$this->$name = call_user_func( $function );
+
return $this->$name;
}
}
$n = strrpos( $new, '.' );
$newExt = self::normalizeExtension( $n ? substr( $new, $n + 1 ) : '' );
$mimeMagic = MimeMagic::singleton();
+
return $mimeMagic->isMatchingExtension( $newExt, $oldMime );
}
* Called by ImagePage
* STUB
*/
- function upgradeRow() {}
+ function upgradeRow() {
+ }
/**
* Split an internet media type into its two components; if not
$this->assertRepoDefined();
$this->name = $this->repo->getNameFromTitle( $this->title );
}
+
return $this->name;
}
$this->extension = self::normalizeExtension(
$n ? substr( $this->getName(), $n + 1 ) : '' );
}
+
return $this->extension;
}
if ( $this->redirected ) {
return $this->getRedirectedTitle();
}
+
return $this->title;
}
$ext = $this->getExtension();
$this->url = $this->repo->getZoneUrl( 'public', $ext ) . '/' . $this->getUrlRel();
}
+
return $this->url;
}
} else {
wfDebug( __METHOD__ . ': supposed to render ' . $this->getName() .
' (' . $this->getMimeType() . "), but can't!\n" );
+
return $this->getURL(); #hm... return NULL?
}
} else {
$this->assertRepoDefined();
$this->path = $this->repo->getZonePath( 'public' ) . '/' . $this->getRel();
}
+
return $this->path;
}
$this->fsFile = false; // null => false; cache negative hits
}
}
+
return ( $this->fsFile )
? $this->fsFile->getPath()
: false;
*/
public function getCommonMetaArray() {
$handler = $this->getHandler();
+
return $handler->getCommonMetaArray( $this );
}
if ( !isset( $this->canRender ) ) {
$this->canRender = $this->getHandler() && $this->handler->canRender( $this );
}
+
return $this->canRender;
}
if ( !isset( $this->isSafeFile ) ) {
$this->isSafeFile = $this->_getIsSafeFile();
}
+
return $this->isSafeFile;
}
}
}
}
+
return $this->transformScript;
}
return $this->iconThumb();
}
$hp['width'] = $width;
+
return $this->transform( $hp );
}
$name = ( $this->repo && !( $flags & self::THUMB_FULL_NAME ) )
? $this->repo->nameForThumb( $this->getName() )
: $this->getName();
+
return $this->generateThumbName( $name, $params );
}
if ( $thumbExt != $extension ) {
$thumbName .= ".$thumbExt";
}
+
return $thumbName;
}
if ( is_null( $thumb ) || $thumb->isError() ) {
return '';
}
+
return $thumb->getUrl();
}
} while ( false );
wfProfileOut( __METHOD__ );
+
return is_object( $thumb ) ? $thumb : false;
}
if ( $thumbExt != '' && $thumbExt !== $this->getExtension() ) {
$fileName .= ".$thumbExt";
}
+
return FileBackend::makeContentDisposition( 'inline', $fileName );
}
* STUB
* Overridden by LocalFile
*/
- function migrateThumbFile( $thumbName ) {}
+ function migrateThumbFile( $thumbName ) {
+ }
/**
* Get a MediaHandler instance for this file
if ( !isset( $this->handler ) ) {
$this->handler = MediaHandler::getHandler( $this->getMimeType() );
}
+
return $this->handler;
}
$filepath = $wgStyleDirectory . $path;
if ( file_exists( $filepath ) ) { // always FS
$params = array( 'width' => 120, 'height' => 120 );
+
return new ThumbnailImage( $this, $wgStylePath . $path, false, $params );
}
}
+
return null;
}
* @param array $options Options, which include:
* 'forThumbRefresh' : The purging is only to refresh thumbnails
*/
- function purgeCache( $options = array() ) {}
+ function purgeCache( $options = array() ) {
+ }
/**
* Purge the file description page, but don't go after
* STUB
* Overridden in LocalFile.
*/
- public function resetHistory() {}
+ public function resetHistory() {
+ }
/**
* Get the filename hash component of the directory including trailing slash,
$this->assertRepoDefined();
$this->hashPath = $this->repo->getHashPath( $this->getName() );
}
+
return $this->hashPath;
}
} else {
$path .= $suffix;
}
+
return $path;
}
if ( $suffix !== false ) {
$path .= '/' . $suffix;
}
+
return $path;
}
} else {
$path .= $suffix;
}
+
return $path;
}
*/
function getArchivePath( $suffix = false ) {
$this->assertRepoDefined();
+
return $this->repo->getZonePath( 'public' ) . '/' . $this->getArchiveRel( $suffix );
}
*/
function getArchiveThumbPath( $archiveName, $suffix = false ) {
$this->assertRepoDefined();
+
return $this->repo->getZonePath( 'thumb' ) . '/' .
$this->getArchiveThumbRel( $archiveName, $suffix );
}
*/
function getThumbPath( $suffix = false ) {
$this->assertRepoDefined();
+
return $this->repo->getZonePath( 'thumb' ) . '/' . $this->getThumbRel( $suffix );
}
*/
function getTranscodedPath( $suffix = false ) {
$this->assertRepoDefined();
+
return $this->repo->getZonePath( 'transcoded' ) . '/' . $this->getThumbRel( $suffix );
}
} else {
$path .= rawurlencode( $suffix );
}
+
return $path;
}
} else {
$path .= rawurlencode( $suffix );
}
+
return $path;
}
if ( $suffix !== false ) {
$path .= '/' . rawurlencode( $suffix );
}
+
return $path;
}
if ( $suffix !== false ) {
$path .= '/' . rawurlencode( $suffix );
}
+
return $path;
}
} else {
$path .= rawurlencode( $suffix );
}
+
return $path;
}
if ( $suffix !== false ) {
$path .= '/' . rawurlencode( $suffix );
}
+
return $path;
}
*/
function isHashed() {
$this->assertRepoDefined();
+
return (bool)$this->repo->getHashLevels();
}
if ( !$this->getHandler() ) {
return false;
}
+
return $this->getHandler()->formatMetadata( $this, $this->getMetadata() );
}
*/
function wasDeleted() {
$title = $this->getTitle();
+
return $title && $title->isDeletedQuick();
}
$this->pageCount = false;
}
}
+
return $this->pageCount;
}
if ( !$this->getHandler() ) {
return false;
}
+
return $this->handler->getImageSize( $this, $fileName );
}
if ( $renderUrl ) {
if ( $this->repo->descriptionCacheExpiry > 0 ) {
wfDebug( "Attempting to get the description from cache..." );
- $key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', $lang->getCode(),
- $this->getName() );
+ $key = $this->repo->getLocalCacheKey(
+ 'RemoteFileDescription',
+ 'url',
+ $lang->getCode(),
+ $this->getName()
+ );
$obj = $wgMemc->get( $key );
if ( $obj ) {
wfDebug( "success!\n" );
+
return $obj;
}
wfDebug( "miss\n" );
if ( $res && $this->repo->descriptionCacheExpiry > 0 ) {
$wgMemc->set( $key, $res, $this->repo->descriptionCacheExpiry );
}
+
return $res;
} else {
return false;
*/
function getTimestamp() {
$this->assertRepoDefined();
+
return $this->repo->getFileTimestamp( $this->getPath() );
}
*/
function getSha1() {
$this->assertRepoDefined();
+
return $this->repo->getFileSha1( $this->getPath() );
}
}
$ext = $this->getExtension();
$dotExt = $ext === '' ? '' : ".$ext";
+
return $hash . $dotExt;
}
wfDeprecated( __METHOD__, '1.19' );
$fsFile = new FSFile( $path );
+
return $fsFile->getProps();
}
wfDeprecated( __METHOD__, '1.19' );
$fsFile = new FSFile( $path );
+
return $fsFile->getSha1Base36();
}
if ( !$this->redirectTitle ) {
$this->redirectTitle = Title::makeTitle( NS_FILE, $this->redirected );
}
+
return $this->redirectTitle;
}
+
return null;
}
} else {
$img = new self( $title, $repo, $info, true );
}
+
return $img;
} else {
return null;
);
if ( $thumbUrl === false ) {
global $wgLang;
+
return $this->repo->getThumbError(
$this->getName(),
$width,
$wgLang->getCode()
);
}
+
return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params );
}
if ( isset( $this->mInfo['metadata'] ) ) {
return serialize( self::parseMetadata( $this->mInfo['metadata'] ) );
}
+
return null;
}
if ( isset( $this->mInfo['extmetadata'] ) ) {
return $this->mInfo['extmetadata'];
}
+
return null;
}
foreach ( $metadata as $meta ) {
$ret[$meta['name']] = self::parseMetadata( $meta['value'] );
}
+
return $ret;
}
$magic = MimeMagic::singleton();
$this->mInfo['mime'] = $magic->guessTypesForExtension( $this->getExtension() );
}
+
return $this->mInfo['mime'];
}
return $this->mInfo['mediatype'];
}
$magic = MimeMagic::singleton();
+
return $magic->getMediaType( null, $this->getMimeType() );
}
if ( $suffix ) {
$path = $path . $suffix . '/';
}
+
return $path;
} else {
return null;
* @ingroup FileAbstraction
*/
class ForeignDBFile extends LocalFile {
-
/**
* @param $title
* @param $repo
$title = Title::makeTitle( NS_FILE, $row->img_name );
$file = new self( $title, $repo );
$file->loadFromRow( $row );
+
return $file;
}
if ( !$key ) {
wfProfileOut( __METHOD__ );
+
return false;
}
}
wfProfileOut( __METHOD__ );
+
return $this->dataLoaded;
}
foreach ( $array as $name => $value ) {
$decoded[substr( $name, $prefixLength )] = $value;
}
+
return $decoded;
}
if ( !$this->fileExists ) {
wfDebug( __METHOD__ . ": file does not exist, aborting\n" );
wfProfileOut( __METHOD__ );
+
return;
}
if ( wfReadOnly() ) {
wfProfileOut( __METHOD__ );
+
return;
}
wfDebug( __METHOD__ . ': upgrading ' . $this->getName() . " to the current schema\n" );
list( $fileExists ) = $this->repo->fileExists( $this->getVirtualUrl() );
$this->missing = !$fileExists;
}
+
return $this->missing;
}
*/
function getBitDepth() {
$this->load();
+
return $this->bits;
}
*/
public function getSize() {
$this->load();
+
return $this->size;
}
*/
function getMimeType() {
$this->load();
+
return $this->mime;
}
*/
function getMediaType() {
$this->load();
+
return $this->media_type;
}
*/
public function exists() {
$this->load();
+
return $this->fileExists;
}
clearstatcache();
}
*/
-
/*
if ( $this->repo->fileExists( $thumbDir ) ) {
// Delete file where directory should be
foreach ( $iterator as $file ) {
$files[] = $file;
}
- } catch ( FileBackendError $e ) {} // suppress (bug 54674)
+ } catch ( FileBackendError $e ) {
+ } // suppress (bug 54674)
return $files;
}
$dbr = $this->repo->getSlaveDB();
- if ( $this->historyLine == 0 ) {// called for the first time, return line from cur
+ if ( $this->historyLine == 0 ) { // called for the first time, return line from cur
$this->historyRes = $dbr->select( 'image',
array(
'*',
if ( 0 == $dbr->numRows( $this->historyRes ) ) {
$this->historyRes = null;
+
return false;
}
} elseif ( $this->historyLine == 1 ) {
array( 'ORDER BY' => 'oi_timestamp DESC' )
);
}
- $this->historyLine ++;
+ $this->historyLine++;
return $dbr->fetchObject( $this->historyRes );
}
if ( !$props ) {
wfProfileIn( __METHOD__ . '-getProps' );
if ( $this->repo->isVirtualUrl( $srcPath )
- || FileBackend::isStoragePath( $srcPath ) )
- {
+ || FileBackend::isStoragePath( $srcPath )
+ ) {
$props = $this->repo->getFileProps( $srcPath );
} else {
$props = FSFile::getPropsFromPath( $srcPath );
* @return bool
*/
function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '',
- $watch = false, $timestamp = false, User $user = null )
- {
+ $watch = false, $timestamp = false, User $user = null ) {
if ( !$user ) {
global $wgUser;
$user = $wgUser;
if ( $watch ) {
$user->addWatch( $this->getTitle() );
}
+
return true;
}
if ( !$this->fileExists ) {
wfDebug( __METHOD__ . ": File " . $this->getRel() . " went missing!\n" );
wfProfileOut( __METHOD__ );
+
return false;
}
# Insert previous contents into oldimage
$dbw->insertSelect( 'oldimage', 'image',
array(
- 'oi_name' => 'img_name',
+ 'oi_name' => 'img_name',
'oi_archive_name' => $dbw->addQuotes( $oldver ),
- 'oi_size' => 'img_size',
- 'oi_width' => 'img_width',
- 'oi_height' => 'img_height',
- 'oi_bits' => 'img_bits',
- 'oi_timestamp' => 'img_timestamp',
- 'oi_description' => 'img_description',
- 'oi_user' => 'img_user',
- 'oi_user_text' => 'img_user_text',
- 'oi_metadata' => 'img_metadata',
- 'oi_media_type' => 'img_media_type',
- 'oi_major_mime' => 'img_major_mime',
- 'oi_minor_mime' => 'img_minor_mime',
- 'oi_sha1' => 'img_sha1'
+ 'oi_size' => 'img_size',
+ 'oi_width' => 'img_width',
+ 'oi_height' => 'img_height',
+ 'oi_bits' => 'img_bits',
+ 'oi_timestamp' => 'img_timestamp',
+ 'oi_description' => 'img_description',
+ 'oi_user' => 'img_user',
+ 'oi_user_text' => 'img_user_text',
+ 'oi_metadata' => 'img_metadata',
+ 'oi_media_type' => 'img_media_type',
+ 'oi_major_mime' => 'img_major_mime',
+ 'oi_minor_mime' => 'img_minor_mime',
+ 'oi_sha1' => 'img_sha1'
),
array( 'img_name' => $this->getName() ),
__METHOD__
# Update the current image row
$dbw->update( 'image',
array( /* SET */
- 'img_size' => $this->size,
- 'img_width' => intval( $this->width ),
- 'img_height' => intval( $this->height ),
- 'img_bits' => $this->bits,
- 'img_media_type' => $this->media_type,
- 'img_major_mime' => $this->major_mime,
- 'img_minor_mime' => $this->minor_mime,
- 'img_timestamp' => $timestamp,
+ 'img_size' => $this->size,
+ 'img_width' => intval( $this->width ),
+ 'img_height' => intval( $this->height ),
+ 'img_bits' => $this->bits,
+ 'img_media_type' => $this->media_type,
+ 'img_major_mime' => $this->major_mime,
+ 'img_minor_mime' => $this->minor_mime,
+ 'img_timestamp' => $timestamp,
'img_description' => $comment,
- 'img_user' => $user->getId(),
- 'img_user_text' => $user->getName(),
- 'img_metadata' => $dbw->encodeBlob( $this->metadata ),
- 'img_sha1' => $this->sha1
+ 'img_user' => $user->getId(),
+ 'img_user_text' => $user->getName(),
+ 'img_metadata' => $dbw->encodeBlob( $this->metadata ),
+ 'img_sha1' => $this->sha1
),
array( 'img_name' => $this->getName() ),
__METHOD__
}
wfProfileOut( __METHOD__ );
+
return true;
}
*
* @param string $srcPath local filesystem path to the source image
* @param $flags Integer: a bitwise combination of:
- * File::DELETE_SOURCE Delete the source file, i.e. move rather than copy
+ * File::DELETE_SOURCE Delete the source file, i.e. move rather than copy
* @param array $options Optional additional parameters
* @return FileRepoStatus object. On success, the value member contains the
* archive name, or an empty string if it was a new file.
* @param string $srcPath local filesystem path to the source image
* @param string $dstRel target relative path
* @param $flags Integer: a bitwise combination of:
- * File::DELETE_SOURCE Delete the source file, i.e. move rather than copy
+ * File::DELETE_SOURCE Delete the source file, i.e. move rather than copy
* @param array $options Optional additional parameters
* @return FileRepoStatus object. On success, the value member contains the
* archive name, or an empty string if it was a new file.
// Hack: the lock()/unlock() pair is nested in a transaction so the locking is not
// tied to BEGIN/COMMIT. To avoid slow purges in the transaction, move them outside.
$this->getRepo()->getMasterDB()->onTransactionIdle(
- function() use ( $oldTitleFile, $newTitleFile, $archiveNames ) {
+ function () use ( $oldTitleFile, $newTitleFile, $archiveNames ) {
$oldTitleFile->purgeEverything();
foreach ( $archiveNames as $archiveName ) {
$oldTitleFile->purgeOldThumbnails( $archiveName );
// tied to BEGIN/COMMIT. To avoid slow purges in the transaction, move them outside.
$file = $this;
$this->getRepo()->getMasterDB()->onTransactionIdle(
- function() use ( $file, $archiveNames ) {
+ function () use ( $file, $archiveNames ) {
global $wgUseSquid;
$file->purgeEverything();
return false;
}
$pout = $content->getParserOutput( $this->title, null, new ParserOptions( null, $lang ) );
+
return $pout->getText();
}
if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_COMMENT ) ) {
return '';
} elseif ( $audience == self::FOR_THIS_USER
- && !$this->userCan( self::DELETED_COMMENT, $user ) )
- {
+ && !$this->userCan( self::DELETED_COMMENT, $user )
+ ) {
return '';
} else {
return $this->description;
*/
function getTimestamp() {
$this->load();
+
return $this->timestamp;
}
*/
function isCacheable() {
$this->load();
+
// If extra data (metadata) was not loaded then it must have been large
return $this->extraDataLoaded
- && strlen( serialize( $this->metadata ) ) <= self::CACHE_FIELD_MAX_LEN;
+ && strlen( serialize( $this->metadata ) ) <= self::CACHE_FIELD_MAX_LEN;
}
/**
if ( !$cache->lock( $key, 60 ) ) {
throw new MWException( "Could not acquire lock for '{$this->getName()}.'" );
}
- $dbw->onTransactionIdle( function() use ( $cache, $key ) {
+ $dbw->onTransactionIdle( function () use ( $cache, $key ) {
$cache->unlock( $key ); // release on commit
} );
}
$dbw->insertSelect( 'filearchive', 'image',
array(
'fa_storage_group' => $encGroup,
- 'fa_storage_key' => "CASE WHEN img_sha1='' THEN '' ELSE $concat END",
- 'fa_deleted_user' => $encUserId,
+ 'fa_storage_key' => "CASE WHEN img_sha1='' THEN '' ELSE $concat END",
+ 'fa_deleted_user' => $encUserId,
'fa_deleted_timestamp' => $encTimestamp,
- 'fa_deleted_reason' => $encReason,
- 'fa_deleted' => $this->suppress ? $bitfield : 0,
+ 'fa_deleted_reason' => $encReason,
+ 'fa_deleted' => $this->suppress ? $bitfield : 0,
- 'fa_name' => 'img_name',
+ 'fa_name' => 'img_name',
'fa_archive_name' => 'NULL',
- 'fa_size' => 'img_size',
- 'fa_width' => 'img_width',
- 'fa_height' => 'img_height',
- 'fa_metadata' => 'img_metadata',
- 'fa_bits' => 'img_bits',
- 'fa_media_type' => 'img_media_type',
- 'fa_major_mime' => 'img_major_mime',
- 'fa_minor_mime' => 'img_minor_mime',
- 'fa_description' => 'img_description',
- 'fa_user' => 'img_user',
- 'fa_user_text' => 'img_user_text',
- 'fa_timestamp' => 'img_timestamp',
- 'fa_sha1' => 'img_sha1',
+ 'fa_size' => 'img_size',
+ 'fa_width' => 'img_width',
+ 'fa_height' => 'img_height',
+ 'fa_metadata' => 'img_metadata',
+ 'fa_bits' => 'img_bits',
+ 'fa_media_type' => 'img_media_type',
+ 'fa_major_mime' => 'img_major_mime',
+ 'fa_minor_mime' => 'img_minor_mime',
+ 'fa_description' => 'img_description',
+ 'fa_user' => 'img_user',
+ 'fa_user_text' => 'img_user_text',
+ 'fa_timestamp' => 'img_timestamp',
+ 'fa_sha1' => 'img_sha1',
), $where, __METHOD__ );
}
$dbw->insertSelect( 'filearchive', 'oldimage',
array(
'fa_storage_group' => $encGroup,
- 'fa_storage_key' => "CASE WHEN oi_sha1='' THEN '' ELSE $concat END",
- 'fa_deleted_user' => $encUserId,
+ 'fa_storage_key' => "CASE WHEN oi_sha1='' THEN '' ELSE $concat END",
+ 'fa_deleted_user' => $encUserId,
'fa_deleted_timestamp' => $encTimestamp,
- 'fa_deleted_reason' => $encReason,
- 'fa_deleted' => $this->suppress ? $bitfield : 'oi_deleted',
+ 'fa_deleted_reason' => $encReason,
+ 'fa_deleted' => $this->suppress ? $bitfield : 'oi_deleted',
- 'fa_name' => 'oi_name',
+ 'fa_name' => 'oi_name',
'fa_archive_name' => 'oi_archive_name',
- 'fa_size' => 'oi_size',
- 'fa_width' => 'oi_width',
- 'fa_height' => 'oi_height',
- 'fa_metadata' => 'oi_metadata',
- 'fa_bits' => 'oi_bits',
- 'fa_media_type' => 'oi_media_type',
- 'fa_major_mime' => 'oi_major_mime',
- 'fa_minor_mime' => 'oi_minor_mime',
- 'fa_description' => 'oi_description',
- 'fa_user' => 'oi_user',
- 'fa_user_text' => 'oi_user_text',
- 'fa_timestamp' => 'oi_timestamp',
- 'fa_sha1' => 'oi_sha1',
+ 'fa_size' => 'oi_size',
+ 'fa_width' => 'oi_width',
+ 'fa_height' => 'oi_height',
+ 'fa_metadata' => 'oi_metadata',
+ 'fa_bits' => 'oi_bits',
+ 'fa_media_type' => 'oi_media_type',
+ 'fa_major_mime' => 'oi_major_mime',
+ 'fa_minor_mime' => 'oi_minor_mime',
+ 'fa_description' => 'oi_description',
+ 'fa_user' => 'oi_user',
+ 'fa_user_text' => 'oi_user_text',
+ 'fa_timestamp' => 'oi_timestamp',
+ 'fa_sha1' => 'oi_sha1',
), $where, __METHOD__ );
}
}
// TODO: delete the defunct filearchive rows if we are using a non-transactional DB
$this->file->unlockAndRollback();
wfProfileOut( __METHOD__ );
+
return $this->status;
}
if ( is_null( $row->fa_major_mime ) || $row->fa_major_mime == 'unknown'
|| is_null( $row->fa_minor_mime ) || $row->fa_minor_mime == 'unknown'
|| is_null( $row->fa_media_type ) || $row->fa_media_type == 'UNKNOWN'
- || is_null( $row->fa_metadata ) ) {
+ || is_null( $row->fa_metadata )
+ ) {
// Refresh our metadata
// Required for a new current revision; nice for older ones too. :)
$props = RepoGroup::singleton()->getFileProps( $deletedUrl );
'minor_mime' => $row->fa_minor_mime,
'major_mime' => $row->fa_major_mime,
'media_type' => $row->fa_media_type,
- 'metadata' => $row->fa_metadata
+ 'metadata' => $row->fa_metadata
);
}
// This revision will be published as the new current version
$destRel = $this->file->getRel();
$insertCurrent = array(
- 'img_name' => $row->fa_name,
- 'img_size' => $row->fa_size,
- 'img_width' => $row->fa_width,
- 'img_height' => $row->fa_height,
- 'img_metadata' => $props['metadata'],
- 'img_bits' => $row->fa_bits,
- 'img_media_type' => $props['media_type'],
- 'img_major_mime' => $props['major_mime'],
- 'img_minor_mime' => $props['minor_mime'],
+ 'img_name' => $row->fa_name,
+ 'img_size' => $row->fa_size,
+ 'img_width' => $row->fa_width,
+ 'img_height' => $row->fa_height,
+ 'img_metadata' => $props['metadata'],
+ 'img_bits' => $row->fa_bits,
+ 'img_media_type' => $props['media_type'],
+ 'img_major_mime' => $props['major_mime'],
+ 'img_minor_mime' => $props['minor_mime'],
'img_description' => $row->fa_description,
- 'img_user' => $row->fa_user,
- 'img_user_text' => $row->fa_user_text,
- 'img_timestamp' => $row->fa_timestamp,
- 'img_sha1' => $sha1
+ 'img_user' => $row->fa_user,
+ 'img_user_text' => $row->fa_user_text,
+ 'img_timestamp' => $row->fa_timestamp,
+ 'img_sha1' => $sha1
);
// The live (current) version cannot be hidden!
$archiveNames[$archiveName] = true;
$destRel = $this->file->getArchiveRel( $archiveName );
$insertBatch[] = array(
- 'oi_name' => $row->fa_name,
+ 'oi_name' => $row->fa_name,
'oi_archive_name' => $archiveName,
- 'oi_size' => $row->fa_size,
- 'oi_width' => $row->fa_width,
- 'oi_height' => $row->fa_height,
- 'oi_bits' => $row->fa_bits,
- 'oi_description' => $row->fa_description,
- 'oi_user' => $row->fa_user,
- 'oi_user_text' => $row->fa_user_text,
- 'oi_timestamp' => $row->fa_timestamp,
- 'oi_metadata' => $props['metadata'],
- 'oi_media_type' => $props['media_type'],
- 'oi_major_mime' => $props['major_mime'],
- 'oi_minor_mime' => $props['minor_mime'],
- 'oi_deleted' => $this->unsuppress ? 0 : $row->fa_deleted,
- 'oi_sha1' => $sha1 );
+ 'oi_size' => $row->fa_size,
+ 'oi_width' => $row->fa_width,
+ 'oi_height' => $row->fa_height,
+ 'oi_bits' => $row->fa_bits,
+ 'oi_description' => $row->fa_description,
+ 'oi_user' => $row->fa_user,
+ 'oi_user_text' => $row->fa_user_text,
+ 'oi_timestamp' => $row->fa_timestamp,
+ 'oi_metadata' => $props['metadata'],
+ 'oi_media_type' => $props['media_type'],
+ 'oi_major_mime' => $props['major_mime'],
+ 'oi_minor_mime' => $props['minor_mime'],
+ 'oi_deleted' => $this->unsuppress ? 0 : $row->fa_deleted,
+ 'oi_sha1' => $sha1 );
}
$deleteIds[] = $row->fa_id;
if ( !$statusDb->isGood() ) {
$this->file->unlockAndRollback();
$statusDb->ok = false;
+
return $statusDb;
}
wfDebugLog( 'imagemove', "Renamed {$this->file->getName()} in database: {$statusDb->successCount} successes, {$statusDb->failCount} failures" );
$this->file->unlockAndRollback(); // unlocks the destination
wfDebugLog( 'imagemove', "Error in moving files: " . $statusMove->getWikiText() );
$statusMove->ok = false;
+
return $statusMove;
}
$this->file->unlock(); // done
} else {
$status->failCount++;
$status->fatal( 'imageinvalidfilename' );
+
return $status;
}
if ( $time === null ) {
throw new MWException( __METHOD__ . ' got null for $time parameter' );
}
+
return new self( $title, $repo, $time, null );
}
$title = Title::makeTitle( NS_FILE, $row->oi_name );
$file = new self( $title, $repo, null, $row->oi_archive_name );
$file->loadFromRow( $row, 'oi_' );
+
return $file;
}
if ( !isset( $this->archive_name ) ) {
$this->load();
}
+
return $this->archive_name;
}
$fields = parent::getCacheFields( $prefix );
$fields[] = $prefix . 'archive_name';
$fields[] = $prefix . 'deleted';
+
return $fields;
}
if ( !$this->fileExists ) {
wfDebug( __METHOD__ . ": file does not exist, aborting\n" );
wfProfileOut( __METHOD__ );
+
return;
}
wfDebug( __METHOD__ . ': upgrading ' . $this->archive_name . " to the current schema\n" );
$dbw->update( 'oldimage',
array(
- 'oi_size' => $this->size, // sanity
- 'oi_width' => $this->width,
- 'oi_height' => $this->height,
- 'oi_bits' => $this->bits,
+ 'oi_size' => $this->size, // sanity
+ 'oi_width' => $this->width,
+ 'oi_height' => $this->height,
+ 'oi_bits' => $this->bits,
'oi_media_type' => $this->media_type,
'oi_major_mime' => $major,
'oi_minor_mime' => $minor,
- 'oi_metadata' => $this->metadata,
- 'oi_sha1' => $this->sha1,
+ 'oi_metadata' => $this->metadata,
+ 'oi_sha1' => $this->sha1,
), array(
'oi_name' => $this->getName(),
'oi_archive_name' => $this->archive_name ),
*/
function isDeleted( $field ) {
$this->load();
+
return ( $this->deleted & $field ) == $field;
}
*/
function getVisibility() {
$this->load();
+
return (int)$this->deleted;
}
*/
function userCan( $field, User $user = null ) {
$this->load();
+
return Revision::userCanBitfield( $this->deleted, $field, $user );
}
$dbw->insert( 'oldimage',
array(
- 'oi_name' => $this->getName(),
+ 'oi_name' => $this->getName(),
'oi_archive_name' => $archiveName,
- 'oi_size' => $props['size'],
- 'oi_width' => intval( $props['width'] ),
- 'oi_height' => intval( $props['height'] ),
- 'oi_bits' => $props['bits'],
- 'oi_timestamp' => $dbw->timestamp( $timestamp ),
- 'oi_description' => $comment,
- 'oi_user' => $user->getId(),
- 'oi_user_text' => $user->getName(),
- 'oi_metadata' => $props['metadata'],
- 'oi_media_type' => $props['media_type'],
- 'oi_major_mime' => $props['major_mime'],
- 'oi_minor_mime' => $props['minor_mime'],
- 'oi_sha1' => $props['sha1'],
+ 'oi_size' => $props['size'],
+ 'oi_width' => intval( $props['width'] ),
+ 'oi_height' => intval( $props['height'] ),
+ 'oi_bits' => $props['bits'],
+ 'oi_timestamp' => $dbw->timestamp( $timestamp ),
+ 'oi_description' => $comment,
+ 'oi_user' => $user->getId(),
+ 'oi_user_text' => $user->getName(),
+ 'oi_metadata' => $props['metadata'],
+ 'oi_media_type' => $props['media_type'],
+ 'oi_major_mime' => $props['major_mime'],
+ 'oi_minor_mime' => $props['minor_mime'],
+ 'oi_sha1' => $props['sha1'],
), __METHOD__
);
return true;
}
-
}
}
$this->dims[$page] = $this->handler->getPageDimensions( $this, $page );
}
+
return $this->dims[$page];
}
*/
function getWidth( $page = 1 ) {
$dim = $this->cachePageDimensions( $page );
+
return $dim['width'];
}
*/
function getHeight( $page = 1 ) {
$dim = $this->cachePageDimensions( $page );
+
return $dim['height'];
}
$magic = MimeMagic::singleton();
$this->mime = $magic->guessMimeType( $this->getLocalRefPath() );
}
+
return $this->mime;
}
if ( !$this->getHandler() ) {
return false;
}
+
return $this->handler->getImageSize( $this, $this->getLocalRefPath() );
}
$this->metadata = $this->handler->getMetadata( $this, $this->getLocalRefPath() );
}
}
+
return $this->metadata;
}
*/
function getSize() {
$this->assertRepoDefined();
+
return $this->repo->getFileSize( $this->path );
}