diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index 26949c560a2d5c59b22caf72fbee613067b782a9..23780a0701566ec100b3593724147a4e15b31991 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -336,6 +336,17 @@ class SettingsPiwik } } + /** + * Returns true if Piwik is deployed using git + * FAQ: http://piwik.org/faq/how-to-install/faq_18271/ + * + * @return bool + */ + public static function isGitDeployment() + { + return file_exists(PIWIK_INCLUDE_PATH . '/.git/HEAD'); + } + public static function getCurrentGitBranch() { $file = PIWIK_INCLUDE_PATH . '/.git/HEAD'; @@ -422,4 +433,5 @@ class SettingsPiwik { return Config::getInstance()->General['force_ssl'] == 1; } + } diff --git a/plugins/CoreConsole/Commands/GitPull.php b/plugins/CoreConsole/Commands/GitPull.php index 65151e2e3c810f6a49cc237e2a8acc289ed8ca99..e69c13bf10416e9fcb98f0b2771bad8d4025c5b0 100644 --- a/plugins/CoreConsole/Commands/GitPull.php +++ b/plugins/CoreConsole/Commands/GitPull.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\CoreConsole\Commands; use Piwik\Development; use Piwik\Plugin\ConsoleCommand; +use Piwik\SettingsPiwik; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -20,7 +21,7 @@ class GitPull extends ConsoleCommand { public function isEnabled() { - return Development::isEnabled(); + return SettingsPiwik::isGitDeployment(); } protected function configure() diff --git a/plugins/TestRunner/Commands/TestsRunOnAws.php b/plugins/TestRunner/Commands/TestsRunOnAws.php index 3e99e05a6b368cf02687b3478e27f80f2219f9ae..495ecfa4612c4916fa98a898f1deba70dc5e2842 100644 --- a/plugins/TestRunner/Commands/TestsRunOnAws.php +++ b/plugins/TestRunner/Commands/TestsRunOnAws.php @@ -16,6 +16,7 @@ use Piwik\Plugins\TestRunner\Aws\Instance; use Piwik\Plugins\TestRunner\Aws\Ssh; use Piwik\Plugins\TestRunner\Runner\InstanceLauncher; use Piwik\Plugins\TestRunner\Runner\Remote; +use Piwik\SettingsPiwik; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -143,7 +144,7 @@ This feature is still beta and there might be problems with pictures and/or bina private function getCurrentGitHash() { // we should not use 'git' executable unless we are in a git clone - if(!file_exists(PIWIK_INCLUDE_PATH . '/.git/')) { + if(!SettingsPiwik::isGitDeployment()) { return 'WARN: it does not look like a Piwik repository clone - you must setup Piwik from git to proceed'; } return trim(`git rev-parse HEAD`);