Localisation updates from https://translatewiki.net.
[lhc/web/wiklou.git] / includes / filebackend / FileBackendMultiWrite.php
index 2d27450..6f40bda 100644 (file)
@@ -199,14 +199,20 @@ class FileBackendMultiWrite extends FileBackend {
                                }
 
                                $realOps = $this->substOpBatchPaths( $ops, $backend );
-                               if ( $this->asyncWrites && !$this->hasStoreOperation( $ops ) ) {
+                               if ( $this->asyncWrites && !$this->hasVolatileSources( $ops ) ) {
                                        // Bind $scopeLock to the callback to preserve locks
                                        DeferredUpdates::addCallableUpdate(
-                                               function() use ( $backend, $realOps, $opts, $scopeLock ) {
+                                               function() use ( $backend, $realOps, $opts, $scopeLock, $relevantPaths ) {
+                                                       wfDebugLog( 'FileOperationReplication',
+                                                               "'{$backend->getName()}' async replication; paths: " .
+                                                               FormatJson::encode( $relevantPaths ) );
                                                        $backend->doOperations( $realOps, $opts );
                                                }
                                        );
                                } else {
+                                       wfDebugLog( 'FileOperationReplication',
+                                               "'{$backend->getName()}' sync replication; paths: " .
+                                               FormatJson::encode( $relevantPaths ) );
                                        $status->merge( $backend->doOperations( $realOps, $opts ) );
                                }
                        }
@@ -468,13 +474,13 @@ class FileBackendMultiWrite extends FileBackend {
        }
 
        /**
-        * @param array $ops File operation batch map
-        * @return bool
+        * @param array $ops File operations for FileBackend::doOperations()
+        * @return bool Whether there are file path sources with outside lifetime/ownership
         */
-       protected function hasStoreOperation( array $ops ) {
+       protected function hasVolatileSources( array $ops ) {
                foreach ( $ops as $op ) {
-                       if ( $op['op'] === 'store' ) {
-                               return true;
+                       if ( $op['op'] === 'store' && !isset( $op['srcRef'] ) ) {
+                               return true; // source file might be deleted anytime after do*Operations()
                        }
                }
 
@@ -494,7 +500,7 @@ class FileBackendMultiWrite extends FileBackend {
                        }
 
                        $realOps = $this->substOpBatchPaths( $ops, $backend );
-                       if ( $this->asyncWrites && !$this->hasStoreOperation( $ops ) ) {
+                       if ( $this->asyncWrites && !$this->hasVolatileSources( $ops ) ) {
                                DeferredUpdates::addCallableUpdate(
                                        function() use ( $backend, $realOps ) {
                                                $backend->doQuickOperations( $realOps );