|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / update / app / code / Magento / Update / |
Filename | /home/dev2.destoffenstraat.com/update/app/code/Magento/Update/MaintenanceMode.php |
Size | 2.35 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 06-Apr-2021 18:06 |
Last accessed | 23-Aug-2025 03:55 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Update;
use Magento\Update\Status;
/**
* Class for handling Magento maintenance mode.
*/
class MaintenanceMode
{
/**
* Path to the maintenance flag file
*
* @var string
*/
protected $flagFile;
/**
* Path to the file with white-listed IP addresses
*
* @var string
*/
protected $ipFile;
/**
* @var Status
*/
protected $status;
/**
* Initialize.
*
* @param string|null $flagFile
* @param string|null $ipFile
* @param Status|null $status
*/
public function __construct($flagFile = null, $ipFile = null, Status $status = null)
{
$this->flagFile = $flagFile ? $flagFile : MAGENTO_BP . '/var/.maintenance.flag';
$this->ipFile = $ipFile ? $ipFile : MAGENTO_BP . '/var/.maintenance.ip';
$this->status = $status ? $status : new Status();
}
/**
* Check whether Magento maintenance mode is on.
*
* @return bool
*/
public function isOn()
{
return file_exists($this->flagFile);
}
/**
* Set maintenance mode.
*
* @param bool $isOn
* @return $this
* @throws \RuntimeException
*/
public function set($isOn)
{
if ($isOn) {
if (touch($this->flagFile)) {
$this->status->add("Magento maintenance mode is enabled.", \Psr\Log\LogLevel::INFO);
} else {
throw new \RuntimeException("Magento maintenance mode cannot be enabled.");
}
} else if (file_exists($this->flagFile)) {
if (file_exists($this->ipFile)) {
/** Maintenance mode should not be unset from updater application if it was set manually by the admin */
$this->status->add(
"Magento maintenance mode was not disabled. It can be disabled from the Magento Backend.",
\Psr\Log\LogLevel::INFO
);
} else if (unlink($this->flagFile)) {
$this->status->add("Magento maintenance mode is disabled.", \Psr\Log\LogLevel::INFO);
} else {
throw new \RuntimeException("Magento maintenance mode cannot be disabled.");
}
}
return $this;
}
}
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Update;
use Magento\Update\Status;
/**
* Class for handling Magento maintenance mode.
*/
class MaintenanceMode
{
/**
* Path to the maintenance flag file
*
* @var string
*/
protected $flagFile;
/**
* Path to the file with white-listed IP addresses
*
* @var string
*/
protected $ipFile;
/**
* @var Status
*/
protected $status;
/**
* Initialize.
*
* @param string|null $flagFile
* @param string|null $ipFile
* @param Status|null $status
*/
public function __construct($flagFile = null, $ipFile = null, Status $status = null)
{
$this->flagFile = $flagFile ? $flagFile : MAGENTO_BP . '/var/.maintenance.flag';
$this->ipFile = $ipFile ? $ipFile : MAGENTO_BP . '/var/.maintenance.ip';
$this->status = $status ? $status : new Status();
}
/**
* Check whether Magento maintenance mode is on.
*
* @return bool
*/
public function isOn()
{
return file_exists($this->flagFile);
}
/**
* Set maintenance mode.
*
* @param bool $isOn
* @return $this
* @throws \RuntimeException
*/
public function set($isOn)
{
if ($isOn) {
if (touch($this->flagFile)) {
$this->status->add("Magento maintenance mode is enabled.", \Psr\Log\LogLevel::INFO);
} else {
throw new \RuntimeException("Magento maintenance mode cannot be enabled.");
}
} else if (file_exists($this->flagFile)) {
if (file_exists($this->ipFile)) {
/** Maintenance mode should not be unset from updater application if it was set manually by the admin */
$this->status->add(
"Magento maintenance mode was not disabled. It can be disabled from the Magento Backend.",
\Psr\Log\LogLevel::INFO
);
} else if (unlink($this->flagFile)) {
$this->status->add("Magento maintenance mode is disabled.", \Psr\Log\LogLevel::INFO);
} else {
throw new \RuntimeException("Magento maintenance mode cannot be disabled.");
}
}
return $this;
}
}