Newer
Older

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

Lucas Hedding
committed
*/

omkar podey
committed
declare(strict_types = 1);

Kunal Sachdev
committed
use Drupal\automatic_updates\CronUpdateStage;
use Drupal\automatic_updates\Validation\StatusCheckRequirements;
use Drupal\system\SystemManager;

Lucas Hedding
committed
/**
* Implements hook_uninstall().
*/
function automatic_updates_uninstall() {

Kunal Sachdev
committed
\Drupal::service('automatic_updates.update_stage')->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);
$requirements = $status_check_requirement->getRequirements();
// Check that site has cron updates enabled or not.
// @todo Remove in https://www.drupal.org/project/automatic_updates/issues/3284443

Adam G-H
committed
if (\Drupal::configFactory()->get('automatic_updates.settings')->get('unattended.level') !== CronUpdateStage::DISABLED) {
$requirements['automatic_updates_cron'] = [
'title' => t('Cron installs updates automatically'),
'severity' => SystemManager::REQUIREMENT_WARNING,
'value' => t('Enabled. This is NOT an officially supported feature of the Automatic Updates module at this time. Use at your own risk.'),
];
}
return $requirements;

Ted Bowman
committed
}

Lucas Hedding
committed
}
// BEGIN: DELETE FROM CORE MERGE REQUEST
/**
* Implements hook_update_last_removed().
*/
function automatic_updates_update_last_removed(): int {
return 9002;
}
// END: DELETE FROM CORE MERGE REQUEST