Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into report_and_dimensio…
Browse files Browse the repository at this point in the history
…n_refactoring

Conflicts:
	core/Tracker/Settings.php
	core/Tracker/Visit.php
	plugins/Actions/Widgets.php
	plugins/CustomVariables/Widgets.php
	plugins/DevicesDetection/DevicesDetection.php
	plugins/DevicesDetection/Widgets.php
	plugins/Events/Widgets.php
	plugins/Provider/Widgets.php
	plugins/UserCountry/Widgets.php
	plugins/UserSettings/Widgets.php
	plugins/VisitTime/Widgets.php
	plugins/VisitorInterest/Widgets.php
  • Loading branch information
tsteur committed Jun 18, 2014
2 parents 031a2de + 02ffeeb commit 69b4a70
Show file tree
Hide file tree
Showing 122 changed files with 1,054 additions and 439 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"symfony/console": ">=v2.3.5",
"tedivm/jshrink": "v0.5.1",
"mustangostang/spyc": "0.5.*",
"piwik/device-detector": "1.0"
"piwik/device-detector": "2.*"
},
"require-dev": {
"phpunit/phpunit": "4.*"
Expand Down
77 changes: 41 additions & 36 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 9 additions & 48 deletions core/CliMulti.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
namespace Piwik;

use Piwik\CliMulti\CliPhp;
use Piwik\CliMulti\Output;
use Piwik\CliMulti\Process;

Expand Down Expand Up @@ -157,11 +158,17 @@ private function generateCommandId($command)
* What is missing under windows? Detection whether a process is still running in Process::isProcessStillRunning
* and how to send a process into background in start()
*/
private function supportsAsync()
public function supportsAsync()
{
return Process::isSupported() && $this->findPhpBinary();
}

private function findPhpBinary()
{
$cliPhp = new CliPhp();
return $cliPhp->findPhpBinary();
}

private function cleanup()
{
foreach ($this->processes as $pid) {
Expand Down Expand Up @@ -204,36 +211,6 @@ public static function getTmpPath()
return SettingsPiwik::rewriteTmpPathWithInstanceId($dir);
}

private function findPhpBinary()
{
if (defined('PHP_BINARY') && $this->isValidPhpType(PHP_BINARY)) {
return PHP_BINARY;
}

$bin = '';

if (!empty($_SERVER['_']) && Common::isPhpCliMode()) {
$bin = $this->getPhpCommandIfValid($_SERVER['_']);
}

if (empty($bin) && !empty($_SERVER['argv'][0]) && Common::isPhpCliMode()) {
$bin = $this->getPhpCommandIfValid($_SERVER['argv'][0]);
}

if (!$this->isValidPhpType($bin)) {
$bin = shell_exec('which php');
}

if (!$this->isValidPhpType($bin)) {
$bin = shell_exec('which php5');
}

if ($this->isValidPhpType($bin)) {
return trim($bin);
}

return false;
}

private function executeAsyncCli($url, Output $output, $cmdId)
{
Expand Down Expand Up @@ -280,23 +257,6 @@ private function appendTestmodeParamToUrlIfNeeded($url)
return $url;
}

private function isValidPhpType($path)
{
return !empty($path)
&& false === strpos($path, 'fpm')
&& false === strpos($path, 'cgi')
&& false === strpos($path, 'phpunit');
}

private function getPhpCommandIfValid($path)
{
if (!empty($path) && is_executable($path)) {
if (0 === strpos($path, PHP_BINDIR) && $this->isValidPhpType($path)) {
return $path;
}
}
}

/**
* @param array $piwikUrls
* @return array
Expand All @@ -316,4 +276,5 @@ private function requestUrls(array $piwikUrls)

return $results;
}

}
Loading

0 comments on commit 69b4a70

Please sign in to comment.