src/EventListener/ConfigurationNoticesListener.php
protected function liveCheck(Request $request)
    {
        if (!$this->app['debug']) {
            return;
        }

        $host = parse_url($request->getSchemeAndHttpHost());

        // If we have an IP-address, we assume it's "dev"
        if (filter_var($host['host'], FILTER_VALIDATE_IP) !== false) {
            return;
        }

        $domainPartials = (array) $this->app['config']->get('general/debug_local_domains', []);

        $domainPartials = array_unique(array_merge(
            (array) $domainPartials,
            $this->defaultDomainPartials
        ));

        foreach ($domainPartials as $partial) {
            if (strpos($host['host'], $partial) !== false) {
                return;
            }
        }

        $notice = json_encode([
            'severity' => 2,
            'notice'   => "It seems like this website is running on a <strong>non-development environment</strong>, while 'debug' is enabled. Make sure debug is disabled in production environments. If you don't do this, it will result in an extremely large <code>app/cache</code> folder and a measurable reduced performance across all pages.",
            'info'     => "If you wish to hide this message, add a key to your <code>config.yml</code> with a (partial) domain name in it, that should be seen as a development environment: <code>debug_local_domains: [ '.foo' ]</code>.",
        ]);

        $this->app['logger.flash']->configuration($notice);
    }
protected function liveCheck(Request $request)
    {
        if (!$this->app['debug']) {
            return;
        }

        $host = parse_url($request->getSchemeAndHttpHost());

        // If we have an IP-address, we assume it's "dev"
        if (filter_var($host['host'], FILTER_VALIDATE_IP) !== false) {
            return;
        }

        $domainPartials = (array) $this->app['config']->get('general/debug_local_domains', []);

        $domainPartials = array_unique(array_merge(
            (array) $domainPartials,
            $this->defaultDomainPartials
        ));

        foreach ($domainPartials as $partial) {
            if (strpos($host['host'], $partial) !== false) {
                return;
            }
        }

        $notice = json_encode([
            'severity' => 2,
            'notice'   => "It seems like this website is running on a <strong>non-development environment</strong>, while 'debug' is enabled. Make sure debug is disabled in production environments. If you don't do this, it will result in an extremely large <code>app/cache</code> folder and a measurable reduced performance across all pages.",
            'info'     => "If you wish to hide this message, add a key to your <code>config.yml</code> with a (partial) domain name in it, that should be seen as a development environment: <code>debug_local_domains: [ '.foo' ]</code>.",
        ]);

        $this->app['logger.flash']->configuration($notice);
    }
protected function liveCheck ( Request $ request ) { if ( ! $ this -> app [ 'debug' ] ) { return ; } $ host = parse_url ( $ request -> getSchemeAndHttpHost ( ) ) ; // If we have an IP-address, we assume it's "dev" if ( filter_var ( $ host [ 'host' ] , FILTER_VALIDATE_IP ) !== false ) { return ; } $ domainPartials = ( array ) $ this -> app [ 'config' ] -> get ( 'general/debug_local_domains' , [ ] ) ; $ domainPartials = array_unique ( array_merge ( ( array ) $ domainPartials , $ this -> defaultDomainPartials ) ) ; foreach ( $ domainPartials as $ partial ) { if ( strpos ( $ host [ 'host' ] , $ partial ) !== false ) { return ; } } $ notice = json_encode ( [ 'severity' => 2 , 'notice' => "It seems like this website is running on a <strong>non-development environment</strong>, while 'debug' is enabled. Make sure debug is disabled in production environments. If you don't do this, it will result in an extremely large <code>app/cache</code> folder and a measurable reduced performance across all pages." , 'info' => "If you wish to hide this message, add a key to your <code>config.yml</code> with a (partial) domain name in it, that should be seen as a development environment: <code>debug_local_domains: [ '.foo' ]</code>." , ] ) ; $ this -> app [ 'logger.flash' ] -> configuration ( $ notice ) ; }
Check whether the site is live or not.
Check whether the site is live or not .