Source of file MaintenancePage.php
Size: 1,310 Bytes - Last Modified: 2022-02-21T10:00:47+00:00
/var/www/docs.ssmods.com/process/src/src/MaintenancePage.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 | <?php use SilverStripe\Security\PermissionProvider; use SilverStripe\Security\Permission; use SilverStripe\CMS\Controllers\ContentController; use SilverStripe\ErrorPage\ErrorPage; class MaintenancePage extends ErrorPage { private static $allowed_children = array("none"); private static $description = "Maintenance page"; public function canCreate($member = null, $context = null) { return !MaintenancePage::get()->exists(); } } class MaintenancePageController extends ContentController implements PermissionProvider { private static $url_handlers = array( '*' => 'index' ); private static $allowed_actions = array(); public function init() { parent::init(); } public function index() { $config = $this->SiteConfig(); if (!$config->MaintenanceMode && !Permission::check('ADMIN')) { return $this->redirect(BASE_URL); //redirect to home page } $this->response->setStatusCode($this->ErrorCode); if ($this->dataRecord->RenderingTemplate) { return $this->renderWith(array($this->dataRecord->RenderingTemplate)); } return $this->renderWith(array('MaintenancePage', 'Page')); } public function providePermissions() { return array( 'MAINTENANCE_PAGE_VIEW_SITE' => _t('MaintenancePage.PERMISSION_ADMIN',"Access to the website while maintenance") ); } } |