public function handleMaintenanceMode()
    {
        // Authorize logged in admins on the fly
        if ($this->doesCurrentUserHaveAccess())
        {
            return true;
        }

        if (Craft::$app->request->isSiteRequest && $this->settings->maintenanceModeEnabled)
        {
            $requestingIp   = $this->getRequestingIp();
            $authorizedIps  = $this->settings->maintenanceModeAuthorizedIps;
            $maintenanceUrl = $this->settings->maintenanceModePageUrl;

            if ($maintenanceUrl == Craft::$app->request->getUrl())
            {
                return true;
            }

            if (empty($authorizedIps))
            {
                $this->forceRedirect($maintenanceUrl);
            }

            if (is_array($authorizedIps) && count($authorizedIps))
            {
                if (in_array($requestingIp, $authorizedIps))
                {
                    return true;
                }

                foreach ($authorizedIps as $authorizedIp)
                {
                    $authorizedIp = str_replace('*', '', $authorizedIp);

                    if (stripos($requestingIp, $authorizedIp) === 0)
                    {
                        return true;
                    }
                }

                $this->forceRedirect($maintenanceUrl);
            }
        }
    }
public function handleMaintenanceMode()
    {
        // Authorize logged in admins on the fly
        if ($this->doesCurrentUserHaveAccess())
        {
            return true;
        }

        if (Craft::$app->request->isSiteRequest && $this->settings->maintenanceModeEnabled)
        {
            $requestingIp   = $this->getRequestingIp();
            $authorizedIps  = $this->settings->maintenanceModeAuthorizedIps;
            $maintenanceUrl = $this->settings->maintenanceModePageUrl;

            if ($maintenanceUrl == Craft::$app->request->getUrl())
            {
                return true;
            }

            if (empty($authorizedIps))
            {
                $this->forceRedirect($maintenanceUrl);
            }

            if (is_array($authorizedIps) && count($authorizedIps))
            {
                if (in_array($requestingIp, $authorizedIps))
                {
                    return true;
                }

                foreach ($authorizedIps as $authorizedIp)
                {
                    $authorizedIp = str_replace('*', '', $authorizedIp);

                    if (stripos($requestingIp, $authorizedIp) === 0)
                    {
                        return true;
                    }
                }

                $this->forceRedirect($maintenanceUrl);
            }
        }
    }
public function handleMaintenanceMode ( ) { // Authorize logged in admins on the fly if ( $ this -> doesCurrentUserHaveAccess ( ) ) { return true ; } if ( Craft :: $ app -> request -> isSiteRequest && $ this -> settings -> maintenanceModeEnabled ) { $ requestingIp = $ this -> getRequestingIp ( ) ; $ authorizedIps = $ this -> settings -> maintenanceModeAuthorizedIps ; $ maintenanceUrl = $ this -> settings -> maintenanceModePageUrl ; if ( $ maintenanceUrl == Craft :: $ app -> request -> getUrl ( ) ) { return true ; } if ( empty ( $ authorizedIps ) ) { $ this -> forceRedirect ( $ maintenanceUrl ) ; } if ( is_array ( $ authorizedIps ) && count ( $ authorizedIps ) ) { if ( in_array ( $ requestingIp , $ authorizedIps ) ) { return true ; } foreach ( $ authorizedIps as $ authorizedIp ) { $ authorizedIp = str_replace ( '*' , '' , $ authorizedIp ) ; if ( stripos ( $ requestingIp , $ authorizedIp ) === 0 ) { return true ; } } $ this -> forceRedirect ( $ maintenanceUrl ) ; } } }
Restricts accessed based on authorizedIps

@return bool

@throws HttpException
@throws \yii\base\InvalidConfigException
Restricts accessed based on authorizedIps