Пример #1
0
<?php

apf_require_class("Model_Command");
apf_require_class("Model_OperateLog");
apf_require_class("Model_SyncLog");
apf_require_class("Model_Project");
apf_require_class("Biz_Command");
$limit = 10;
$cmd = Model_Command::data_access()->filter(Model_Command::STATUS, 0)->limit($limit)->sort(Model_Command::ID, 'asc')->find();
foreach ($cmd as $c) {
    if ($c->parent_id > 0) {
        try {
            $parent_cmd = Model_Command::data_access()->filter(Model_Command::ID, $c->parent_id)->find_one();
            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();
Пример #2
0
 public function get_cmds_map(array $ids)
 {
     $cmds = Model_Command::data_access()->filter_by_op(Model_Command::ID, 'in', $ids)->find();
     $_kv_cmds = array();
     foreach ($cmds as $cmd) {
         $_kv_cmds[$cmd->id] = $cmd;
     }
     return $_kv_cmds;
 }