r110968 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110967‎ | r110968 | r110969 >
Date:22:13, 8 February 2012
Author:aaron
Status:ok (Comments)
Tags:filebackend 
Comment:
* Corrected and improved FileBackend::getFileList() comments.
* Added unit tests for using getFileList() iterators twice.
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/filerepo/FileBackendTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/filerepo/FileBackendTest.php
@@ -1223,6 +1223,15 @@
12241224
12251225 $this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
12261226
 1227+ // Actual listing (using iterator second time)
 1228+ $list = array();
 1229+ foreach ( $iter as $file ) {
 1230+ $list[] = $file;
 1231+ }
 1232+ sort( $list );
 1233+
 1234+ $this->assertEquals( $expected, $list, "Correct file listing ($backendName), second iteration." );
 1235+
12271236 foreach ( $files as $file ) { // clean up
12281237 $this->backend->doOperation( array( 'op' => 'delete', 'src' => $file ) );
12291238 }
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -531,11 +531,14 @@
532532
533533 /**
534534 * Get an iterator to list out all stored files under a storage directory.
535 - * If the directory is of the form "mwstore://container", then all items in
536 - * the container should be listed. If of the form "mwstore://container/dir",
537 - * then all items under that container directory should be listed.
 535+ * If the directory is of the form "mwstore://backend/container",
 536+ * then all files in the container should be listed.
 537+ * If the directory is of form "mwstore://backend/container/dir",
 538+ * then all files under that container directory should be listed.
538539 * Results should be storage paths relative to the given directory.
539540 *
 541+ * Storage backends with eventual consistency might return stale data.
 542+ *
540543 * $params include:
541544 * dir : storage path directory
542545 *

Comments

#Comment by Hashar (talk | contribs)   08:55, 9 February 2012

Thanks Aaron!

Status & tagging log