Elgg\Application::run PHP Method

run() public method

Routes the request, booting core if not yet booted
public run ( ) : boolean
return boolean False if Elgg wants the PHP CLI server to handle the request
    public function run()
    {
        $path = $this->setupPath();
        // allow testing from the upgrade page before the site is upgraded.
        if (isset($_GET[self::REWRITE_TEST_TOKEN])) {
            if (false !== strpos($path, self::REWRITE_TEST_TOKEN)) {
                echo self::REWRITE_TEST_OUTPUT;
            }
            return true;
        }
        if (php_sapi_name() === 'cli-server') {
            $www_root = "http://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}/";
            $this->services->config->set('wwwroot', $www_root);
        }
        if (0 === strpos($path, '/cache/')) {
            (new Application\CacheHandler($this, $this->services->config, $_SERVER))->handleRequest($path);
            return true;
        }
        if (0 === strpos($path, '/serve-file/')) {
            $this->services->serveFileHandler->getResponse($this->services->request)->send();
            return true;
        }
        if ($path === '/rewrite.php') {
            require Directory\Local::root()->getPath("install.php");
            return true;
        }
        if (php_sapi_name() === 'cli-server') {
            // The CLI server routes ALL requests here (even existing files), so we have to check for these.
            if ($path !== '/' && Directory\Local::root()->isFile($path)) {
                // serve the requested resource as-is.
                return false;
            }
        }
        $this->bootCore();
        // TODO use formal Response object instead
        header("Content-Type: text/html;charset=utf-8");
        if (!$this->services->router->route($this->services->request)) {
            forward('', '404');
        }
    }