protected function schemaCheck(GetResponseEvent $event)
    {
        $session = $event->getRequest()->getSession();
        $validSession = $session->isStarted() && $session->get('authentication');
        $expired = $this->schemaManager->isCheckRequired();

        // Don't show the check if we're in the dbcheck already.
        $notInCheck = !in_array(
            $event->getRequest()->get('_route'),
            ['dbupdate', '_wdt']
        );

        if ($validSession && $expired && $this->schemaManager->isUpdateRequired() && $notInCheck) {
            $msg = sprintf(
                '%s > \'<a href="%s">%s</a>\' %s',
                Trans::__('general.phrase.database-update-required-pre'),
                $this->urlGenerator->generate('dbcheck'),
                Trans::__('general.phrase.database-check'),
                Trans::__('general.phrase.database-update-required-post')
            );
            $this->loggerFlash->error($msg);
        }
    }