diff options
author | Zoltan Flamis <flamisz@gmail.com> | 2021-03-17 23:12:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 23:12:22 +0300 |
commit | 7527bce11d1b3f9a5ace08eb26e5379f7702cf7c (patch) | |
tree | 9dfe39298ec62e5a34103eb88c069c18c69941ed /plugins/CoreConsole | |
parent | 4778bc5c065c7bb325b14f7dbcc6b097d7a4097f (diff) |
Development mode notifications when Matomo not installed through git (#17300)
* not git installed exception for generate commands
* notify superadmin about development mode
* throw error in initalize method
* add guide url to the exception message
* modify exception message
* add development mode check
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r-- | plugins/CoreConsole/Commands/DevelopmentEnable.php | 6 | ||||
-rw-r--r-- | plugins/CoreConsole/Commands/GenerateAngularComponent.php | 2 | ||||
-rw-r--r-- | plugins/CoreConsole/Commands/GeneratePluginBase.php | 14 |
3 files changed, 21 insertions, 1 deletions
diff --git a/plugins/CoreConsole/Commands/DevelopmentEnable.php b/plugins/CoreConsole/Commands/DevelopmentEnable.php index 192f4889f4..ec1df4735c 100644 --- a/plugins/CoreConsole/Commands/DevelopmentEnable.php +++ b/plugins/CoreConsole/Commands/DevelopmentEnable.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\CoreConsole\Commands; use Piwik\Config; use Piwik\Filesystem; +use Piwik\SettingsPiwik; use Piwik\Plugin\ConsoleCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -51,6 +52,11 @@ class DevelopmentEnable extends ConsoleCommand Filesystem::deleteAllCacheOnUpdate(); $this->writeSuccessMessage($output, array($message)); + + if ($enable && !SettingsPiwik::isGitDeployment()) { + $comment = 'Development mode should be only enabled when installed through git. Not every development feature will be available.'; + $this->writeComment($output, [$comment]); + } } } diff --git a/plugins/CoreConsole/Commands/GenerateAngularComponent.php b/plugins/CoreConsole/Commands/GenerateAngularComponent.php index 46a7be1737..55311d10cc 100644 --- a/plugins/CoreConsole/Commands/GenerateAngularComponent.php +++ b/plugins/CoreConsole/Commands/GenerateAngularComponent.php @@ -72,4 +72,4 @@ class GenerateAngularComponent extends GenerateAngularConstructBase 'If you are not familiar with this have a look at <comment>https://developer.matomo.org/guides/working-with-piwiks-ui</comment>' )); } -}
\ No newline at end of file +} diff --git a/plugins/CoreConsole/Commands/GeneratePluginBase.php b/plugins/CoreConsole/Commands/GeneratePluginBase.php index bc86e67a79..345518f8cd 100644 --- a/plugins/CoreConsole/Commands/GeneratePluginBase.php +++ b/plugins/CoreConsole/Commands/GeneratePluginBase.php @@ -18,9 +18,16 @@ use Piwik\Plugin\Manager; use Piwik\Version; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Piwik\SettingsPiwik; +use Piwik\Exception\NotGitInstalledException; abstract class GeneratePluginBase extends ConsoleCommand { + protected function initialize(InputInterface $input, OutputInterface $output) + { + $this->throwErrorIfNotGitInstalled(); + } + public function isEnabled() { return Development::isEnabled(); @@ -397,4 +404,11 @@ abstract class GeneratePluginBase extends ConsoleCommand return $contentToReplace; } + protected function throwErrorIfNotGitInstalled() + { + if (!SettingsPiwik::isGitDeployment()) { + $url = 'https://developer.matomo.org/guides/getting-started-part-1'; + throw new NotGitInstalledException("This development feature requires Matomo to be checked out from git. For more information please visit {$url}."); + } + } } |