X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2FFileRepo.php;h=6b329534498e26030faa9cd3299d2ebffa7170fb;hb=16ef3e79c4c52aa6b74563b7eadcfc9792e7a4c4;hp=dc36e50a1e9e8e2b427a1e034562024a89538a84;hpb=0bce3d6b8c1dc3c2aa1e686f0b5bafc4fd9ba550;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index dc36e50a1e..6b32953449 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -124,7 +124,7 @@ class FileRepo { protected $isPrivate; /** @var array callable Override these in the base class */ - protected $fileFactory = [ 'UnregisteredLocalFile', 'newFromTitle' ]; + protected $fileFactory = [ UnregisteredLocalFile::class, 'newFromTitle' ]; /** @var array callable|bool Override these in the base class */ protected $oldFileFactory = false; /** @var array callable|bool Override these in the base class */ @@ -132,6 +132,13 @@ class FileRepo { /** @var array callable|bool Override these in the base class */ protected $oldFileFactoryKey = false; + /** @var string URL of where to proxy thumb.php requests to. + * Example: http://127.0.0.1:8888/wiki/dev/thumb/ + */ + protected $thumbProxyUrl; + /** @var string Secret key to pass as an X-Swift-Secret header to the proxied thumb service */ + protected $thumbProxySecret; + /** * @param array|null $info * @throws MWException @@ -159,7 +166,7 @@ class FileRepo { $optionalSettings = [ 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription', 'thumbScriptUrl', 'pathDisclosureProtection', 'descriptionCacheExpiry', - 'scriptExtension', 'favicon' + 'scriptExtension', 'favicon', 'thumbProxyUrl', 'thumbProxySecret' ]; foreach ( $optionalSettings as $var ) { if ( isset( $info[$var] ) ) { @@ -611,6 +618,24 @@ class FileRepo { return $this->thumbScriptUrl; } + /** + * Get the URL thumb.php requests are being proxied to + * + * @return string + */ + public function getThumbProxyUrl() { + return $this->thumbProxyUrl; + } + + /** + * Get the secret key for the proxied thumb service + * + * @return string + */ + public function getThumbProxySecret() { + return $this->thumbProxySecret; + } + /** * Returns true if the repository can transform files via a 404 handler * @@ -1543,7 +1568,7 @@ class FileRepo { */ public function getFileProps( $virtualUrl ) { $fsFile = $this->getLocalReference( $virtualUrl ); - $mwProps = new MWFileProps( MimeMagic::singleton() ); + $mwProps = new MWFileProps( MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer() ); if ( $fsFile ) { $props = $mwProps->getPropsFromPath( $fsFile->getPath(), true ); } else { @@ -1603,7 +1628,7 @@ class FileRepo { $params = [ 'src' => $path, 'headers' => $headers, 'options' => $optHeaders ]; // T172851: HHVM does not flush the output properly, causing OOM - ob_start( NULL, 1048576 ); + ob_start( null, 1048576 ); ob_implicit_flush( true ); $status = $this->newGood(); @@ -1722,7 +1747,7 @@ class FileRepo { * @return Status */ public function newFatal( $message /*, parameters...*/ ) { - $status = call_user_func_array( [ 'Status', 'newFatal' ], func_get_args() ); + $status = call_user_func_array( [ Status::class, 'newFatal' ], func_get_args() ); $status->cleanCallback = $this->getErrorCleanupFunction(); return $status;