public function create($rootPageId, $setHost = false)
    {
        if (!is_object($GLOBALS['TT'])) {
            $GLOBALS['TT'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker');
            $GLOBALS['TT']->start();
        }

        $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
            'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController',
            $GLOBALS['TYPO3_CONF_VARS'],
            $rootPageId,
            0
        );

        $GLOBALS['TSFE']->initFEuser();
        $GLOBALS['TSFE']->determineId();
        $GLOBALS['TSFE']->getPageAndRootline();
        $GLOBALS['TSFE']->initTemplate();
        $GLOBALS['TSFE']->getConfigArray();
        $GLOBALS['TSFE']->newCObj();

        if ($setHost) {
            $domains = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                'domainName',
                'sys_domain',
                'hidden = 0 AND pid = "' . $rootPageId . '"'
            );

            if (count($domains)) {
                $_SERVER['HTTP_HOST'] = $domains[0]['domainName'];
            }
        }
    }