[FileBackend] Skip over some illegal paths and output the error.
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 28 Jul 2012 17:38:25 +0000 (10:38 -0700)
committerAaron <aschulz@wikimedia.org>
Wed, 1 Aug 2012 23:48:33 +0000 (16:48 -0700)
Change-Id: Ib32aadc6398168e4a63279d7da61a0dd1e1a6483

maintenance/copyFileBackend.php

index 498bc6b..70a9232 100644 (file)
@@ -140,6 +140,12 @@ class CopyFileBackend extends Maintenance {
                        $fsFile = $src->getLocalReference( array( 'src' => $srcPath, 'latest' => 1 ) );
                        if ( !$fsFile ) {
                                $this->error( "Could not get local copy of $srcPath.", 1 ); // die
+                       } elseif ( !$fsFile->exists() ) {
+                               // FSFileBackends just return the path for getLocalReference() and paths with
+                               // illegal slashes may get normalized to a different path. This can cause the
+                               // local reference to not exist...skip these broken files.
+                               $this->error( "Detected possible illegal path for $srcPath." );
+                               continue;
                        }
                        $fsFiles[] = $fsFile; // keep TempFSFile objects alive as needed
                        // Note: prepare() is usually fast for key/value backends