mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-09-13 12:40:18 +02:00
parent
825fc64b0a
commit
de51ce2b04
@ -31,6 +31,11 @@ class Autoload
|
|||||||
if (strpos($className, 'Task\\') === 0) {
|
if (strpos($className, 'Task\\') === 0) {
|
||||||
$baseDir = getcwd() . '/.mage/tasks';
|
$baseDir = getcwd() . '/.mage/tasks';
|
||||||
$postfix = substr($postfix, 5);
|
$postfix = substr($postfix, 5);
|
||||||
|
|
||||||
|
} else if (strpos($className, 'Command\\') === 0) {
|
||||||
|
$baseDir = getcwd() . '/.mage/commands';
|
||||||
|
$postfix = substr($postfix, 8);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$baseDir = dirname(dirname(__FILE__));
|
$baseDir = dirname(dirname(__FILE__));
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
namespace Mage\Command;
|
namespace Mage\Command;
|
||||||
|
|
||||||
|
use Mage\Command\AbstractCommand;
|
||||||
use Mage\Config;
|
use Mage\Config;
|
||||||
use Mage\Autoload;
|
use Mage\Autoload;
|
||||||
|
|
||||||
@ -40,12 +41,17 @@ class Factory
|
|||||||
$className = 'Mage\\Command\\BuiltIn\\' . $commandName . 'Command';
|
$className = 'Mage\\Command\\BuiltIn\\' . $commandName . 'Command';
|
||||||
|
|
||||||
if (!class_exists($className)) {
|
if (!class_exists($className)) {
|
||||||
throw new Exception('Command "' . $commandName . '" not found.');
|
// try a custom command
|
||||||
|
$className = 'Command\\' . $commandName;
|
||||||
|
|
||||||
|
if (!class_exists($className)) {
|
||||||
|
throw new Exception('Command "' . $commandName . '" not found.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var AbstractCommand $instance */
|
/** @var AbstractCommand $instance */
|
||||||
$instance = new $className;
|
$instance = new $className;
|
||||||
if (!is_a($instance, "Mage\Command\AbstractCommand")) {
|
if (! $instance instanceOf AbstractCommand) {
|
||||||
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
|
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user