Merge "Truncate SHA-1 indexes"
[lhc/web/wiklou.git] / includes / filebackend / FileBackendStore.php
index 5771560..5823326 100644 (file)
@@ -292,8 +292,14 @@ abstract class FileBackendStore extends FileBackend {
                // Try to lock the source files for the scope of this function
                $scopeLockS = $this->getScopedFileLocks( $params['srcs'], LockManager::LOCK_UW, $status );
                if ( $status->isOK() ) {
-                       // Actually do the concatenation
+                       // Actually do the file concatenation...
+                       $start_time = microtime( true );
                        $status->merge( $this->doConcatenate( $params ) );
+                       $sec = microtime( true ) - $start_time;
+                       if ( !$status->isOK() ) {
+                               wfDebugLog( 'FileOperation', get_class( $this ) . " failed to concatenate " .
+                                       count( $params['srcs'] ) . " file(s) [$sec sec]" );
+                       }
                }
 
                wfProfileOut( __METHOD__ . '-' . $this->name );
@@ -1010,6 +1016,7 @@ abstract class FileBackendStore extends FileBackend {
                $this->primeContainerCache( $performOps );
 
                // Actually attempt the operation batch...
+               $opts = $this->setConcurrencyFlags( $opts );
                $subStatus = FileOpBatch::attempt( $performOps, $opts, $this->fileJournal );
 
                // Merge errors into status fields
@@ -1540,6 +1547,26 @@ abstract class FileBackendStore extends FileBackend {
                wfProfileOut( __METHOD__ . '-' . $this->name );
                wfProfileOut( __METHOD__ );
        }
+
+       /**
+        * Set the 'concurrency' option from a list of operation options
+        *
+        * @param $opts array Map of operation options
+        * @return Array
+        */
+       final protected function setConcurrencyFlags( array $opts ) {
+               $opts['concurrency'] = 1; // off
+               if ( $this->parallelize === 'implicit' ) {
+                       if ( !isset( $opts['parallelize'] ) || $opts['parallelize'] ) {
+                               $opts['concurrency'] = $this->concurrency;
+                       }
+               } elseif ( $this->parallelize === 'explicit' ) {
+                       if ( !empty( $opts['parallelize'] ) ) {
+                               $opts['concurrency'] = $this->concurrency;
+                       }
+               }
+               return $opts;
+       }
 }
 
 /**