diff -r 07239de796bb -r e756a8c72c3d cms/drupal/modules/update/update.install --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/drupal/modules/update/update.install Fri Sep 08 12:04:06 2017 +0200 @@ -0,0 +1,190 @@ +createQueue(); +} + +/** + * Implements hook_uninstall(). + */ +function update_uninstall() { + // Clear any variables that might be in use + $variables = array( + 'update_check_frequency', + 'update_fetch_url', + 'update_last_check', + 'update_last_email_notification', + 'update_notification_threshold', + 'update_notify_emails', + 'update_max_fetch_attempts', + 'update_max_fetch_time', + ); + foreach ($variables as $variable) { + variable_del($variable); + } + $queue = DrupalQueue::get('update_fetch_tasks'); + $queue->deleteQueue(); +} + +/** + * Fills in the requirements array. + * + * This is shared for both core and contrib to generate the right elements in + * the array for hook_requirements(). + * + * @param $project + * Array of information about the project we're testing as returned by + * update_calculate_project_data(). + * @param $type + * What kind of project this is ('core' or 'contrib'). + * + * @return + * An array to be included in the nested $requirements array. + * + * @see hook_requirements() + * @see update_requirements() + * @see update_calculate_project_data() + */ +function _update_requirement_check($project, $type) { + $requirement = array(); + if ($type == 'core') { + $requirement['title'] = t('Drupal core update status'); + } + else { + $requirement['title'] = t('Module and theme update status'); + } + $status = $project['status']; + if ($status != UPDATE_CURRENT) { + $requirement['reason'] = $status; + $requirement['description'] = _update_message_text($type, $status, TRUE); + $requirement['severity'] = REQUIREMENT_ERROR; + } + switch ($status) { + case UPDATE_NOT_SECURE: + $requirement_label = t('Not secure!'); + break; + case UPDATE_REVOKED: + $requirement_label = t('Revoked!'); + break; + case UPDATE_NOT_SUPPORTED: + $requirement_label = t('Unsupported release'); + break; + case UPDATE_NOT_CURRENT: + $requirement_label = t('Out of date'); + $requirement['severity'] = REQUIREMENT_WARNING; + break; + case UPDATE_UNKNOWN: + case UPDATE_NOT_CHECKED: + case UPDATE_NOT_FETCHED: + $requirement_label = isset($project['reason']) ? $project['reason'] : t('Can not determine status'); + $requirement['severity'] = REQUIREMENT_WARNING; + break; + default: + $requirement_label = t('Up to date'); + } + if ($status != UPDATE_CURRENT && $type == 'core' && isset($project['recommended'])) { + $requirement_label .= ' ' . t('(version @version available)', array('@version' => $project['recommended'])); + } + $requirement['value'] = l($requirement_label, update_manager_access() ? 'admin/reports/updates/update' : 'admin/reports/updates'); + return $requirement; +} + +/** + * @addtogroup updates-6.x-to-7.x + * @{ + */ + +/** + * Create a queue to store tasks for requests to fetch available update data. + */ +function update_update_7000() { + module_load_include('inc', 'system', 'system.queue'); + $queue = DrupalQueue::get('update_fetch_tasks'); + $queue->createQueue(); +} + +/** + * Recreates cache_update table. + * + * Converts fields that hold serialized variables from text to blob. + * Removes 'headers' column. + */ +function update_update_7001() { + $schema = system_schema_cache_7054(); + + db_drop_table('cache_update'); + db_create_table('cache_update', $schema); +} + +/** + * @} End of "addtogroup updates-6.x-to-7.x". + */