Example #1
0
 static function init()
 {
     $conf = (include CONF_ROOT . '/db.php');
     \firegit\db\Db::init($conf);
     Hook::addHook('preReceive', '\\firegit\\app\\hook\\Git::preReceive');
     Hook::addHook('postReceive', '\\firegit\\app\\hook\\Git::postReceive');
 }
Example #2
0
 function updateDate($mergeId, $datas)
 {
     return Db::get('firegit')->table('fg_merge')->where(array('merge_id' => intval($mergeId)))->saveBody($datas)->update();
 }
Example #3
0
 /**
  * 初始化数据库
  */
 public static function initDb()
 {
     $conf = (include CONF_ROOT . '/db.php');
     \firegit\db\Db::init($conf);
 }
Example #4
0
 /**
  * 分页获取评论内容
  * @param $type
  * @param $targetId
  * @param $maxId
  * @param $num
  * @return array
  */
 function getComments($type, $targetId, $num, $maxId = 0)
 {
     $where = array('comment_type' => intval($type), 'comment_status' => 1);
     $this->packTargetId($where, $type, $targetId);
     $db = Db::get('firegit')->table('fg_comment')->where($where);
     if ($maxId > 0) {
         $db->where('comment_id<?', $maxId);
     }
     $rows = $db->get();
     $maxId = 0;
     if ($rows) {
         $maxId = $rows[count($rows) - 1]['comment_id'];
     }
     return array('max_id' => $maxId, 'list' => $rows);
 }
Example #5
0
 public function getBranchs($group, $git, $user)
 {
     return Db::get('firegit')->table('fg_repo_branch')->where(['repo_group' => $group, 'repo_name' => $git, 'username' => $user])->get();
 }