示例#1
0
 public function get_newest_sync_version($pid, $limit = 10)
 {
     $synclog = Model_SyncLog::data_access()->filter(Model_SyncLog::PID, intval($pid))->limit($limit)->sort(Model_SyncLog::ID)->find();
     return $synclog;
 }
示例#2
0
    $msg = system($c->command, $exit_val);
    $status = 0;
    if ($exit_val == 0) {
        $status = 1;
        //insert sync log
        try {
            $oplog = Model_OperateLog::data_access()->filter(Model_OperateLog::ID, $c->id)->find_one();
            if ($oplog->op == 1) {
                $project = Model_Project::data_access()->filter(Model_Project::ID, $c->pid)->find_one();
                $dir = APF::get_instance()->get_config('update_path') . '/' . $project->name;
                $is_git = Biz_Command::get_instance()->is_git($c->pid) ? 1 : 0;
                $script_path = APF::get_instance()->get_config('script_path');
                $command = "sh {$script_path}/get_version.sh -d '{$dir}' -i '{$is_git}'";
                $identify = system($command, $vers_exit);
                if ($vers_exit == 0) {
                    $synclog = new Model_SyncLog();
                    $synclog->pid = $c->pid;
                    $synclog->param = $oplog->param;
                    $synclog->identify = $identify;
                    $synclog->save();
                }
            }
        } catch (Exception $ex) {
        }
    } else {
        $status = $exit_val;
    }
    $c->status = $status;
    $c->cmd_msg = $msg;
    $c->save();
}