print is not a function
[lhc/web/wiklou.git] / includes / filebackend / FileBackendMultiWrite.php
index a5f5073..17b060c 100644 (file)
@@ -204,7 +204,7 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * Check that a set of files are consistent across all internal backends
         *
-        * @param $paths Array List of storage paths
+        * @param array $paths List of storage paths
         * @return Status
         */
        public function consistencyCheck( array $paths ) {
@@ -270,7 +270,7 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * Check that a set of file paths are usable across all internal backends
         *
-        * @param $paths Array List of storage paths
+        * @param array $paths List of storage paths
         * @return Status
         */
        public function accessibilityCheck( array $paths ) {
@@ -295,7 +295,7 @@ class FileBackendMultiWrite extends FileBackend {
         * Check that a set of files are consistent across all internal backends
         * and re-synchronize those files againt the "multi master" if needed.
         *
-        * @param $paths Array List of storage paths
+        * @param array $paths List of storage paths
         * @return Status
         */
        public function resyncFiles( array $paths ) {
@@ -303,8 +303,8 @@ class FileBackendMultiWrite extends FileBackend {
 
                $mBackend = $this->backends[$this->masterIndex];
                foreach ( $paths as $path ) {
-                       $mPath  = $this->substPaths( $path, $mBackend );
-                       $mSha1  = $mBackend->getFileSha1Base36( array( 'src' => $mPath ) );
+                       $mPath = $this->substPaths( $path, $mBackend );
+                       $mSha1 = $mBackend->getFileSha1Base36( array( 'src' => $mPath ) );
                        $mExist = $mBackend->fileExists( array( 'src' => $mPath ) );
                        // Check if the master backend is available...
                        if ( $mExist === null ) {
@@ -336,14 +336,20 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * Get a list of file storage paths to read or write for a list of operations
         *
-        * @param $ops Array Same format as doOperations()
+        * @param array $ops Same format as doOperations()
         * @return Array List of storage paths to files (does not include directories)
         */
        protected function fileStoragePathsForOps( array $ops ) {
                $paths = array();
                foreach ( $ops as $op ) {
                        if ( isset( $op['src'] ) ) {
-                               $paths[] = $op['src'];
+                               // For things like copy/move/delete with "ignoreMissingSource" and there
+                               // is no source file, nothing should happen and there should be no errors.
+                               if ( empty( $op['ignoreMissingSource'] )
+                                       || $this->fileExists( array( 'src' => $op['src'] ) ) )
+                               {
+                                       $paths[] = $op['src'];
+                               }
                        }
                        if ( isset( $op['srcs'] ) ) {
                                $paths = array_merge( $paths, $op['srcs'] );
@@ -359,7 +365,7 @@ class FileBackendMultiWrite extends FileBackend {
         * Substitute the backend name in storage path parameters
         * for a set of operations with that of a given internal backend.
         *
-        * @param $ops Array List of file operation arrays
+        * @param array $ops List of file operation arrays
         * @param $backend FileBackendStore
         * @return Array
         */
@@ -380,7 +386,7 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * Same as substOpBatchPaths() but for a single operation
         *
-        * @param $ops array File operation array
+        * @param array $ops File operation array
         * @param $backend FileBackendStore
         * @return Array
         */
@@ -392,7 +398,7 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * Substitute the backend of storage paths with an internal backend's name
         *
-        * @param $paths Array|string List of paths or single string path
+        * @param array|string $paths List of paths or single string path
         * @param $backend FileBackendStore
         * @return Array|string
         */
@@ -407,7 +413,7 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * Substitute the backend of internal storage paths with the proxy backend's name
         *
-        * @param $paths Array|string List of paths or single string path
+        * @param array|string $paths List of paths or single string path
         * @return Array|string
         */
        protected function unsubstPaths( $paths ) {
@@ -447,11 +453,11 @@ class FileBackendMultiWrite extends FileBackend {
        }
 
        /**
-        * @param $path string Storage path
+        * @param string $path Storage path
         * @return bool Path container should have dir changes pushed to all backends
         */
        protected function replicateContainerDirChanges( $path ) {
-               list( $b, $shortCont, $r ) = self::splitStoragePath( $path );
+               list( , $shortCont, ) = self::splitStoragePath( $path );
                return !in_array( $shortCont, $this->noPushDirConts );
        }