mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-10-30 23:10:16 +01:00 
			
		
		
		
	
							parent
							
								
									825fc64b0a
								
							
						
					
					
						commit
						de51ce2b04
					
				| @ -31,6 +31,11 @@ class Autoload | ||||
|         if (strpos($className, 'Task\\') === 0) { | ||||
|             $baseDir = getcwd() . '/.mage/tasks'; | ||||
|             $postfix = substr($postfix, 5); | ||||
| 
 | ||||
|         } else if (strpos($className, 'Command\\') === 0) { | ||||
|             $baseDir = getcwd() . '/.mage/commands'; | ||||
|             $postfix = substr($postfix, 8); | ||||
| 
 | ||||
|         } else { | ||||
|             $baseDir = dirname(dirname(__FILE__)); | ||||
|         } | ||||
|  | ||||
| @ -10,6 +10,7 @@ | ||||
| 
 | ||||
| namespace Mage\Command; | ||||
| 
 | ||||
| use Mage\Command\AbstractCommand; | ||||
| use Mage\Config; | ||||
| use Mage\Autoload; | ||||
| 
 | ||||
| @ -39,13 +40,18 @@ class Factory | ||||
|         $commandName = str_replace(' ', '_', ucwords(str_replace('/', ' ', $commandName))); | ||||
|         $className = 'Mage\\Command\\BuiltIn\\' . $commandName . 'Command'; | ||||
| 
 | ||||
|         if (!class_exists($className)) { | ||||
|             // try a custom command
 | ||||
|             $className = 'Command\\' . $commandName; | ||||
| 
 | ||||
|             if (!class_exists($className)) { | ||||
|                 throw new Exception('Command "' . $commandName . '" not found.'); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         /** @var AbstractCommand $instance */ | ||||
|         $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.'); | ||||
|         } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user