|
|
@ -14,6 +14,7 @@ use Mage\Runtime\Runtime; |
|
|
|
use Mage\Runtime\Exception\RuntimeException; |
|
|
|
use Mage\Runtime\Exception\RuntimeException; |
|
|
|
use Symfony\Component\Finder\Finder; |
|
|
|
use Symfony\Component\Finder\Finder; |
|
|
|
use Symfony\Component\Finder\SplFileInfo; |
|
|
|
use Symfony\Component\Finder\SplFileInfo; |
|
|
|
|
|
|
|
use ReflectionClass; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Task Factory |
|
|
|
* Task Factory |
|
|
@ -78,11 +79,14 @@ class TaskFactory |
|
|
|
$task->setOptions($options); |
|
|
|
$task->setOptions($options); |
|
|
|
return $task; |
|
|
|
return $task; |
|
|
|
} elseif (class_exists($name)) { |
|
|
|
} elseif (class_exists($name)) { |
|
|
|
$task = new $name(); |
|
|
|
$reflex = new ReflectionClass($name); |
|
|
|
if ($task instanceof AbstractTask) { |
|
|
|
if ($reflex->isInstantiable()) { |
|
|
|
$task->setOptions($options); |
|
|
|
$task = new $name(); |
|
|
|
$this->add($task); |
|
|
|
if ($task instanceof AbstractTask) { |
|
|
|
return $task; |
|
|
|
$task->setOptions($options); |
|
|
|
|
|
|
|
$this->add($task); |
|
|
|
|
|
|
|
return $task; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -101,10 +105,12 @@ class TaskFactory |
|
|
|
foreach ($finder as $file) { |
|
|
|
foreach ($finder as $file) { |
|
|
|
$class = substr('\\Mage\\Task\\BuiltIn\\' . str_replace('/', '\\', $file->getRelativePathname()), 0, -4); |
|
|
|
$class = substr('\\Mage\\Task\\BuiltIn\\' . str_replace('/', '\\', $file->getRelativePathname()), 0, -4); |
|
|
|
if (class_exists($class)) { |
|
|
|
if (class_exists($class)) { |
|
|
|
$task = new $class(); |
|
|
|
$reflex = new ReflectionClass($class); |
|
|
|
|
|
|
|
if ($reflex->isInstantiable()) { |
|
|
|
if ($task instanceof AbstractTask) { |
|
|
|
$task = new $class(); |
|
|
|
$this->add($task); |
|
|
|
if ($task instanceof AbstractTask) { |
|
|
|
|
|
|
|
$this->add($task); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|