mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-19 22:15:05 +02:00
Fix Autoload for Custom Tasks.
This commit is contained in:
parent
ce0e707dc6
commit
20de8eb7e0
|
@ -27,8 +27,15 @@ class Autoload
|
||||||
$className = ltrim($className, '/');
|
$className = ltrim($className, '/');
|
||||||
$postfix = '/' . str_replace(array('_', '\\'), '/', $className . '.php');
|
$postfix = '/' . str_replace(array('_', '\\'), '/', $className . '.php');
|
||||||
|
|
||||||
|
// Change BaseDir according to Namespace
|
||||||
|
if (strpos($className, 'Task\\') === 0) {
|
||||||
|
$baseDir = getcwd() . '/.mage/tasks';
|
||||||
|
$postfix = substr($postfix, 5);
|
||||||
|
} else {
|
||||||
|
$baseDir = dirname(dirname(__FILE__));
|
||||||
|
}
|
||||||
|
|
||||||
//Try to load a normal Mage class (or Task). Think that Mage component is compiled to .phar
|
//Try to load a normal Mage class (or Task). Think that Mage component is compiled to .phar
|
||||||
$baseDir = dirname(dirname(__FILE__));
|
|
||||||
$classFileWithinPhar = $baseDir . $postfix;
|
$classFileWithinPhar = $baseDir . $postfix;
|
||||||
if ($this->isReadable($classFileWithinPhar)) {
|
if ($this->isReadable($classFileWithinPhar)) {
|
||||||
/** @noinspection PhpIncludeInspection */
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Factory
|
||||||
$taskName = str_replace(' ', '', $taskName);
|
$taskName = str_replace(' ', '', $taskName);
|
||||||
|
|
||||||
if (strpos($taskName, '/') === false) {
|
if (strpos($taskName, '/') === false) {
|
||||||
$className = $taskName;
|
$className = 'Task\\' . $taskName;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$className = 'Mage\\Task\\BuiltIn\\' . str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName))) . 'Task';
|
$className = 'Mage\\Task\\BuiltIn\\' . str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName))) . 'Task';
|
||||||
|
|
Loading…
Reference in a new issue