Newer
Older

Lucas Hedding
committed
<?php
/**
* @file
* Contains install and update functions for Automatic Updates.

Lucas Hedding
committed
*/
use Drupal\automatic_updates\Validation\StatusCheckRequirements;

Lucas Hedding
committed
/**
* Implements hook_uninstall().
*/
function automatic_updates_uninstall() {
\Drupal::service('automatic_updates.updater')->destroy(TRUE);
}

Lucas Hedding
committed
/**
* Implements hook_requirements().

Lucas Hedding
committed
*/
function automatic_updates_requirements($phase) {

Ted Bowman
committed
if ($phase === 'runtime') {
// Check that site is ready to perform automatic updates.
/** @var \Drupal\automatic_updates\Validation\StatusCheckRequirements $status_check_requirement */
$status_check_requirement = \Drupal::classResolver(StatusCheckRequirements::class);
return $status_check_requirement->getRequirements();

Ted Bowman
committed
}

Lucas Hedding
committed
}
/**
* Stores cached readiness check results under a new key.
*/
function automatic_updates_update_9001(): void {
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value */
$key_value = \Drupal::service('keyvalue.expirable')
->get('automatic_updates');
$key_value->rename('readiness_validation_last_run', 'status_check_last_run');
$key_value->rename('readiness_check_timestamp', 'status_check_timestamp');
}