本文整理汇总了PHP中Pimcore\Tool\Admin::getMaintenanceModeFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::getMaintenanceModeFile方法的具体用法?PHP Admin::getMaintenanceModeFile怎么用?PHP Admin::getMaintenanceModeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Tool\Admin
的用法示例。
在下文中一共展示了Admin::getMaintenanceModeFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: routeStartup
/**
* @param \Zend_Controller_Request_Abstract $request
*/
public function routeStartup(\Zend_Controller_Request_Abstract $request)
{
$maintenance = false;
$file = \Pimcore\Tool\Admin::getMaintenanceModeFile();
if (is_file($file)) {
$conf = (include $file);
if (isset($conf["sessionId"])) {
if ($conf["sessionId"] != $_COOKIE["pimcore_admin_sid"]) {
$maintenance = true;
}
} else {
@unlink($file);
}
}
// do not activate the maintenance for the server itself
// this is to avoid problems with monitoring agents
$serverIps = ["127.0.0.1"];
if ($maintenance && !in_array(\Pimcore\Tool::getClientIp(), $serverIps)) {
header("HTTP/1.1 503 Service Temporarily Unavailable", 503);
$file = PIMCORE_PATH . "/static/html/maintenance.html";
$customFile = PIMCORE_CUSTOM_CONFIGURATION_DIRECTORY . "/maintenance.html";
if (file_exists($customFile)) {
$file = $customFile;
}
echo file_get_contents($file);
exit;
}
}
示例2: routeStartup
/**
* @param \Zend_Controller_Request_Abstract $request
*/
public function routeStartup(\Zend_Controller_Request_Abstract $request)
{
$maintenance = false;
$file = \Pimcore\Tool\Admin::getMaintenanceModeFile();
if (is_file($file)) {
$conf = new \Zend_Config_Xml($file);
if ($conf->sessionId) {
if ($conf->sessionId != $_COOKIE["pimcore_admin_sid"]) {
$maintenance = true;
}
} else {
@unlink($file);
}
}
// do not activate the maintenance for the server itself
// this is to avoid problems with monitoring agents
$serverIps = array("127.0.0.1");
if ($maintenance && !in_array(\Pimcore\Tool::getClientIp(), $serverIps)) {
header("HTTP/1.1 503 Service Temporarily Unavailable", 503);
echo file_get_contents(PIMCORE_PATH . "/static/html/maintenance.html");
exit;
}
}