Skip to content
Snippets Groups Projects
automatic_updates.install 1.64 KiB
Newer Older
  • Learn to ignore specific revisions
  •  * Contains install and update functions for Automatic Updates.
    
    use Drupal\automatic_updates\CronUpdateStage;
    
    use Drupal\automatic_updates\Validation\StatusCheckRequirements;
    
    /**
     * Implements hook_uninstall().
     */
    function automatic_updates_uninstall() {
    
      \Drupal::service('automatic_updates.update_stage')->destroy(TRUE);
    
    function automatic_updates_requirements($phase) {
    
        // 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
    
        if (\Drupal::configFactory()->get('automatic_updates.settings')->get('cron') !== 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;
    
    // 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