Exemple #1
0
 public function get_newest_log($pid, $limit)
 {
     $list = Model_OperateLog::data_access()->filter(Model_OperateLog::PID, intval($pid))->limit(intval($limit))->sort(Model_OperateLog::ID)->find();
     if (empty($list)) {
         return $list;
     }
     $ids = array();
     $uids = array();
     foreach ($list as $row) {
         $ids[] = $row->id;
         if (!in_array($row->user_id, $uids)) {
             $uids[] = $row->user_id;
         }
     }
     $users = Biz_User::get_instance()->get_users_map($uids);
     foreach ($list as $key => $row) {
         if (array_key_exists($row->user_id, $users)) {
             $list[$key]->user = $users[$row->user_id];
         }
     }
     $cmds = Biz_Command::get_instance()->get_cmds_map($ids);
     foreach ($list as $key => $row) {
         if (array_key_exists($row->id, $cmds)) {
             $list[$key]->cmd = $cmds[$row->id];
         }
     }
     return $list;
 }
Exemple #2
0
         if ($parent_cmd->status != 1) {
             $c->status = 100;
             $c->save();
             continue;
         }
     } catch (Exception $ex) {
     }
 }
 #$msg = system("{$c->command} >> /tmp/ipublish.log 2>&1",$exit_val);
 $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();
             }
         }