diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-10 06:33:52 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-10 06:33:52 +0400 |
commit | fca3bf825184cf0ddc3b9edcac0d90c95802afbf (patch) | |
tree | 0ba6e71cb6c97b7ab40aa9176c59e2cdfe06a676 /core/Console.php | |
parent | 0dc6a6cb8d12d95f172b754405929e5db439d551 (diff) |
starting to move dimensions from core into plugins and put each dimension into its own class. This is very experimental right now. More experimental stuff will follow
Diffstat (limited to 'core/Console.php')
-rw-r--r-- | core/Console.php | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/core/Console.php b/core/Console.php index 7cf657e683..097da68b45 100644 --- a/core/Console.php +++ b/core/Console.php @@ -72,11 +72,9 @@ class Console extends Application private function getAvailableCommands() { $commands = $this->getDefaultPiwikCommands(); + $detected = PluginManager::getInstance()->findMultipleComponents('Commands', 'Piwik\\Plugin\\ConsoleCommand'); - $pluginNames = PluginManager::getInstance()->getLoadedPluginsName(); - foreach ($pluginNames as $pluginName) { - $commands = array_merge($commands, $this->findCommandsInPlugin($pluginName)); - } + $commands = array_merge($commands, $detected); /** * Triggered to filter / restrict console commands. Plugins that want to restrict commands @@ -101,31 +99,6 @@ class Console extends Application return $commands; } - private function findCommandsInPlugin($pluginName) - { - $commands = array(); - - $files = Filesystem::globr(PIWIK_INCLUDE_PATH . '/plugins/' . $pluginName .'/Commands', '*.php'); - - foreach ($files as $file) { - $klassName = sprintf('Piwik\\Plugins\\%s\\Commands\\%s', $pluginName, basename($file, '.php')); - - if (!class_exists($klassName) || !is_subclass_of($klassName, 'Piwik\\Plugin\\ConsoleCommand')) { - continue; - } - - $klass = new \ReflectionClass($klassName); - - if ($klass->isAbstract()) { - continue; - } - - $commands[] = $klassName; - } - - return $commands; - } - private function checkCompatibility() { if (Common::isPhpCgiType()) { |