Merge "Add ability to filter based on rc_title in API"
[lhc/web/wiklou.git] / includes / filerepo / ForeignAPIRepo.php
index 1a86648..cba21c8 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * A foreign repository with a remote MediaWiki with an API thingy
@@ -120,7 +121,7 @@ class ForeignAPIRepo extends FileRepo {
        }
 
        /**
-        * @param array $files
+        * @param string[] $files
         * @return array
         */
        function fileExistsBatch( array $files ) {
@@ -176,7 +177,7 @@ class ForeignAPIRepo extends FileRepo {
 
        /**
         * @param string $virtualUrl
-        * @return bool
+        * @return false
         */
        function getFileProps( $virtualUrl ) {
                return false;
@@ -231,7 +232,7 @@ class ForeignAPIRepo extends FileRepo {
 
        /**
         * @param string $hash
-        * @return array
+        * @return ForeignAPIFile[]
         */
        function findBySha1( $hash ) {
                $results = $this->fetchImageQuery( [
@@ -257,10 +258,10 @@ class ForeignAPIRepo extends FileRepo {
         * @param string $name
         * @param int $width
         * @param int $height
-        * @param array &$result
+        * @param array|null &$result Output-only parameter, guaranteed to become an array
         * @param string $otherParams
         *
-        * @return bool
+        * @return string|false
         */
        function getThumbUrl( $name, $width = -1, $height = -1, &$result = null, $otherParams = '' ) {
                $data = $this->fetchImageQuery( [
@@ -287,7 +288,7 @@ class ForeignAPIRepo extends FileRepo {
         * @param int $width
         * @param int $height
         * @param string $otherParams
-        * @param string $lang Language code for language of error
+        * @param string|null $lang Language code for language of error
         * @return bool|MediaTransformError
         * @since 1.22
         */
@@ -332,7 +333,7 @@ class ForeignAPIRepo extends FileRepo {
         * @return bool|string
         */
        function getThumbUrlFromCache( $name, $width, $height, $params = "" ) {
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                // We can't check the local cache using FileRepo functions because
                // we override fileExistsBatch(). We have to use the FileBackend directly.
                $backend = $this->getBackend(); // convenience
@@ -569,7 +570,7 @@ class ForeignAPIRepo extends FileRepo {
                        $url = $this->makeUrl( $query, 'api' );
                }
 
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                return $cache->getWithSetCallback(
                        $this->getLocalCacheKey( static::class, $target, md5( $url ) ),
                        $cacheTTL,