function evercurrent_run_update_check in Evercurrent 7
Same name and namespace in other branches
- 7.2 evercurrent.send.inc \evercurrent_run_update_check()
3 calls to evercurrent_run_update_check()
- evercurrent_cron in ./
evercurrent.module - Implements hook_cron().
- evercurrent_key in ./
evercurrent.module - Page callback for retrieving a new key. To be run only if evercurrent actually want a new key.
- evercurrent_send_update_submit in ./
evercurrent.admin.inc
File
- ./
evercurrent.send.inc, line 3
Code
function evercurrent_run_update_check($key = NULL) {
$key = $key ?: _evercurrent_get_key();
if (!$key) {
_evercurrent_write_status(RMH_STATUS_WARNING, 'Update check not run. No key');
return FALSE;
}
if ($available = update_get_available(TRUE)) {
module_load_include('inc', 'update', 'update.compare');
$data = update_calculate_project_data($available);
}
else {
_evercurrent_write_status(RMH_STATUS_WARNING, 'Unable to get available updates');
drupal_set_message('Unable to get available updates');
return FALSE;
}
global $base_url;
$sender_data = array(
'send_url' => variable_get('evercurrent_target_address', RMH_ENV_URL),
'project_name' => _evercurrent_get_environment_url(),
'key' => $key,
'module_version' => '0',
'api_version' => '0',
'updates' => array(),
);
$status_list = array(
UPDATE_NOT_SECURE,
UPDATE_REVOKED,
UPDATE_NOT_SUPPORTED,
UPDATE_CURRENT,
UPDATE_NOT_CHECKED,
UPDATE_NOT_CURRENT,
);
foreach ($data as $module => $module_info) {
if (in_array($module_info['status'], $status_list, NULL)) {
$sender_data['updates'][$module] = $data[$module];
// In some cases (like multisite installations),
// modules on certain paths are considered unimportant.
$module_path = str_replace('/' . $module, '', drupal_get_path('module', $module));
$sender_data['updates'][$module]['module_path'] = $module_path;
}
}
// API version
$sender_data['api_version'] = 2;
// Module version
$versions = system_get_info('module', 'evercurrent');
$sender_data['module_version'] = $versions['version'];
// Send active module data, to allow us to act on uninstalled modules
$sender_data['enabled'] = module_list();
// Retrieve active theme data
$themes = list_themes(TRUE);
foreach ($themes as $theme) {
$machine_name = $theme->name;
$sender_data['enabled'][$machine_name] = $machine_name;
}
// Retrieve active installation profile data.
// We mark this as enabled send this if we are using an installation profile
// that the Update Manager module also reports on. Otherwise, Evercurrent
// will not tell us about updates for it.
$install_profile = variable_get('install_profile');
if ($install_profile && in_array($install_profile, array_keys($sender_data['updates']))) {
$sender_data['enabled'][$install_profile] = $install_profile;
}
// Expose hook to add anything else.
drupal_alter('evercurrent_update_data', $sender_data);
$response = _evercurrent_send_updates($sender_data);
return $response;
}