You are here

function hosting_task_menu in Hostmaster (Aegir) 6

Implementation of hook_menu().

File

modules/hosting/task/hosting_task.module, line 9
Web server node type is defined here.

Code

function hosting_task_menu() {
  $items = array();
  foreach (array(
    'site',
    'platform',
    'server',
  ) as $type) {
    if (!($tasks = hosting_available_tasks($type))) {

      // this is to workaround problems in the upgrade path where the
      // hook returns nothing (e.g. for server)
      continue;
    }
    foreach ($tasks as $task => $info) {
      if (empty($info['hidden'])) {
        $path = sprintf("node/%%hosting_%s_node/%s_%s", $type, $type, $task);
        $items[$path] = array(
          'title' => $info['title'],
          'description' => $info['description'],
          'page callback' => 'drupal_get_form',
          'page arguments' => array(
            'hosting_task_confirm_form',
            1,
            $task,
          ),
          'access callback' => 'hosting_task_menu_access_csrf',
          'access arguments' => array(
            1,
            $task,
          ),
          'type' => MENU_CALLBACK,
        );
        $items[$path] = array_merge($items[$path], $info);
      }
    }
  }
  $items['hosting/tasks/%node/list'] = array(
    'title' => t('Task list'),
    'description' => t('AJAX callback for refreshing task list'),
    'page callback' => 'hosting_task_ajax_list',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'node_access',
    'access arguments' => array(
      'view',
      2,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['hosting/tasks/%node/cancel'] = array(
    'title' => t('Task list'),
    'description' => t('Callback for stopping tasks'),
    'page callback' => 'hosting_task_cancel',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'hosting_task_cancel_access',
    'access arguments' => array(
      2,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['hosting/tasks/queue'] = array(
    'title' => t('Task list'),
    'description' => t('AJAX callback for refreshing task queue'),
    'page callback' => 'hosting_task_ajax_queue',
    'access arguments' => array(
      'access task logs',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}