Пример #1
0
 /**
  * Constructor
  *
  */
 private function __construct()
 {
     $conf = SVNHooksConfig::get_instance();
     $this->enabled = $conf->debug;
     if ($this->enabled) {
         $this->fp = fopen($conf->root_dir . '/dbg.txt', 'a');
     }
 }
Пример #2
0
 /**
  * Gets the only config instance
  *
  * @return SVNHooksConfig
  */
 public static function get_instance()
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c();
     }
     return self::$_instance;
 }
Пример #3
0
 /**
  * Prepares commands list
  *
  * @return bool
  */
 public function prepare()
 {
     $conf = SVNHooksConfig::get_instance();
     $ex_str = sprintf("%s info %s -r %s 2>&1", $conf->svnlook, $this->repos, $this->rev);
     exec($ex_str, $out, $code);
     dbg::get_instance()->write('PostCommitHandler::prepare exec result: ' . $code);
     dbg::get_instance()->write('PostCommitHandler::prepare exec output: ' . var_export($out, true));
     if ($code) {
         return false;
     }
     $this->revision_wrapper = new SVNRevisionWrapper($this->rev, $out);
     dbg::get_instance()->write('PostCommitHandler::prepare SVNRevisionWrapper: ' . var_export($this->revision_wrapper, true));
     $this->commands[] = new CommandActiveUser($this->revision_wrapper->author);
     if (!$this->parse_comment_into_commands()) {
         return false;
     }
     return count($this->commands) > 1;
 }
Пример #4
0
 /**
  * Send commands to flyspray
  *
  * @return bool
  */
 public function send()
 {
     try {
         if (!count($this->commands)) {
             return true;
         }
         $conf = SVNHooksConfig::get_instance();
         $cookie_file = $conf->root_dir . "/cookie.tmp";
         $this->login($conf->fs_config->url, $cookie_file, $conf->fs_config->admin_login, $conf->fs_config->admin_pwd);
         $this->transfer($conf->fs_config->api_url, $cookie_file, json_encode($this->commands));
     } catch (Exception $exc) {
         $this->error = $exc->getMessage();
         dbg::get_instance()->write("AbstractHandler::send Exception:\r\n" . $this->error);
         return false;
     }
     return true;
 }