You are here

function drd_server_domain_list_updates in Drupal Remote Dashboard Server 7.2

Same name and namespace in other branches
  1. 6.2 drd_server.domain.inc \drd_server_domain_list_updates()
  2. 6 drd_server.domain.inc \drd_server_domain_list_updates()
  3. 7 drd_server.domain.inc \drd_server_domain_list_updates()

DRD Server Action to determine all available updates for the current domain.

Parameters

string $mode: Whether to return available updates into the domain field of the array or the server key.

Return value

string Returnable string to DRD.

1 call to drd_server_domain_list_updates()
drd_server_server_list_updates in ./drd_server.server.inc
DRD Action to determine all available updates for the current core including all disabled modules.
1 string reference to 'drd_server_domain_list_updates'
drd_server_drd_server_actions in ./drd_server.module
Implements hook_drd_server_actions().

File

./drd_server.domain.inc, line 121
Provides domain related functionality triggered by DRD.

Code

function drd_server_domain_list_updates($mode = 'domain') {
  if (!module_exists('update')) {
    drupal_set_message(t('Update module not installed.'));
    return drd_server_result('list.updates', '');
  }
  $frequency = variable_get('update_check_frequency', 1);
  $interval = 60 * 60 * 24 * $frequency;
  if (REQUEST_TIME - variable_get('update_last_check', 0) > $interval) {
    update_refresh();
    module_load_include('inc', 'update', 'update.fetch');
    $queue = DrupalQueue::get('update_fetch_tasks');
    while ($item = $queue
      ->claimItem()) {
      _update_process_fetch_task($item->data);
      $queue
        ->deleteItem($item);
    }
  }
  else {
    update_get_available(TRUE);
  }
  update_clear_update_disk_cache();
  module_load_include('inc', 'update', 'update.manager');
  $form = drupal_get_form('update_manager_update_form', 'report');
  $result['cache']['update'][$mode] = array(
    'title' => 'Available Updates',
    'callbacks' => array(
      '0' => array(
        'callback' => 'theme',
        'arguments' => array(
          'update_last_check' => 'update_last_check',
          'variables' => array(
            'last' => variable_get('update_last_check', 0),
          ),
        ),
      ),
      '1' => array(
        'callback' => 'drupal_render',
        'arguments' => array(
          'form' => array(
            $form,
          ),
        ),
      ),
    ),
  );
  $prj_cache = _update_cache_get('update_project_data');
  $result['projects'] = $prj_cache->data;
  return drd_server_result('list.updates', $result);
}