X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fupdate%2Fupdate.install;fp=web%2Fcore%2Fmodules%2Fupdate%2Fupdate.install;h=c616412ac41172de81f31b7981a8b7d3cd983bf4;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website
diff --git a/web/core/modules/update/update.install b/web/core/modules/update/update.install
new file mode 100644
index 000000000..c616412ac
--- /dev/null
+++ b/web/core/modules/update/update.install
@@ -0,0 +1,158 @@
+createQueue();
+}
+
+/**
+ * Implements hook_uninstall().
+ */
+function update_uninstall() {
+ \Drupal::state()->delete('update.last_check');
+ \Drupal::state()->delete('update.last_email_notification');
+
+ $queue = \Drupal::queue('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 = [];
+ 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['severity'] = REQUIREMENT_ERROR;
+ // Append the available updates link to the message from
+ // _update_message_text(), and format the two translated strings together in
+ // a single paragraph.
+ $requirement['description'][] = ['#markup' => _update_message_text($type, $status)];
+ if (_update_manager_access()) {
+ $requirement['description'][] = ['#prefix' => ' ', '#markup' => t('See the available updates page for more information and to install your missing updates.', [':available_updates' => \Drupal::url('update.report_update')])];
+ }
+ else {
+ $requirement['description'][] = ['#prefix' => ' ', '#markup' => t('See the available updates page for more information.', [':available_updates' => \Drupal::url('update.status')])];
+ }
+ }
+ 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)', ['@version' => $project['recommended']]);
+ }
+ $requirement['value'] = \Drupal::l($requirement_label, new Url(_update_manager_access() ? 'update.report_update' : 'update.status'));
+ return $requirement;
+}
+
+/**
+ * Rebuild the router to ensure admin/reports/updates/check has CSRF protection.
+ */
+function update_update_8001() {
+ // Empty update forces a call to drupal_flush_all_caches() which rebuilds the
+ // router.
+}