Browse Source

Fix Autoload for Custom Tasks.

1.0
Andrés Montañez 11 years ago
parent
commit
20de8eb7e0
  1. 9
      Mage/Autoload.php
  2. 2
      Mage/Task/Factory.php

9
Mage/Autoload.php

@ -27,8 +27,15 @@ class Autoload
$className = ltrim($className, '/');
$postfix = '/' . str_replace(array('_', '\\'), '/', $className . '.php');
//Try to load a normal Mage class (or Task). Think that Mage component is compiled to .phar
// 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
$classFileWithinPhar = $baseDir . $postfix;
if ($this->isReadable($classFileWithinPhar)) {
/** @noinspection PhpIncludeInspection */

2
Mage/Task/Factory.php

@ -48,7 +48,7 @@ class Factory
$taskName = str_replace(' ', '', $taskName);
if (strpos($taskName, '/') === false) {
$className = $taskName;
$className = 'Task\\' . $taskName;
} else {
$className = 'Mage\\Task\\BuiltIn\\' . str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName))) . 'Task';

Loading…
Cancel
Save