src/classes/CCConsoleController.php
public static function run( $controller, $action = null, $params = array() ) 
	{
		// always enable the file infos
		// this allows CCFile to print an info when a file gets created or deleted.
		CCFile::enable_infos();

		// execute by default the help action
		if ( empty( $action ) ) 
		{
			$action = 'default';
		} 
		
		$path = CCPath::get( $controller, CCDIR_CONSOLE, EXT );
		
		// check if the file exists, if not try with core path
		if ( !file_exists( $path ) ) 
		{
			if ( !CCPath::contains_namespace( $controller ) ) 
			{
				$path = CCPath::get( CCCORE_NAMESPACE.'::'.$controller, CCDIR_CONSOLE, EXT );
			}
		}
		
		// still nothing?
		if ( !file_exists( $path ) ) 
		{
			CCCli::line( "Could not find controller {$controller}.", 'red' );
			return false;
		}
		
		// all console classes should be on the CCConsole namespace
		// this way you can easly overwrite a console script
		$class = 'CCConsole\\'.$controller;
		
		// add the class to the autoloader 
		\CCFinder::bind( $class, $path );
		
		// create an instance
		$class = new $class( $action, $params );
		
		// run wake function
		if ( method_exists( $class, 'wake' ) )
		{
			call_user_func( array( $class, 'wake' ), $params );
		}
		
		// run the execution
		call_user_func( array( $class, '_execute' ), $action, $params );
		
		// run sleep
		if ( method_exists( $class, 'sleep' ) ) 
		{
			call_user_func( array( $class, 'sleep' ), $params );
		}
	}
public static function run( $controller, $action = null, $params = array() ) 
	{
		// always enable the file infos
		// this allows CCFile to print an info when a file gets created or deleted.
		CCFile::enable_infos();

		// execute by default the help action
		if ( empty( $action ) ) 
		{
			$action = 'default';
		} 
		
		$path = CCPath::get( $controller, CCDIR_CONSOLE, EXT );
		
		// check if the file exists, if not try with core path
		if ( !file_exists( $path ) ) 
		{
			if ( !CCPath::contains_namespace( $controller ) ) 
			{
				$path = CCPath::get( CCCORE_NAMESPACE.'::'.$controller, CCDIR_CONSOLE, EXT );
			}
		}
		
		// still nothing?
		if ( !file_exists( $path ) ) 
		{
			CCCli::line( "Could not find controller {$controller}.", 'red' );
			return false;
		}
		
		// all console classes should be on the CCConsole namespace
		// this way you can easly overwrite a console script
		$class = 'CCConsole\\'.$controller;
		
		// add the class to the autoloader 
		\CCFinder::bind( $class, $path );
		
		// create an instance
		$class = new $class( $action, $params );
		
		// run wake function
		if ( method_exists( $class, 'wake' ) )
		{
			call_user_func( array( $class, 'wake' ), $params );
		}
		
		// run the execution
		call_user_func( array( $class, '_execute' ), $action, $params );
		
		// run sleep
		if ( method_exists( $class, 'sleep' ) ) 
		{
			call_user_func( array( $class, 'sleep' ), $params );
		}
	}
public static function run ( $ controller , $ action = null , $ params = array ( ) ) { // always enable the file infos // this allows CCFile to print an info when a file gets created or deleted. CCFile :: enable_infos ( ) ; // execute by default the help action if ( empty ( $ action ) ) { $ action = 'default' ; } $ path = CCPath :: get ( $ controller , CCDIR_CONSOLE , EXT ) ; // check if the file exists, if not try with core path if ( ! file_exists ( $ path ) ) { if ( ! CCPath :: contains_namespace ( $ controller ) ) { $ path = CCPath :: get ( CCCORE_NAMESPACE . '::' . $ controller , CCDIR_CONSOLE , EXT ) ; } } // still nothing? if ( ! file_exists ( $ path ) ) { CCCli :: line ( "Could not find controller {$controller}." , 'red' ) ; return false ; } // all console classes should be on the CCConsole namespace // this way you can easly overwrite a console script $ class = 'CCConsole\\' . $ controller ; // add the class to the autoloader  \ CCFinder :: bind ( $ class , $ path ) ; // create an instance $ class = new $ class ( $ action , $ params ) ; // run wake function if ( method_exists ( $ class , 'wake' ) ) { call_user_func ( array ( $ class , 'wake' ) , $ params ) ; } // run the execution call_user_func ( array ( $ class , '_execute' ) , $ action , $ params ) ; // run sleep if ( method_exists ( $ class , 'sleep' ) ) { call_user_func ( array ( $ class , 'sleep' ) , $ params ) ; } }
Run a console script

@param string		$controller
@param string		$action
@param array 		$params
Run a console script