From: Aaron Schulz Date: Wed, 18 Jun 2014 17:18:49 +0000 (-0700) Subject: filebackend: Avoid using popen() when "parallelize" is disabled X-Git-Tag: 1.31.0-rc.0~15333^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=0fa9a391e3ca2e0b2b8f891406f0c884d48c30d0;p=lhc%2Fweb%2Fwiklou.git filebackend: Avoid using popen() when "parallelize" is disabled Bug: 66467 Change-Id: Iaf8eb2ecfad166e26e265a98933399dc4bc255a3 --- diff --git a/includes/filebackend/FileBackendStore.php b/includes/filebackend/FileBackendStore.php index 340c3153da..ee9a49d382 100644 --- a/includes/filebackend/FileBackendStore.php +++ b/includes/filebackend/FileBackendStore.php @@ -1147,6 +1147,7 @@ abstract class FileBackendStore extends FileBackend { $this->clearCache(); $supportedOps = array( 'create', 'store', 'copy', 'move', 'delete', 'describe', 'null' ); + // Parallel ops may be disabled in config due to dependencies (e.g. needing popen()) $async = ( $this->parallelize === 'implicit' && count( $ops ) > 1 ); $maxConcurrency = $this->concurrency; // throttle diff --git a/includes/filebackend/FileOpBatch.php b/includes/filebackend/FileOpBatch.php index 56d7000982..b0d83e01db 100644 --- a/includes/filebackend/FileOpBatch.php +++ b/includes/filebackend/FileOpBatch.php @@ -167,7 +167,11 @@ class FileOpBatch { // or the backend does not support async ops and did it synchronously. foreach ( $performOpsBatch as $i => $fileOp ) { if ( !isset( $status->success[$i] ) ) { // didn't already fail in precheck() - $subStatus = $fileOp->attemptAsync(); + // Parallel ops may be disabled in config due to missing dependencies, + // (e.g. needing popen()). When they are, $performOpsBatch has size 1. + $subStatus = ( count( $performOpsBatch ) > 1 ) + ? $fileOp->attemptAsync() + : $fileOp->attempt(); if ( $subStatus->value instanceof FileBackendStoreOpHandle ) { $opHandles[$i] = $subStatus->value; // deferred } else {