Пример #1
0
 public function init()
 {
     $this->_lock = new Core_Lock($this->_options, self::$out);
     try {
         if (!isset($this->_options['engine'])) {
             throw new Core_StopException("You have to configure `engine`.", "init");
         }
         //internally return isLocked();
         if ($this->_lock->lock()) {
             self::$out->logNotice(">>>>SHOULD WAIT");
             $this->_lock->wait();
         }
         // configure output
         $this->_configureOutput();
         // engine.nice
         if (!self::isWindows() && false !== $this->_options['engine']['nice']) {
             self::$out->logNotice("changing process priority, nice=" . $this->_options['engine']['nice']);
             proc_nice($this->_options['engine']['nice']);
         }
         // configure compare driver
         $this->_configureCompare();
         // configure local driver
         $this->_configureLocalStorage();
         // configure remote driver
         $this->_configureRemoteStorage();
     } catch (Core_StopException $e) {
         // start text
         self::$out->welcome();
         // error message
         $this->_stopAt = $e;
         self::$out->logError($e->getMessage());
         // help instructions
         self::$out->showHelp($this->_appHelpMessage);
         return false;
     } catch (Exception $e) {
         $myE = new Core_StopException("", "engine init", null, Core_StopException::RETCODE_FOREIGN_EXCEPTION);
         $myE->setException($e);
         $this->_stopAt = $myE;
         throw $e;
     }
     return true;
 }