* @return ForeignAPIFile|null
*/
static function newFromTitle( Title $title, $repo ) {
- $data = $repo->fetchImageQuery( array(
+ $data = $repo->fetchImageQuery( [
'titles' => 'File:' . $title->getDBkey(),
'iiprop' => self::getProps(),
'prop' => 'imageinfo',
// extmetadata is language-dependant, accessing the current language here
// would be problematic, so we just get them all
'iiextmetadatamultilang' => 1,
- ) );
+ ] );
$info = $repo->getImageInfo( $data );
if ( !is_array( $metadata ) ) {
return $metadata;
}
- $ret = array();
+ $ret = [];
foreach ( $metadata as $meta ) {
$ret[$meta['name']] = self::parseMetadata( $meta['value'] );
}
if ( isset( $this->mInfo['descriptionshorturl'] ) ) {
return $this->mInfo['descriptionshorturl'];
} elseif ( isset( $this->mInfo['pageid'] ) ) {
- $url = $this->repo->makeUrl( array( 'curid' => $this->mInfo['pageid'] ) );
+ $url = $this->repo->makeUrl( [ 'curid' => $this->mInfo['pageid'] ] );
if ( $url !== false ) {
return $url;
}
*/
function getThumbnails() {
$dir = $this->getThumbPath( $this->getName() );
- $iter = $this->repo->getBackend()->getFileList( array( 'dir' => $dir ) );
+ $iter = $this->repo->getBackend()->getFileList( [ 'dir' => $dir ] );
- $files = array();
+ $files = [];
foreach ( $iter as $file ) {
$files[] = $file;
}
/**
* @see File::purgeCache()
*/
- function purgeCache( $options = array() ) {
+ function purgeCache( $options = [] ) {
$this->purgeThumbnails( $options );
$this->purgeDescriptionPage();
}
/**
* @param array $options
*/
- function purgeThumbnails( $options = array() ) {
+ function purgeThumbnails( $options = [] ) {
$key = $this->repo->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $this->getName() );
ObjectCache::getMainWANInstance()->delete( $key );
}
$dir = $this->getThumbPath( $this->getName() );
- $purgeList = array();
+ $purgeList = [];
foreach ( $files as $file ) {
$purgeList[] = "{$dir}{$file}";
}