r105003 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105002‎ | r105003 | r105004 >
Date:21:28, 2 December 2011
Author:aaron
Status:deferred
Tags:
Comment:
* Removed debug code in img_auth.php
* Renamed 'sources' => 'srcs' for concatenate for consistency
* Various documentation cleanups
Modified paths:
  • /branches/FileBackend/phase3/img_auth.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileBackendGroup.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/LockManager.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/LockManagerGroup.php (modified) (history)

Diff [purge]

Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
@@ -1,7 +1,6 @@
22 <?php
33 /**
44 * @file
5 - * @ingroup FileRepo
65 * @ingroup FileBackend
76 */
87
@@ -27,7 +26,6 @@
2827 *
2928 * Non-persistent backends used for caching must be declared.
3029 *
31 - * @ingroup FileRepo
3230 * @ingroup FileBackend
3331 */
3432 class FileBackendMultiWrite extends FileBackendBase {
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php
@@ -1,7 +1,7 @@
22 <?php
33 /**
44 * @file
5 - * @ingroup FileRepo
 5+ * @ingroup FileBackend
66 */
77
88 /**
@@ -10,6 +10,8 @@
1111 *
1212 * Access use of large fields should be avoided as we want to be able to support
1313 * potentially many FileOp classes in large arrays in memory.
 14+ *
 15+ * @ingroup FileBackend
1416 */
1517 abstract class FileOp {
1618 /** $var Array */
@@ -188,7 +190,7 @@
189191 }
190192
191193 /**
192 - * Backup any file at the destination to a temporary file.
 194+ * Backup the file at the destination to a temporary file.
193195 * Don't bother backing it up unless we might overwrite the file.
194196 * This assumes that the destination is in the backend and that
195197 * the source is either in the backend or on the file system.
@@ -635,7 +637,7 @@
636638 /**
637639 * Combines files from severals storage paths into a new file in the backend.
638640 * Parameters similar to FileBackend::concatenate(), which include:
639 - * sources : ordered source storage paths (e.g. chunk1, chunk2, ...)
 641+ * srcs : ordered source storage paths (e.g. chunk1, chunk2, ...)
640642 * dst : destination storage path
641643 * overwriteDest : do nothing and pass if an identical file exists at destination
642644 */
@@ -654,7 +656,7 @@
655657 $this->checkDest = false;
656658 }
657659 // Check that source files exists
658 - foreach ( $this->params['sources'] as $source ) {
 660+ foreach ( $this->params['srcs'] as $source ) {
659661 if ( !$this->fileExists( $source, $predicates ) ) {
660662 $status->fatal( 'backend-fail-notexists', $source );
661663 return $status;
@@ -696,7 +698,7 @@
697699 }
698700
699701 function storagePathsUsed() {
700 - return array_merge( $this->params['sources'], $this->params['dst'] );
 702+ return array_merge( $this->params['srcs'], $this->params['dst'] );
701703 }
702704 }
703705
Index: branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php
@@ -1,7 +1,6 @@
22 <?php
33 /**
44 * @file
5 - * @ingroup FileRepo
65 * @ingroup FileBackend
76 */
87
@@ -10,7 +9,6 @@
1110 * Status messages should avoid mentioning the internal FS paths.
1211 * Likewise, error suppression should be used to path disclosure.
1312 *
14 - * @ingroup FileRepo
1513 * @ingroup FileBackend
1614 */
1715 class FSFileBackend extends FileBackend {
@@ -201,7 +199,7 @@
202200 $status->fatal( 'backend-fail-opentemp', $tmpPath );
203201 return $status;
204202 }
205 - foreach ( $params['sources'] as $virtualSource ) {
 203+ foreach ( $params['srcs'] as $virtualSource ) {
206204 list( $c, $source ) = $this->resolveStoragePath( $virtualSource );
207205 if ( $source === null ) {
208206 $status->fatal( 'backend-fail-invalidpath', $virtualSource );
@@ -449,7 +447,7 @@
450448 $i = strrpos( $source, '.' );
451449 $ext = strtolower( $i ? substr( $source, $i + 1 ) : '' );
452450 // Create a new temporary file...
453 - $tmpFile = TempFSFile::factory( 'localcopy', $ext );
 451+ $tmpFile = TempFSFile::factory( 'localcopy_', $ext );
454452 if ( !$tmpFile ) {
455453 return null;
456454 }
Index: branches/FileBackend/phase3/includes/filerepo/backend/LockManagerGroup.php
@@ -1,6 +1,8 @@
22 <?php
33 /**
44 * Class to handle file lock manager registration
 5+ *
 6+ * @ingroup FileBackend
57 */
68 class LockManagerGroup {
79 protected static $instance = null;
Index: branches/FileBackend/phase3/includes/filerepo/backend/LockManager.php
@@ -7,6 +7,8 @@
88 * This can reduce hits to external resources for lock()/unlock() calls.
99 *
1010 * Subclasses should avoid throwing exceptions at all costs.
 11+ *
 12+ * @ingroup FileBackend
1113 */
1214 abstract class LockManager {
1315 /* Lock types; stronger locks have high values */
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackendGroup.php
@@ -1,14 +1,12 @@
22 <?php
33 /**
44 * @file
5 - * @ingroup FileRepo
65 * @ingroup FileBackend
76 */
87
98 /**
109 * Class to handle file backend registration
1110 *
12 - * @ingroup FileRepo
1311 * @ingroup FileBackend
1412 */
1513 class FileBackendGroup {
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php
@@ -1,7 +1,6 @@
22 <?php
33 /**
44 * @file
5 - * @ingroup FileRepo
65 * @ingroup FileBackend
76 */
87
@@ -18,7 +17,6 @@
1918 * Methods should avoid throwing exceptions at all costs.
2019 * As a corollary, external dependencies should be kept to a minimum.
2120 *
22 - * @ingroup FileRepo
2321 * @ingroup FileBackend
2422 */
2523 abstract class FileBackendBase {
@@ -246,7 +244,6 @@
247245 * Base class for all single-write backends.
248246 * This class defines the methods as abstract that subclasses must implement.
249247 *
250 - * @ingroup FileRepo
251248 * @ingroup FileBackend
252249 */
253250 abstract class FileBackend extends FileBackendBase {
@@ -307,7 +304,7 @@
308305 * Combines files from severals storage paths into a new file in the backend.
309306 * Do not call this function from places outside FileBackend and FileOp.
310307 * $params include:
311 - * sources : ordered source storage paths (e.g. chunk1, chunk2, ...)
 308+ * srcs : ordered source storage paths (e.g. chunk1, chunk2, ...)
312309 * dst : destination storage path
313310 * overwriteDest : do nothing and pass if an identical file exists at destination
314311 *
@@ -570,7 +567,7 @@
571568 if (
572569 $path === '.' ||
573570 $path === '..' ||
574 - strpos( $path, './' ) === 0 ||
 571+ strpos( $path, './' ) === 0 ||
575572 strpos( $path, '../' ) === 0 ||
576573 strpos( $path, '/./' ) !== false ||
577574 strpos( $path, '/../' ) !== false
Index: branches/FileBackend/phase3/includes/filerepo/FileRepo.php
@@ -797,7 +797,7 @@
798798
799799 // Concatenate the chunks into one file
800800 $op = array( 'op' => 'concatenate',
801 - 'sources' => $sources, 'dst' => $dest, 'overwriteDest' => true );
 801+ 'srcs' => $sources, 'dst' => $dest, 'overwriteDest' => true );
802802 $status->merge( $this->backend->doOperation( $op ) );
803803 if ( !$status->isOK() ) {
804804 return $status;
Index: branches/FileBackend/phase3/img_auth.php
@@ -91,7 +91,6 @@
9292 }
9393
9494 // Check to see if the file exists
95 - var_dump($filename);
9695 if ( !$repo->fileExists( $filename, FileRepo::FILES_ONLY ) ) {
9796 wfForbidden( 'img-auth-accessdenied','img-auth-nofile', $filename );
9897 return;

Status & tagging log