diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2013-11-11 05:04:49 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2013-11-11 05:04:49 +0400 |
commit | 8345d49f8f1328b8e9a31240c46a201814f9c949 (patch) | |
tree | 8bd34c80494dd99721927e5972542e6fe1e279c1 /core/Console.php | |
parent | f72fff5eab5bfef07ac21d471114444ef79b08d6 (diff) |
make sure the command extends the correct command
Diffstat (limited to 'core/Console.php')
-rw-r--r-- | core/Console.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/core/Console.php b/core/Console.php index f938c8826a..15ecbc18bc 100644 --- a/core/Console.php +++ b/core/Console.php @@ -20,10 +20,18 @@ class Console $commands = $this->getAvailableCommands(); foreach ($commands as $command) { - if (class_exists($command)) { - $console->add(new $command); + + if (!class_exists($command)) { + + Log::warning(sprintf('Cannot add command %s, class does not exist', $command)); + + } elseif (!is_subclass_of($command, 'Piwik\Plugin\ConsoleCommand')) { + + Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\Plugin\ConsoleCommand', $command)); + } else { - Log::warning(sprintf('Cannot add command %s, class does not exist.', $command)); + + $console->add(new $command); } } |