r109106 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109105‎ | r109106 | r109107 >
Date:05:34, 17 January 2012
Author:aaron
Status:ok
Tags:filebackend 
Comment:
* Fixed type check in StreamFile::prepareForStream() for 404s
* Code comment tweaks and fixes
Modified paths:
  • /trunk/phase3/includes/StreamFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileOp.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FileOp.php
@@ -382,7 +382,7 @@
383383
384384 /**
385385 * Create a file in the backend with the given content.
386 - * Parameters similar to FileBackend::create(), which include:
 386+ * Parameters similar to FileBackend::createInternal(), which include:
387387 * content : a string of raw file contents
388388 * dst : destination storage path
389389 * overwriteDest : do nothing and pass if an identical file exists at destination
@@ -426,7 +426,7 @@
427427
428428 /**
429429 * Copy a file from one storage path to another in the backend.
430 - * Parameters similar to FileBackend::copy(), which include:
 430+ * Parameters similar to FileBackend::copyInternal(), which include:
431431 * src : source storage path
432432 * dst : destination storage path
433433 * overwriteDest : do nothing and pass if an identical file exists at destination
@@ -478,7 +478,7 @@
479479
480480 /**
481481 * Move a file from one storage path to another in the backend.
482 - * Parameters similar to FileBackend::move(), which include:
 482+ * Parameters similar to FileBackend::moveInternal(), which include:
483483 * src : source storage path
484484 * dst : destination storage path
485485 * overwriteDest : do nothing and pass if an identical file exists at destination
@@ -539,7 +539,7 @@
540540
541541 /**
542542 * Delete a file at the storage path.
543 - * Parameters similar to FileBackend::delete(), which include:
 543+ * Parameters similar to FileBackend::deleteInternal(), which include:
544544 * src : source storage path
545545 * ignoreMissingSource : don't return an error if the file does not exist
546546 */
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -75,7 +75,6 @@
7676
7777 /**
7878 * Get the unique backend name.
79 - *
8079 * We may have multiple different backends of the same type.
8180 * For example, we can have two Swift backends using different proxies.
8281 *
@@ -288,8 +287,9 @@
289288 abstract public function concatenate( array $params );
290289
291290 /**
292 - * Prepare a storage path for usage. This will create containers
293 - * that don't yet exist or, on FS backends, create parent directories.
 291+ * Prepare a storage directory for usage.
 292+ * This will create any required containers and parent directories.
 293+ * Backends using key/value stores only need to create the container.
294294 *
295295 * $params include:
296296 * dir : storage directory
@@ -312,8 +312,8 @@
313313 /**
314314 * Take measures to block web access to a storage directory and
315315 * the container it belongs to. FS backends might add .htaccess
316 - * files whereas backends like Swift this might restrict container
317 - * access to backend user that represents end-users in web request.
 316+ * files whereas key/value store backends might restrict container
 317+ * access to the auth user that represents end-users in web request.
318318 * This is not guaranteed to actually do anything.
319319 *
320320 * $params include:
@@ -341,8 +341,9 @@
342342 abstract protected function doSecure( array $params );
343343
344344 /**
345 - * Clean up an empty storage directory.
346 - * On FS backends, the directory will be deleted. Others may do nothing.
 345+ * Delete a storage directory if it is empty.
 346+ * Backends using key/value stores may do nothing unless the directory
 347+ * is that of an empty container, in which case it should be deleted.
347348 *
348349 * $params include:
349350 * dir : storage directory
Index: trunk/phase3/includes/StreamFile.php
@@ -41,17 +41,17 @@
4242 * (c) sends Content-Length header based on HTTP_IF_MODIFIED_SINCE check
4343 *
4444 * @param $path string Storage path or file system path
45 - * @param $info Array File stat info with 'mtime' and 'size' fields
 45+ * @param $info Array|false File stat info with 'mtime' and 'size' fields
4646 * @param $headers Array Additional headers to send
4747 * @param $sendErrors bool Send error messages if errors occur (like 404)
4848 * @return int|false READY_STREAM, NOT_MODIFIED, or false on failure
4949 */
5050 public static function prepareForStream(
51 - $path, array $info, $headers = array(), $sendErrors = true
 51+ $path, $info, $headers = array(), $sendErrors = true
5252 ) {
5353 global $wgLanguageCode;
5454
55 - if ( !$info ) {
 55+ if ( !is_array( $info ) ) {
5656 if ( $sendErrors ) {
5757 header( 'HTTP/1.0 404 Not Found' );
5858 header( 'Cache-Control: no-cache' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108353In FileBackend:...aaron08:40, 8 January 2012

Status & tagging log