Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Maintenance Class Reference
Inheritance diagram for Maintenance:

Public Member Functions

 __construct (MaintenanceMode $maintenanceMode)
 
 indexAction ()
 

Detailed Description

Definition at line 13 of file Maintenance.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( MaintenanceMode  $maintenanceMode)

Constructor

Parameters
MaintenanceMode$maintenanceMode

Definition at line 27 of file Maintenance.php.

28  {
29  $this->maintenanceMode = $maintenanceMode;
30  }

Member Function Documentation

◆ indexAction()

indexAction ( )

Puts store in maintenance mode

Returns
JsonModel

Definition at line 37 of file Maintenance.php.

38  {
39  try {
40  $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
41  $action = isset($params['disable']) && $params['disable'] ? false : true;
42  $this->maintenanceMode->set($action);
43  return new JsonModel(['responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS]);
44  } catch (\Exception $e) {
45  return new JsonModel(
46  [
48  'error' => $e->getMessage()
49  ]
50  );
51  }
52  }
return false
Definition: gallery.phtml:36
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18

The documentation for this class was generated from the following file: