MaintenanceModeDisactivate.php in Automatic Updates 8
File
src/Plugin/DatabaseUpdateHandler/MaintenanceModeDisactivate.php
View source
<?php
namespace Drupal\automatic_updates\Plugin\DatabaseUpdateHandler;
use Drupal\automatic_updates\DatabaseUpdateHandlerPluginBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\State\StateInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class MaintenanceModeDisactivate extends DatabaseUpdateHandlerPluginBase implements ContainerFactoryPluginInterface {
protected $state;
protected $logger;
public function __construct(array $configuration, $plugin_id, $plugin_definition, StateInterface $state, LoggerInterface $logger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->state = $state;
$this->logger = $logger;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('state'), $container
->get('logger.channel.automatic_updates'));
}
public function execute() {
$this->logger
->notice('Maintenance mode dis-activated.');
$this->state
->set('system.maintenance_mode', FALSE);
return TRUE;
}
}