Exemplo n.º 1
0
 /**
  * Create a new Command object
  *
  * @param String $dir an optional starting directory to change from
  */
 public function __construct($dir = NULL)
 {
     // Parse options and arguments, and run in the project's root directory
     $this->parse_command_line();
     $this->change_directory($dir);
     // Include from "app" before "yawf"
     if (!is_dir('yawf')) {
         $this->quit('No "yawf" directory in ' . getcwd());
     }
     ini_set('include_path', 'app:yawf:.');
     require_once 'lib/utils.php';
     YAWF::start();
     // for benchmarks
     // Convert the opts to an Object
     $this->opts = new Object($this->opts);
     // Create an App object, optionally for testing
     $this->app = $this->opts->test ? new App_test($this->path) : new App($this->path);
     $this->app->new_controller('Controller');
     // for email
     // Log output to a log file named "YYYYMMDD.command[.test].log"
     $type = $this->opts->test ? 'command.test' : 'command';
     Log::type($type);
     // Allow commands to run quietly by not logging
     if ($this->opts->quiet) {
         Log::level(Log::QUIET);
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Note the start time of YAWF
  */
 public static function start()
 {
     if (self::$start) {
         throw new Exception('YAWF has already started');
     }
     self::$start = microtime(TRUE);
     // Keep note of our start time
     self::hook('default', 'self::unknown');
     // Set the default hook method
 }