예제 #1
0
function do_create_task($fqdn_)
{
    $server = Abstract_Server::load($fqdn_);
    if (!is_object($server)) {
        Logger::error('main', '(ajax/installable_applications) Server ' . $fqdn_ . ' not found');
        header('Content-Type: text/xml; charset=utf-8');
        $dom = new DomDocument('1.0', 'utf-8');
        $node = $dom->createElement('usage');
        $node->setAttribute('status', 'server not found');
        $dom->appendChild($node);
        die($dom->saveXML());
    }
    $task = new Task_available_applications('', $fqdn_);
    $manager = new Tasks_Manager();
    $manager->add($task);
    header('Content-Type: text/xml; charset=utf-8');
    $dom = new DomDocument('1.0', 'utf-8');
    $node = $dom->createElement('task');
    $node->setAttribute('id', $task->id);
    $dom->appendChild($node);
    die($dom->saveXML());
}
예제 #2
0
파일: actions.php 프로젝트: skdong/nfs-ovd
    }
}
if ($_REQUEST['name'] == 'Task') {
    // it is the rigth place ? (see similar block on name=server action=install_line
    if (!checkAuthorization('manageServers')) {
        redirect();
    }
    $tm = new Tasks_Manager();
    $tm->load_all();
    $tm->refresh_all();
    if ($_REQUEST['action'] == 'add') {
        if (isset($_POST['type'])) {
            $type_task = 'Task_' . $_POST['type'];
            try {
                $task = new $type_task(0, $_POST['server'], $_POST['request']);
                $tm->add($task);
                popup_info(_("Task successfully added"));
            } catch (Exception $e) {
                Logger::error('main', 'tasks.php error create task (type=\'' . $type_task . '\')');
                popup_error("error create task (type='{$type_task}')");
            }
        }
        redirect('tasks.php');
    }
    if ($_REQUEST['action'] == 'del') {
        if (isset($_REQUEST['checked_tasks']) && is_array($_REQUEST['checked_tasks'])) {
            foreach ($_REQUEST['checked_tasks'] as $id) {
                $task = false;
                foreach ($tm->tasks as $t) {
                    if ($t->id == $id) {
                        $task = $t;
예제 #3
0
파일: api.php 프로젝트: bloveing/openulteo
 public function task_debian_application_remove($application_id_, $server_id_)
 {
     $this->check_authorized('manageServers');
     $applicationDB = ApplicationDB::getInstance();
     $app = $applicationDB->import($application_id_);
     if (!$app) {
         return null;
     }
     if ($app->getAttribute('static') != false) {
         return null;
     }
     $server = Abstract_Server::load($server_id_);
     if (!is_object($server)) {
         Logger::error('api', sprintf('Unknown server "%s"', $server_id_));
         return null;
     }
     $tm = new Tasks_Manager();
     $t = new Task_remove(0, $server_id_, array($app));
     $tm->add($t);
     $this->log_action('task_debian_application_remove', array('server_id' => $server->id, 'server_name' => $server->getDisplayName(), 'application_id' => $application_id_, 'application_name' => $app->getAttribute('name')));
     return $t->id;
 }