Merge "Improve specialmute-email-footer description"
[lhc/web/wiklou.git] / includes / filerepo / file / File.php
index 7d4f4df..ee7ee6f 100644 (file)
@@ -5,6 +5,7 @@
  *
  * Represents files in a repository.
  */
+use Wikimedia\AtEase\AtEase;
 use MediaWiki\MediaWikiServices;
 
 /**
@@ -44,8 +45,16 @@ use MediaWiki\MediaWikiServices;
  *
  * RepoGroup::singleton()->getLocalRepo()->newFile( $title );
  *
- * The convenience functions wfLocalFile() and wfFindFile() should be sufficient
- * in most cases.
+ * Consider the services container below;
+ *
+ * $services = MediaWikiServices::getInstance();
+ *
+ * The convenience services $services->getRepoGroup()->getLocalRepo()->newFile()
+ * and $services->getRepoGroup()->findFile() should be sufficient in most cases.
+ *
+ * @TODO: DI - Instead of using MediaWikiServices::getInstance(), a service should
+ * ideally accept a RepoGroup in its constructor and then, use $this->repoGroup->findFile()
+ * and $this->repoGroup->getLocalRepo()->newFile().
  *
  * @ingroup FileAbstraction
  */
@@ -1952,8 +1961,7 @@ abstract class File implements IDBAccessObject {
         * @param array $versions Set of record ids of deleted items to restore,
         *   or empty to restore all revisions.
         * @param bool $unsuppress Remove restrictions on content upon restoration?
-        * @return int|bool The number of file revisions restored if successful,
-        *   or false on failure
+        * @return Status
         * STUB
         * Overridden by LocalFile
         */
@@ -2070,7 +2078,8 @@ abstract class File implements IDBAccessObject {
                                $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
                                function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
                                        wfDebug( "Fetching shared description from $renderUrl\n" );
-                                       $res = Http::get( $renderUrl, [], $fname );
+                                       $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
+                                               get( $renderUrl, [], $fname );
                                        if ( !$res ) {
                                                $ttl = WANObjectCache::TTL_UNCACHEABLE;
                                        }
@@ -2170,7 +2179,7 @@ abstract class File implements IDBAccessObject {
                        $metadata = $this->getMetadata();
 
                        if ( is_string( $metadata ) ) {
-                               $metadata = Wikimedia\quietCall( 'unserialize', $metadata );
+                               $metadata = AtEase::quietCall( 'unserialize', $metadata );
                        }
 
                        if ( !is_array( $metadata ) ) {