Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-02-10 23:58:19 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-02-10 23:58:19 +0400
commit65d4083f66fef87ac14d27de39ccd3d3e0334cef (patch)
tree675f9ab9b0e088d984a337d08fa9e2cd1232dd3c /core/CliMulti.php
parent19385b007ea14a6e4a5d8ba4b53cf12cd150ccc9 (diff)
refs #4610 simplified the fallback if async is not supported, tests and fixes for output class
Diffstat (limited to 'core/CliMulti.php')
-rw-r--r--core/CliMulti.php32
1 files changed, 7 insertions, 25 deletions
diff --git a/core/CliMulti.php b/core/CliMulti.php
index 9c5093229a..3a1eb08eea 100644
--- a/core/CliMulti.php
+++ b/core/CliMulti.php
@@ -23,10 +23,6 @@ class CliMulti {
public function request($piwikUrls)
{
- if (!$this->supportsAsync() || 1 == count($piwikUrls)) {
- return $this->requestNonAsyncFallback($piwikUrls);
- }
-
$this->start($piwikUrls);
while (!$this->isFinished()) {
@@ -46,9 +42,11 @@ class CliMulti {
$pid = $cmdId . $index . '_cli_multi_pid';
$output = $cmdId . $index . '_cli_multi_output';
- $additionalParams = array('output' => $output, 'pid' => $pid);
+ $params = array('output' => $output, 'pid' => $pid);
+ $command = $this->buildCommand($url, $params);
+ $appendix = $this->supportsAsync() ? ' &' : '';
- shell_exec($this->buildCommand($url, $additionalParams) . '&');
+ shell_exec($command . $appendix);
$this->pids[] = new Lock($pid);
$this->outputs[] = new Output($output);
@@ -64,7 +62,7 @@ class CliMulti {
$query .= '&' . http_build_query($additionalParams);
}
- $command = 'php ' . PIWIK_INCLUDE_PATH . '/core/wrapper.php -- ' . escapeshellarg($query);
+ $command = 'php ' . PIWIK_INCLUDE_PATH . '/core/CliMulti/run.php -- ' . escapeshellarg($query);
return $command;
}
@@ -74,13 +72,8 @@ class CliMulti {
$response = array();
foreach ($this->outputs as $index => $output) {
- $url = $urls[$index];
-
- if ($output->exists()) {
- $response[$url] = $output->get();
- } else {
- $response[$url] = null;
- }
+ $url = $urls[$index];
+ $response[$url] = $output->get();
}
return $response;
@@ -118,15 +111,4 @@ class CliMulti {
}
}
- private function requestNonAsyncFallback($piwikUrls)
- {
- $response = array();
-
- foreach ($piwikUrls as $piwikUrl) {
- $response[$piwikUrl] = shell_exec($this->buildCommand($piwikUrl));
- }
-
- return $response;
- }
-
}