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