Beispiel #1
0
 /**
  * Do specified task 
  *
  * @param string $task_name 
  * @param mixed $task_args
  */
 public function run_task($task_name, $task_args)
 {
     try {
         $holder = PaskHolder::getInstance();
         $stack = $holder->create_taskstack($task_name);
     } catch (Exception $err) {
         throw $err;
     }
     $this->writer->puts("Run    '" . $task_name . "' task.");
     $total_start_time = Utils::get_time();
     while (count($stack) != 0) {
         try {
             $task_data = array_shift($stack);
             $this->writer->verbose("Start '" . $task_data['name']);
             $start_time = Utils::get_time();
             $task_data['callback']();
             $process_time = Utils::get_process_time($start_time);
             $this->writer->verbose("End   '" . $task_data['name'] . "(" . $process_time . "[msec])");
         } catch (Exception $err) {
             throw $err;
         }
     }
     $total_process_time = Utils::get_process_time($total_start_time);
     $this->writer->puts("Finish '" . $task_name . "' task.(" . $total_process_time . "[msec])");
 }
Beispiel #2
0
 public function getInstance()
 {
     if (PaskHolder::$_self == null) {
         PaskHolder::$_self = new PaskHolder();
     }
     return PaskHolder::$_self;
 }
Beispiel #3
0
 /**
  *
  */
 public function show_tasklist()
 {
     $holder = PaskHolder::getInstance();
     $tasks = $holder->get_all_tasks();
     $descs = array();
     foreach ($tasks as $task) {
         array_push($descs, array('name' => $task['name'], 'desc' => $task['desc']));
     }
     $writer = TaskListWriter::getInstance();
     $writer->puts_tasks($descs);
 }
Beispiel #4
0
function desc($desc)
{
    CheckUtil::check_string($desc, "Invalid argument.");
    $holder = PaskHolder::getInstance();
    $holder = $holder->add_desc($desc);
}