mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Fix Autoload for Custom Tasks.
This commit is contained in:
		
							parent
							
								
									ce0e707dc6
								
							
						
					
					
						commit
						20de8eb7e0
					
				@ -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 */
 | 
			
		||||
 | 
			
		||||
@ -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…
	
		Reference in New Issue
	
	Block a user