X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2FFileRepo.php;h=3a366c832c2933c9e97d3973d36141c7c03f5599;hb=4d6828ef7835b7c5c5e903637fcba4bf5c487e1b;hp=858e124af4177798942e6c46b3601819ed86c0c4;hpb=4e021bb8d4741d5af0f02942fe3c33a19e7fabca;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 858e124af4..3a366c832c 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -137,6 +137,9 @@ class FileRepo { /** @var string Secret key to pass as an X-Swift-Secret header to the proxied thumb service */ protected $thumbProxySecret; + /** @var WANObjectCache */ + protected $wanCache; + /** * @param array|null $info * @throws MWException @@ -200,6 +203,8 @@ class FileRepo { } $this->supportsSha1URLs = !empty( $info['supportsSha1URLs'] ); + + $this->wanCache = $info['wanCache'] ?? WANObjectCache::newEmpty(); } /** @@ -810,8 +815,9 @@ class FileRepo { */ public function getDescriptionStylesheetUrl() { if ( isset( $this->scriptDirUrl ) ) { - return $this->makeUrl( 'title=MediaWiki:Filepage.css&' . - wfArrayToCgi( Skin::getDynamicStylesheetQuery() ) ); + // Must match canonical query parameter order for optimum caching + // See Title::getCdnUrls + return $this->makeUrl( 'title=MediaWiki:Filepage.css&action=raw&ctype=text/css' ); } return false; @@ -1506,7 +1512,7 @@ class FileRepo { * @throws MWException */ protected function resolveToStoragePath( $path ) { - if ( $this->isVirtualUrl( $path ) ) { + if ( self::isVirtualUrl( $path ) ) { return $this->resolveVirtualUrl( $path ); } @@ -1624,18 +1630,6 @@ class FileRepo { return $status; } - /** - * Attempt to stream a file with the given virtual URL/storage path - * - * @deprecated since 1.26, use streamFileWithStatus - * @param string $virtualUrl - * @param array $headers Additional HTTP headers to send on success - * @return bool Success - */ - public function streamFile( $virtualUrl, $headers = [] ) { - return $this->streamFileWithStatus( $virtualUrl, $headers )->isOK(); - } - /** * Call a callback function for every public regular file in the repository. * This only acts on the current version of files, not any old versions. @@ -1817,7 +1811,7 @@ class FileRepo { /** * Get a key on the primary cache for this repository. * Returns false if the repository's cache is not accessible at this site. - * The parameters are the parts of the key, as for wfMemcKey(). + * The parameters are the parts of the key. * * STUB * @return bool @@ -1829,7 +1823,7 @@ class FileRepo { /** * Get a key for this repo in the local cache domain. These cache keys are * not shared with remote instances of the repo. - * The parameters are the parts of the key, as for wfMemcKey(). + * The parameters are the parts of the key. * * @return string */ @@ -1837,7 +1831,7 @@ class FileRepo { $args = func_get_args(); array_unshift( $args, 'filerepo', $this->getName() ); - return wfMemcKey( ...$args ); + return $this->wanCache->makeKey( ...$args ); } /**