Exemple #1
0
 public function before()
 {
     parent::before();
     // Setup
     ini_set("max_execution_time", "0");
     ini_set("max_input_time", "0");
     set_time_limit(0);
     // Signal handler
     pcntl_signal(SIGCHLD, array($this, 'sig_handler'));
     pcntl_signal(SIGTERM, array($this, 'sig_handler'));
     declare (ticks=1);
     // library
     include_once APPPATH . '/classes/library/task_queue.php';
 }
Exemple #2
0
 /**
  * Controller::before - prepares daemon
  */
 public function before()
 {
     parent::before();
     // Setup
     ini_set("max_execution_time", "0");
     ini_set("max_input_time", "0");
     set_time_limit(0);
     // Signal handler
     pcntl_signal(SIGCHLD, array($this, 'sig_handler'));
     pcntl_signal(SIGTERM, array($this, 'sig_handler'));
     declare (ticks=1);
     // load config file
     $params = $this->request->param();
     $this->_name = $name = count($params) ? reset($params) : 'default';
     $this->_config = Kohana::$config->load('tasks')->{$name};
     if (empty($this->_config)) {
         // configuration object not found - log & exit
         Kohana::$log->add(Log::ERROR, 'Queue. Config not found ("daemon.' . $name . '"). Exiting.');
         echo 'Queue. Config not found ("daemon.' . $name . '"). Exiting.' . PHP_EOL;
         exit;
     }
     $this->_config['pid_path'] = $this->_config['pid_path'] . 'MangoQueue.' . $name . '.pid';
 }
Exemple #3
0
 public function before()
 {
     parent::before();
     // Setup
     ini_set("max_execution_time", "0");
     ini_set("max_input_time", "0");
     set_time_limit(0);
     // Signal handler
     pcntl_signal(SIGCHLD, array($this, 'sig_handler'));
     pcntl_signal(SIGTERM, array($this, 'sig_handler'));
     declare (ticks=1);
     // Load config
     $params = $this->request->param();
     // First key is config
     $this->_config_name = count($params) ? reset($params) : 'default';
     $this->_config = Kohana::config('daemon')->{$config};
     if (empty($this->_config)) {
         Kohana::$log->add('error', 'Queue. Config not found ("daemon.' . $this->_config_name . '"). Exiting.');
         echo 'Queue. Config not found ("daemon.' . $this->_config_name . '"). Exiting.' . PHP_EOL;
         exit;
     }
     $this->_config['pid_path'] = $this->_config['pid_path'] . 'MangoQueue.' . $this->_config_name . '.pid';
 }