* Overridden by LocalFile, UnregisteredLocalFile
* STUB
*/
- function getMetadata() { return false; }
+ public function getMetadata() { return false; }
+
+ /**
+ * Return the bit depth of the file
+ * Overridden by LocalFile
+ * STUB
+ */
+ public function getBitDepth() { return 0; }
/**
* Return the size of the image file, in bytes
*
* @param integer $width maximum width of the generated thumbnail
* @param integer $height maximum height of the image (optional)
- * @param boolean $render True to render the thumbnail if it doesn't exist,
- * false to just return the URL
+ * @param boolean $render Deprecated
*
* @return ThumbnailImage or null on failure
*
if ( $height != -1 ) {
$params['height'] = $height;
}
- $flags = $render ? self::RENDER_NOW : 0;
- return $this->transform( $params, $flags );
+ return $this->transform( $params, 0 );
}
/**
// Purge. Useful in the event of Core -> Squid connection failure or squid
// purge collisions from elsewhere during failure. Don't keep triggering for
// "thumbs" which have the main image URL though (bug 13776)
- if ( $wgUseSquid && ($thumb->isError() || $thumb->getUrl() != $this->getURL()) ) {
+ if ( $wgUseSquid && ( !$thumb || $thumb->isError() || $thumb->getUrl() != $this->getURL()) ) {
SquidUpdate::purge( array( $thumbUrl ) );
}
} while (false);
* Get the HTML text of the description page, if available
*/
function getDescriptionText() {
- global $wgMemc, $wgTranscludeCacheExpiry;
+ global $wgMemc;
if ( !$this->repo->fetchDescription ) {
return false;
}
$renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName() );
if ( $renderUrl ) {
- if ( $this->repo->useLocalCache ) {
- wfDebug("Attempting to get the description from the transwiki cache...");
- $key = md5($renderUrl);
+ if ( $this->repo->descriptionCacheExpiry > 0 ) {
+ wfDebug("Attempting to get the description from cache...");
+ $key = wfMemcKey( 'RemoteFileDescription', 'url', md5($renderUrl) );
$obj = $wgMemc->get($key);
if ($obj) {
wfDebug("success!\n");
}
wfDebug( "Fetching shared description from $renderUrl\n" );
$res = Http::get( $renderUrl );
- if ( $res && $this->repo->useLocalCache ) $wgMemc->set( $key, $res, time() + $wgTranscludeCacheExpiry );
+ if ( $res && $this->repo->descriptionCacheExpiry > 0 ) $wgMemc->set( $key, $res, $this->repo->descriptionCacheExpiry );
return $res;
} else {
return false;