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