From: Aaron Schulz Date: Tue, 17 Jan 2012 05:34:01 +0000 (+0000) Subject: * Fixed type check in StreamFile::prepareForStream() for 404s X-Git-Tag: 1.31.0-rc.0~25229 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=f1a06be61c916943021a971da5c470935a67e166;p=lhc%2Fweb%2Fwiklou.git * Fixed type check in StreamFile::prepareForStream() for 404s * Code comment tweaks and fixes --- diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 89c862e1ad..dc70712ad4 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -41,17 +41,17 @@ class StreamFile { * (c) sends Content-Length header based on HTTP_IF_MODIFIED_SINCE check * * @param $path string Storage path or file system path - * @param $info Array File stat info with 'mtime' and 'size' fields + * @param $info Array|false File stat info with 'mtime' and 'size' fields * @param $headers Array Additional headers to send * @param $sendErrors bool Send error messages if errors occur (like 404) * @return int|false READY_STREAM, NOT_MODIFIED, or false on failure */ public static function prepareForStream( - $path, array $info, $headers = array(), $sendErrors = true + $path, $info, $headers = array(), $sendErrors = true ) { global $wgLanguageCode; - if ( !$info ) { + if ( !is_array( $info ) ) { if ( $sendErrors ) { header( 'HTTP/1.0 404 Not Found' ); header( 'Cache-Control: no-cache' ); diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index 71ce4bba49..ded152bc4d 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -75,7 +75,6 @@ abstract class FileBackendBase { /** * Get the unique backend name. - * * We may have multiple different backends of the same type. * For example, we can have two Swift backends using different proxies. * @@ -288,8 +287,9 @@ abstract class FileBackendBase { abstract public function concatenate( array $params ); /** - * Prepare a storage path for usage. This will create containers - * that don't yet exist or, on FS backends, create parent directories. + * Prepare a storage directory for usage. + * This will create any required containers and parent directories. + * Backends using key/value stores only need to create the container. * * $params include: * dir : storage directory @@ -312,8 +312,8 @@ abstract class FileBackendBase { /** * Take measures to block web access to a storage directory and * the container it belongs to. FS backends might add .htaccess - * files whereas backends like Swift this might restrict container - * access to backend user that represents end-users in web request. + * files whereas key/value store backends might restrict container + * access to the auth user that represents end-users in web request. * This is not guaranteed to actually do anything. * * $params include: @@ -341,8 +341,9 @@ abstract class FileBackendBase { abstract protected function doSecure( array $params ); /** - * Clean up an empty storage directory. - * On FS backends, the directory will be deleted. Others may do nothing. + * Delete a storage directory if it is empty. + * Backends using key/value stores may do nothing unless the directory + * is that of an empty container, in which case it should be deleted. * * $params include: * dir : storage directory diff --git a/includes/filerepo/backend/FileOp.php b/includes/filerepo/backend/FileOp.php index 8152cfe89c..cd20097f2a 100644 --- a/includes/filerepo/backend/FileOp.php +++ b/includes/filerepo/backend/FileOp.php @@ -382,7 +382,7 @@ class StoreFileOp extends FileOp { /** * Create a file in the backend with the given content. - * Parameters similar to FileBackend::create(), which include: + * Parameters similar to FileBackend::createInternal(), which include: * content : a string of raw file contents * dst : destination storage path * overwriteDest : do nothing and pass if an identical file exists at destination @@ -426,7 +426,7 @@ class CreateFileOp extends FileOp { /** * Copy a file from one storage path to another in the backend. - * Parameters similar to FileBackend::copy(), which include: + * Parameters similar to FileBackend::copyInternal(), which include: * src : source storage path * dst : destination storage path * overwriteDest : do nothing and pass if an identical file exists at destination @@ -478,7 +478,7 @@ class CopyFileOp extends FileOp { /** * Move a file from one storage path to another in the backend. - * Parameters similar to FileBackend::move(), which include: + * Parameters similar to FileBackend::moveInternal(), which include: * src : source storage path * dst : destination storage path * overwriteDest : do nothing and pass if an identical file exists at destination @@ -539,7 +539,7 @@ class MoveFileOp extends FileOp { /** * Delete a file at the storage path. - * Parameters similar to FileBackend::delete(), which include: + * Parameters similar to FileBackend::deleteInternal(), which include: * src : source storage path * ignoreMissingSource : don't return an error if the file does not exist */