本文整理匯總了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;
}
}