You are here

class MaintenanceModeDisactivate in Automatic Updates 8

Remove site from maintenance mode.

Plugin annotation


@DatabaseUpdateHandler(
  id = "maintenance_mode_disactivate",
  label = "Remove site from maintenance mode",
)

Hierarchy

Expanded class hierarchy of MaintenanceModeDisactivate

File

src/Plugin/DatabaseUpdateHandler/MaintenanceModeDisactivate.php, line 19

Namespace

Drupal\automatic_updates\Plugin\DatabaseUpdateHandler
View source
class MaintenanceModeDisactivate extends DatabaseUpdateHandlerPluginBase implements ContainerFactoryPluginInterface {

  /**
   * The state.
   *
   * @var \Drupal\Core\State\StateInterface
   */
  protected $state;

  /**
   * The logger.
   *
   * @var \Psr\Log\LoggerInterface
   */
  protected $logger;

  /**
   * Constructs a new maintenance mode service.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\State\StateInterface $state
   *   The state.
   * @param \Psr\Log\LoggerInterface $logger
   *   The 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;
  }

  /**
   * {@inheritdoc}
   */
  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'));
  }

  /**
   * {@inheritdoc}
   */
  public function execute() {
    $this->logger
      ->notice('Maintenance mode dis-activated.');
    $this->state
      ->set('system.maintenance_mode', FALSE);
    return TRUE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DatabaseUpdateHandlerPluginBase::label public function Returns the translated plugin label. Overrides DatabaseUpdateHandlerInterface::label
MaintenanceModeDisactivate::$logger protected property The logger.
MaintenanceModeDisactivate::$state protected property The state.
MaintenanceModeDisactivate::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
MaintenanceModeDisactivate::execute public function Handle database updates. Overrides DatabaseUpdateHandlerInterface::execute
MaintenanceModeDisactivate::__construct public function Constructs a new maintenance mode service. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.