return isset( $this->mInfo['url'] ) ? strval( $this->mInfo['url'] ) : null;
}
+ /**
+ * Get short description URL for a file based on the foreign API response,
+ * or if unavailable, the short URL is constructed from the foreign page ID.
+ *
+ * @return null|string
+ * @since 1.27
+ */
+ public function getDescriptionShortUrl() {
+ if ( isset( $this->mInfo['descriptionshorturl'] ) ) {
+ return $this->mInfo['descriptionshorturl'];
+ } elseif ( isset( $this->mInfo['pageid'] ) ) {
+ $url = $this->repo->makeUrl( array( 'curid' => $this->mInfo['pageid'] ) );
+ if ( $url !== false ) {
+ return $url;
+ }
+ }
+ return null;
+ }
+
/**
* @param string $type
* @return int|null|string
*/
function getSha1() {
return isset( $this->mInfo['sha1'] )
- ? wfBaseConvert( strval( $this->mInfo['sha1'] ), 16, 36, 31 )
+ ? Wikimedia\base_convert( strval( $this->mInfo['sha1'] ), 16, 36, 31 )
: null;
}
}
function purgeDescriptionPage() {
- global $wgMemc, $wgContLang;
+ global $wgContLang;
$url = $this->repo->getDescriptionRenderUrl( $this->getName(), $wgContLang->getCode() );
$key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', md5( $url ) );
- $wgMemc->delete( $key );
+ ObjectCache::getMainWANInstance()->delete( $key );
}
/**
* @param array $options
*/
function purgeThumbnails( $options = array() ) {
- global $wgMemc;
-
$key = $this->repo->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $this->getName() );
- $wgMemc->delete( $key );
+ ObjectCache::getMainWANInstance()->delete( $key );
$files = $this->getThumbnails();
// Give media handler a chance to filter the purge list
# Clear out the thumbnail directory if empty
$this->repo->quickCleanDir( $dir );
}
+
+ /**
+ * The thumbnail is created on the foreign server and fetched over internet
+ * @since 1.25
+ * @return bool
+ */
+ public function isTransformedLocally() {
+ return false;
+ }
}