Пример #1
0
 /**
  * @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
0
 /**
  * @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;
     }
 }