Exemplo n.º 1
0
 public function get_all_list($name_prefix)
 {
     $da = Model_Project::data_access()->filter(Model_Project::IS_REMOVED, 0);
     if (!empty($name_prefix)) {
         $da->filter(Model_Project::NAME_PREFIX, $name_prefix);
     }
     $list = $da->sort(Model_Project::ID)->find();
     if (empty($list)) {
         return array();
     }
     $pids = array();
     foreach ($list as $r) {
         $pids[] = $r->id;
     }
     $hosts = Model_Host::data_access()->filter_by_op(Model_Host::PID, 'in', $pids)->find();
     $kv_hosts = array();
     foreach ($hosts as $v) {
         $kv_hosts[$v->pid][] = $v->hostname;
     }
     foreach ($list as $k => $r) {
         if (array_key_exists($r->id, $kv_hosts)) {
             $list[$k]->hosts = $kv_hosts[$r->id];
         } else {
             $list[$k]->hosts = array();
         }
     }
     //$kv_exclude = Biz_Exclude::get_instance()->get_exclude_by_pids($pids);
     //foreach($list as $k => $r){
     //    if(array_key_exists($r->id,$kv_exclude) ){
     //        $list[$k]->excludes = $kv_exclude[$r->id];
     //    }else{
     //        $list[$k]->excludes  = array();
     //    }
     //}
     return $list;
 }
Exemplo n.º 2
0
             $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();
             }
         }
     } catch (Exception $ex) {
     }