X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2FFileRepo.php;h=15007af556f69eac28f9145cb8b80f0407252843;hb=09cc5e1e42ad827eef8f8db7b16fbaa7ca238a9f;hp=c0ae3b6d0e82dc6b299e73c94acea75e242ac9cd;hpb=10973705e0429fc6d909c4995f55179381c906b7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index c0ae3b6d0e..15007af556 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -79,7 +79,7 @@ class FileRepo { protected $scriptDirUrl; /** @var string Script extension of the MediaWiki installation, equivalent - * to $wgScriptExtension, e.g. .php5 defaults to .php */ + * to the old $wgScriptExtension, e.g. .php5 defaults to .php */ protected $scriptExtension; /** @var string Equivalent to $wgArticlePath, e.g. https://en.wikipedia.org/wiki/$1 */ @@ -123,13 +123,13 @@ class FileRepo { /** @var bool Whether all zones should be private (e.g. private wiki repo) */ protected $isPrivate; - /** - * Factory functions for creating new files - * Override these in the base class - */ + /** @var array callable Override these in the base class */ protected $fileFactory = array( 'UnregisteredLocalFile', 'newFromTitle' ); + /** @var array callable|bool Override these in the base class */ protected $oldFileFactory = false; + /** @var array callable|bool Override these in the base class */ protected $fileFactoryKey = false; + /** @var array callable|bool Override these in the base class */ protected $oldFileFactoryKey = false; /** @@ -1031,8 +1031,10 @@ class FileRepo { $headers = array( 'Content-Disposition' => $triple[2] ); } elseif ( is_array( $triple[2] ) && isset( $triple[2]['headers'] ) ) { $headers = $triple[2]['headers']; + } else { + $headers = array(); } - // @fixme: $headers might not be defined + $operations[] = array( 'op' => FileBackend::isStoragePath( $src ) ? 'copy' : 'store', 'src' => $src, @@ -1595,13 +1597,26 @@ class FileRepo { * * @param string $virtualUrl * @param array $headers Additional HTTP headers to send on success - * @return bool Success + * @return Status + * @since 1.27 */ - public function streamFile( $virtualUrl, $headers = array() ) { + public function streamFileWithStatus( $virtualUrl, $headers = array() ) { $path = $this->resolveToStoragePath( $virtualUrl ); $params = array( 'src' => $path, 'headers' => $headers ); - return $this->backend->streamFile( $params )->isOK(); + return $this->backend->streamFile( $params ); + } + + /** + * 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 = array() ) { + return $this->streamFileWithStatus( $virtualUrl, $headers )->isOK(); } /**