4 * File repository with no files, for performance testing
8 class ForeignAPIRepo
extends FileRepo
{
9 function __construct( $info ) {
10 parent
::__construct( $info );
11 $this->mApiBase
= $info['apibase']; // http://commons.wikimedia.org/w/api.php
14 function storeBatch( $triplets, $flags = 0 ) {
18 function storeTemp( $originalName, $srcPath ) {
21 function publishBatch( $triplets, $flags = 0 ) {
24 function deleteBatch( $sourceDestPairs ) {
27 function getFileProps( $virtualUrl ) {
30 function newFile( $title, $time = false ) {
33 function findFile( $title, $time = false ) {
34 $url = $this->mApiBase
.
39 'titles' => $title, // fixme -- canonical namespacea
40 'prop' => 'imageinfo',
41 'iiprop' => 'timestamp|user|comment|url|size|sha1|metadata' ) );
42 $json = Http
::get( $url );
43 $data = json_decode( $json, true );
45 if( isset( $data['query']['pages'] ) ) {
46 foreach( $data['query']['pages'] as $pageid => $info ) {
47 if( isset( $info['imageinfo'][0] ) ) {
48 return new ForeignAPIFile( $title, $this, $info['imageinfo'][0] );