r103957 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103956‎ | r103957 | r103958 >
Date:21:14, 22 November 2011
Author:aaron
Status:deferred
Tags:
Comment:
Changed backend path format to include the backend name
Modified paths:
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)

Diff [purge]

Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php
@@ -8,7 +8,7 @@
99 * Base class for all file backend classes (including multi-write backends).
1010 * This class defines the methods as abstract that must be implemented subclasses.
1111 *
12 - * All "storage paths" are of the format "mwstore://container/path".
 12+ * All "storage paths" are of the format "mwstore://backend/container/path".
1313 * The paths use typical file system notation, though any particular backend may
1414 * not actually be using a local filesystem. Therefore, the paths are only virtual.
1515 *
@@ -362,12 +362,14 @@
363363 */
364364 final protected function resolveVirtualPath( $storagePath ) {
365365 if ( strpos( $storagePath, 'mwstore://' ) === 0 ) {
366 - $m = explode( '/', substr( $storagePath, 10 ), 2 );
367 - if ( count( $m ) == 2 ) {
368 - list( $container, $relPath ) = $m;
369 - $relPath = $this->resolveContainerPath( $container, $relPath );
370 - if ( $relPath !== null ) {
371 - return array( $container, $relPath ); // (container, path)
 366+ $m = explode( '/', substr( $storagePath, 10 ), 3 );
 367+ if ( count( $m ) == 3 ) {
 368+ list( $backend, $container, $relPath ) = $m;
 369+ if ( $backend === $this->name ) { // sanity
 370+ $relPath = $this->resolveContainerPath( $container, $relPath );
 371+ if ( $relPath !== null ) {
 372+ return array( $container, $relPath ); // (container, path)
 373+ }
372374 }
373375 }
374376 }

Status & tagging log