$this->mModuleName to $this->getModuleName()
[lhc/web/wiklou.git] / includes / filerepo / ForeignAPIRepo.php
index 6f43719..da920e0 100644 (file)
@@ -22,7 +22,7 @@ class ForeignAPIRepo extends FileRepo {
        var $apiThumbCacheExpiry = 86400;
        protected $mQueryCache = array();
        protected $mFileExists = array();
-       
+
        function __construct( $info ) {
                parent::__construct( $info );
                $this->mApiBase = $info['apibase']; // http://commons.wikimedia.org/w/api.php
@@ -42,7 +42,7 @@ class ForeignAPIRepo extends FileRepo {
                        $this->thumbUrl = $this->url . '/thumb';
                }
        }
-       
+
        /**
         * Per docs in FileRepo, this needs to return false if we don't support versioned
         * files. Well, we don't.
@@ -63,13 +63,16 @@ class ForeignAPIRepo extends FileRepo {
        function storeTemp( $originalName, $srcPath ) {
                return false;
        }
+       function append( $srcPath, $toAppendPath ){
+               return false;
+       }
        function publishBatch( $triplets, $flags = 0 ) {
                return false;
        }
        function deleteBatch( $sourceDestPairs ) {
                return false;
        }
-       
+
 
        function fileExistsBatch( $files, $flags = 0 ) {
                $results = array();
@@ -99,10 +102,10 @@ class ForeignAPIRepo extends FileRepo {
        function getFileProps( $virtualUrl ) {
                return false;
        }
-       
+
        protected function queryImage( $query ) {
                $data = $this->fetchImageQuery( $query );
-               
+
                if( isset( $data['query']['pages'] ) ) {
                        foreach( $data['query']['pages'] as $pageid => $info ) {
                                if( isset( $info['imageinfo'][0] ) ) {
@@ -112,10 +115,10 @@ class ForeignAPIRepo extends FileRepo {
                }
                return false;
        }
-       
+
        protected function fetchImageQuery( $query ) {
                global $wgMemc;
-               
+
                $url = $this->mApiBase .
                        '?' .
                        wfArrayToCgi(
@@ -123,7 +126,7 @@ class ForeignAPIRepo extends FileRepo {
                                        array(
                                                'format' => 'json',
                                                'action' => 'query' ) ) );
-               
+
                if( !isset( $this->mQueryCache[$url] ) ) {
                        $key = $this->getLocalCacheKey( 'ForeignAPIRepo', 'Metadata', md5( $url ) );
                        $data = $wgMemc->get( $key );
@@ -143,14 +146,14 @@ class ForeignAPIRepo extends FileRepo {
                }
                return FormatJson::decode( $this->mQueryCache[$url], true );
        }
-       
+
        function getImageInfo( $title, $time = false ) {
                return $this->queryImage( array(
                        'titles' => 'Image:' . $title->getText(),
                        'iiprop' => 'timestamp|user|comment|url|size|sha1|metadata|mime',
                        'prop' => 'imageinfo' ) );
        }
-       
+
        function findBySha1( $hash ) {
                $results = $this->fetchImageQuery( array(
                                                                                'aisha1base36' => $hash,
@@ -164,7 +167,7 @@ class ForeignAPIRepo extends FileRepo {
                }
                return $ret;
        }
-       
+
        function getThumbUrl( $name, $width=-1, $height=-1 ) {
                $info = $this->queryImage( array(
                        'titles' => 'Image:' . $name,
@@ -179,14 +182,14 @@ class ForeignAPIRepo extends FileRepo {
                        return false;
                }
        }
-       
+
        function getThumbUrlFromCache( $name, $width, $height ) {
                global $wgMemc, $wgUploadPath, $wgServer, $wgUploadDirectory;
-               
+
                if ( !$this->canCacheThumbs() ) {
                        return $this->getThumbUrl( $name, $width, $height );
                }
-               
+
                $key = $this->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $name );
                if ( $thumbUrl = $wgMemc->get($key) ) {
                        wfDebug("Got thumb from local cache. $thumbUrl \n");
@@ -194,7 +197,7 @@ class ForeignAPIRepo extends FileRepo {
                }
                else {
                        $foreignUrl = $this->getThumbUrl( $name, $width, $height );
-                       
+
                        // We need the same filename as the remote one :)
                        $fileName = rawurldecode( pathinfo( $foreignUrl, PATHINFO_BASENAME ) );
                        $path = 'thumb/' . $this->getHashPath( $name ) . $name . "/";
@@ -213,7 +216,7 @@ class ForeignAPIRepo extends FileRepo {
                        return $localUrl;
                }
        }
-       
+
        /**
         * @see FileRepo::getZoneUrl()
         */