* @ingroup FileRepo
*/
class FSRepo extends FileRepo {
- var $directory, $deletedDir, $url, $deletedHashLevels, $fileMode;
+ var $directory, $deletedDir, $deletedHashLevels, $fileMode;
var $fileFactory = array( 'UnregisteredLocalFile', 'newFromTitle' );
var $oldFileFactory = false;
var $pathDisclosureProtection = 'simple';
}
/**
- * Get the URL corresponding to one of the three basic zones
+ * @see FileRepo::getZoneUrl()
*/
function getZoneUrl( $zone ) {
switch ( $zone ) {
case 'temp':
return "{$this->url}/temp";
case 'deleted':
- return false; // no public URL
+ return parent::getZoneUrl( $zone ); // no public URL
case 'thumb':
return $this->thumbUrl;
default:
- return false;
+ return parent::getZoneUrl( $zone );
}
}
var $thumbScriptUrl, $transformVia404;
var $descBaseUrl, $scriptDirUrl, $articleUrl, $fetchDescription, $initialCapital;
var $pathDisclosureProtection = 'paranoid';
- var $descriptionCacheExpiry, $apiThumbCacheExpiry, $hashLevels;
+ var $descriptionCacheExpiry, $hashLevels, $url, $thumbUrl;
/**
* Factory functions for creating new files
$this->initialCapital = true; // by default
foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection',
- 'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'hashLevels' ) as $var )
+ 'descriptionCacheExpiry', 'hashLevels', 'url', 'thumbUrl' ) as $var )
{
if ( isset( $info[$var] ) ) {
$this->$var = $info[$var];
function getThumbScriptUrl() {
return $this->thumbScriptUrl;
}
+
+ /**
+ * Get the URL corresponding to one of the four basic zones
+ * @param String $zone One of: public, deleted, temp, thumb
+ * @return String or false
+ */
+ function getZoneUrl( $zone ) {
+ return false;
+ }
/**
* Returns true if the repository can transform files via a 404 handler
function __construct( $info ) {
parent::__construct( $info );
$this->mApiBase = $info['apibase']; // http://commons.wikimedia.org/w/api.php
+ if( isset( $info['apiThumbCacheExpiry'] ) ) {
+ $this->apiThumbCacheExpiry = $info['apiThumbCacheExpiry'];
+ }
if( !$this->scriptDirUrl ) {
// hack for description fetches
$this->scriptDirUrl = dirname( $this->mApiBase );
}
+ // If we can cache thumbs we can guess sane defaults for these
+ if( $this->canCacheThumbs() && !$this->url ) {
+ global $wgLocalFileRepo;
+ $this->url = $wgLocalFileRepo['url'];
+ }
+ if( $this->canCacheThumbs() && !$this->thumbUrl ) {
+ $this->thumbUrl = $this->url . '/thumb';
+ }
}
/**
}
}
+ /**
+ * @see FileRepo::getZoneUrl()
+ */
+ function getZoneUrl( $zone ) {
+ switch ( $zone ) {
+ case 'public':
+ return $this->url;
+ case 'thumb':
+ return $this->thumbUrl;
+ default:
+ return parent::getZoneUrl( $zone );
+ }
+ }
+
/**
* Are we locally caching the thumbnails?
* @return bool