Exemplo n.º 1
0
            $modules['task'] = array('name' => 'task', 'title' => '系统任务');
        }
    }
}
if ($do == 'del') {
    $ids = $_GPC['id'];
    if (!is_array($ids)) {
        $ids = array($ids);
    }
    if (!empty($ids)) {
        foreach ($ids as $id) {
            $id = intval($id);
            if ($id > 0) {
                $cron = pdo_get('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $id));
                if (!empty($cron)) {
                    $result = cloud_cron_remove($cron['cloudid']);
                    if (!is_error($result)) {
                        pdo_delete('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $id));
                    } else {
                        message("删除{$cron['title']}失败", url('cron/display/list'), 'error');
                    }
                }
            }
        }
        message('删除计划任务成功', url('cron/display/list'), 'success');
    } else {
        message('没有选择要删除的任务', referer(), 'error');
    }
}
if ($do == 'run') {
    $id = intval($_GPC['id']);
Exemplo n.º 2
0
function cron_delete($ids)
{
    global $_W;
    load()->model('cloud');
    if (empty($ids)) {
        return true;
    }
    $ids = implode(', ', $ids);
    $corns = pdo_fetchall('SELECT id, cloudid FROM ' . tablename('core_cron') . " WHERE uniacid = :uniacid AND id IN ({$ids})", array(':uniacid' => $_W['uniacid']), 'cloudid');
    $cloudid = array_keys($corns);
    if (!empty($cloudid)) {
        $status = cloud_cron_remove($cloudid);
        if (is_error($status)) {
            return $status;
        }
        pdo_query('DELETE FROM ' . tablename('core_cron') . " WHERE uniacid = :uniacid AND id IN ({$ids})", array(':uniacid' => $_W['uniacid']));
    }
    return true;
}