コード例 #1
0
$system_id = POST('system_id');
$action = POST('action');
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
ossim_valid($action, OSS_LETTER, '_', 'illegal:' . _('Action'));
if (ossim_error()) {
    $data['status'] = 'error';
    $data['data'] = ossim_get_error_clean();
    echo json_encode($data);
    exit;
}
if ($action == 'update_system' || $action == 'update_system_feed') {
    //Check system status
    $res = Av_center::get_task_status($system_id, 'alienvault-update');
    if ($res['status'] == 'done') {
        if ($action == 'update_system') {
            $data = Av_center::update_av_system($system_id);
        } else {
            $data = Av_center::update_av_feed($system_id);
        }
    } elseif ($res['status'] == 'running') {
        $data['status'] = 'warning';
        $data['data'] = _('Update process was launched previously');
    } else {
        $data['status'] = 'warning';
        $data['data'] = _('Update process can not be launched at this time.  Please, try again later');
    }
} elseif ($action == 'check_update_status') {
    sleep(2);
    $res = Av_center::get_task_status($system_id, 'alienvault-update');
    $data['status'] = 'success';
    if ($res['status'] == 'running') {