Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php |
— | — | @@ -7,16 +7,19 @@ |
8 | 8 | /** |
9 | 9 | * Base class for all file backend classes (including multi-write backends). |
10 | 10 | * This class defines the methods as abstract that subclasses must implement. |
11 | | - * |
12 | 11 | * Outside callers can assume that all backends will have these functions. |
13 | 12 | * |
14 | 13 | * All "storage paths" are of the format "mwstore://backend/container/path". |
15 | 14 | * The paths use typical file system (FS) notation, though any particular backend may |
16 | 15 | * not actually be using a local filesystem. Therefore, the paths are only virtual. |
17 | | - * |
| 16 | + * |
| 17 | + * FS-based backends are somewhat more restrictive due to the existence of real |
| 18 | + * directory files; a regular file cannot have the same name as a directory. Other |
| 19 | + * backends with virtual directories may not have this limitation. |
| 20 | + * |
18 | 21 | * Methods should avoid throwing exceptions at all costs. |
19 | 22 | * As a corollary, external dependencies should be kept to a minimum. |
20 | | - * |
| 23 | + * |
21 | 24 | * @ingroup FileBackend |
22 | 25 | */ |
23 | 26 | abstract class FileBackendBase { |
— | — | @@ -258,7 +261,7 @@ |
259 | 262 | * Results should be storage paths relative to the given directory. |
260 | 263 | * |
261 | 264 | * $params include: |
262 | | - * dir : storage path directory. |
| 265 | + * dir : storage path directory |
263 | 266 | * |
264 | 267 | * @return Iterator|Array |
265 | 268 | */ |
— | — | @@ -301,7 +304,7 @@ |
302 | 305 | * Lock the files at the given storage paths in the backend. |
303 | 306 | * This will either lock all the files or none (on failure). |
304 | 307 | * |
305 | | - * Avoid using this function outside of FileBackendScopedLock. |
| 308 | + * Callers should consider using getScopedFileLocks() instead. |
306 | 309 | * |
307 | 310 | * @param $paths Array Storage paths |
308 | 311 | * @param $type integer LockManager::LOCK_EX, LockManager::LOCK_SH |
— | — | @@ -314,8 +317,6 @@ |
315 | 318 | /** |
316 | 319 | * Unlock the files at the given storage paths in the backend. |
317 | 320 | * |
318 | | - * Avoid using this function outside of FileBackendScopedLock. |
319 | | - * |
320 | 321 | * @param $paths Array Storage paths |
321 | 322 | * @param $type integer LockManager::LOCK_EX, LockManager::LOCK_SH |
322 | 323 | * @return Status |
— | — | @@ -335,7 +336,7 @@ |
336 | 337 | * @param $paths Array Storage paths |
337 | 338 | * @param $type integer LockManager::LOCK_EX, LockManager::LOCK_SH |
338 | 339 | * @param $status Status Status to update on lock/unlock |
339 | | - * @return FileBackendScopedLock|null Returns null on failure |
| 340 | + * @return ScopedLock|null Returns null on failure |
340 | 341 | */ |
341 | 342 | final public function getScopedFileLocks( array $paths, $type, Status $status ) { |
342 | 343 | return ScopedLock::factory( $this->lockManager, $paths, $type, $status ); |
— | — | @@ -658,13 +659,15 @@ |
659 | 660 | list( $backend, $container, $relPath ) = self::splitStoragePath( $storagePath ); |
660 | 661 | if ( $backend === $this->name ) { // must be for this backend |
661 | 662 | $relPath = self::normalizeStoragePath( $relPath ); |
662 | | - if ( $relPath !== null && self::isValidContainerName( $container ) ) { |
| 663 | + if ( $relPath !== null ) { |
663 | 664 | $relPath = $this->resolveContainerPath( $container, $relPath ); |
664 | 665 | if ( $relPath !== null ) { |
665 | 666 | $container = $this->fullContainerName( $container ); |
666 | | - $container = $this->resolveContainerName( $container ); |
667 | | - if ( $container !== null ) { |
668 | | - return array( $container, $relPath ); // (container, path) |
| 667 | + if ( self::isValidContainerName( $container ) ) { |
| 668 | + $container = $this->resolveContainerName( $container ); |
| 669 | + if ( $container !== null ) { |
| 670 | + return array( $container, $relPath ); |
| 671 | + } |
669 | 672 | } |
670 | 673 | } |
671 | 674 | } |
Index: branches/FileBackend/phase3/includes/AutoLoader.php |
— | — | @@ -497,6 +497,7 @@ |
498 | 498 | 'FSFileIterator' => 'includes/filerepo/backend/FSFileBackend.php', |
499 | 499 | 'LockManagerGroup' => 'includes/filerepo/backend/LockManagerGroup.php', |
500 | 500 | 'LockManager' => 'includes/filerepo/backend/LockManager.php', |
| 501 | + 'ScopedLock' => 'includes/filerepo/backend/LockManager.php', |
501 | 502 | 'FSLockManager' => 'includes/filerepo/backend/LockManager.php', |
502 | 503 | 'DBLockManager' => 'includes/filerepo/backend/LockManager.php', |
503 | 504 | 'MySqlLockManager'=> 'includes/filerepo/backend/LockManager.php', |