From c5554a378e80a830bb6a917d6b5eae2c67949fd3 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Thu, 16 Feb 2017 13:18:20 +0100 Subject: [PATCH] [TASK] Deprecate TSFE-related properties and methods There are some methods and properties which are conceptually in the wrong place or are outdated. $TSFE->compensateFieldWith (and config.compensateFieldWidth) are not in use anymore (since TYPO3 7), as this belonged to the very very old FORM cObject. $TSFE->excludeCHashVars was superseeded with cHash calculation in v6, but never removed. $TSFE->scriptParseTime (and $TSFE->setParseTime()) is a public property and solely there for one use, storing the calculated time between the request start and end. This does not need to be located inside TSFE, as the functionality can be the same, but built in the request handler, removing a cross-dependency. $TSFE->generatePage_whichScript() This alternative method to be used for including raw PHP include files via requireOnce and config.pageGenScript dates back to the plain PHP files index_ts.php and pagegen.php which can safely be marked as outdated now via better PHP class abstraction and hooks. The overall goal is to achieve better separation of concerns, and thus TSFE should only contain what it needs (dealing with rendering a page based on TypoScript settings). PageGenerator:: pagegenInit() Unlike the other methods in PageGenerator this method has one simple job: Setting $TSFE public properties based on TypoScript settings. This surely needs to be merged into TSFE, as this is one of the core jobs of TSFE. It also helps to avoid very unsuccessful attempts to override certain parts of the Frontend Request as the static calls to PageGenerator cannot be overriden at all. TSFE->encryptCharcode and TSFE->encryptEmail() Both are only needed in ContentObejctRenderer and are there moved as protected methods and used solely there. Resolves: #79858 Releases: master Change-Id: Iabd351a0b5fd7c8cc242f66ba1e9799377fb9390 Reviewed-on: https://review.typo3.org/51717 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Susanne Moog <susanne.moog@typo3.org> Tested-by: Susanne Moog <susanne.moog@typo3.org> --- ...79858-TSFE-relatedPropertiesAndMethods.rst | 71 ++++++++ .../ContentObject/ContentObjectRenderer.php | 117 ++++++++++-- .../TypoScriptFrontendController.php | 169 ++++++++++++++++++ .../frontend/Classes/Http/RequestHandler.php | 43 +++-- .../frontend/Classes/Page/PageGenerator.php | 8 +- 5 files changed, 380 insertions(+), 28 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-79858-TSFE-relatedPropertiesAndMethods.rst diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-79858-TSFE-relatedPropertiesAndMethods.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-79858-TSFE-relatedPropertiesAndMethods.rst new file mode 100644 index 000000000000..7d2ec9d024f4 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-79858-TSFE-relatedPropertiesAndMethods.rst @@ -0,0 +1,71 @@ +.. include:: ../../Includes.txt + +========================================================= +Deprecation: #79858 - TSFE-related properties and methods +========================================================= + +See :issue:`79858` + +Description +=========== + +The following properties within TypoScriptFrontendController have been marked as deprecated: + +`$compensateFieldWidth` +`$excludeCHashVars` +`$scriptParseTime` + +The following methods have been marked as deprecated: + +`TypoScriptFrontendController->generatePage_whichScript()` (used via :ts:`config.pageGenScript`) +`TypoScriptFrontendController->encryptEmail()` +`TypoScriptFrontendController->encryptCharcode()` +`PageGenerator::pagegenInit()` + +The following TypoScript properties have been marked as deprecated: + +`config.pageGenScript` +`config.compensateFieldWidth` + + +Impact +====== + +Calling any of the PHP methods will trigger a deprecation log entry. + +All properties and options are still callable with the according output, however there are +alternatives to achieve the same. + + +Affected Installations +====================== + +Any TYPO3 installation working with custom extensions that use any of these functionalities, methods +or properties. + + +Migration +========= + +All of the functionality is obsolete or outdated and should be handled differently from now on: + +1. The `compensateFieldWidth` option was used for forms built with TYPO3 4.x (before TYPO3 4.6), +instead, any other form framework should be used for forms and for field width calculations, where +styling of form fields are also handled via CSS. + +2. An alternative `config.pageGenScript` can be used and set via hooks in PHP classes nowadays and +executed, instead of configuring this functionality on a high-end TypoScript level to execute include +spaghetti PHP code within a file. + +3. `PageGenerator::pagegenInit()` is solely working on public properties of the TSFE PHP class, which +belongs to the TSFE object itself (thus, the logic is copied to `$TSFE->preparePageContentGeneration()`) + +4. Calculating the debug parse time for the web page is not part of the controller logic but more +certainly belongs to the request handling itself, where it is handled in a cleaner way for PHP, +waiting for further refactorings in TYPO3 v9. + +5. The methods `TypoScriptFrontendController->encryptEmail()` and `encryptCharcode()` have been moved +to ContentObjectRenderer. + + +.. index:: Frontend, TypoScript \ No newline at end of file diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 82e19002ec69..9beda03eb6cc 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -6450,20 +6450,16 @@ class ContentObjectRenderer $originalMailToUrl = 'mailto:' . $mailAddress; $mailToUrl = $this->processUrl(UrlProcessorInterface::CONTEXT_MAIL, $originalMailToUrl); - $tsfe = $this->getTypoScriptFrontendController(); - // no processing happened, therefore + // no processing happened, therefore, the default processing kicks in if ($mailToUrl === $originalMailToUrl) { + $tsfe = $this->getTypoScriptFrontendController(); if ($tsfe->spamProtectEmailAddresses) { - if ($tsfe->spamProtectEmailAddresses === 'ascii') { - $mailToUrl = $tsfe->encryptEmail($mailToUrl); - } else { - $mailToUrl = 'javascript:linkTo_UnCryptMailto(' . GeneralUtility::quoteJSvalue($tsfe->encryptEmail($mailToUrl)) . ');'; + $mailToUrl = $this->encryptEmail($mailToUrl, $tsfe->spamProtectEmailAddresses); + if ($tsfe->spamProtectEmailAddresses !== 'ascii') { + $mailToUrl = 'javascript:linkTo_UnCryptMailto(' . GeneralUtility::quoteJSvalue($mailToUrl) . ');'; } - $atLabel = ''; - if ($tsfe->config['config']['spamProtectEmailAddresses_atSubst']) { - $atLabel = trim($tsfe->config['config']['spamProtectEmailAddresses_atSubst']); - } - $spamProtectedMailAddress = str_replace('@', $atLabel ? $atLabel : '(at)', htmlspecialchars($mailAddress)); + $atLabel = trim($tsfe->config['config']['spamProtectEmailAddresses_atSubst']) ?: '(at)'; + $spamProtectedMailAddress = str_replace('@', $atLabel, htmlspecialchars($mailAddress)); if ($tsfe->config['config']['spamProtectEmailAddresses_lastDotSubst']) { $lastDotLabel = trim($tsfe->config['config']['spamProtectEmailAddresses_lastDotSubst']); $lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)'; @@ -6476,6 +6472,105 @@ class ContentObjectRenderer return [$mailToUrl, $linktxt]; } + /** + * Encryption of email addresses for <A>-tags See the spam protection setup in TS 'config.' + * + * @param string $string Input string to en/decode: "mailto:blabla@bla.com + * @param mixed $type - either "ascii" or a number between -10 and 10, taken from config.spamProtectEmailAddresses + * @return string encoded version of $string + */ + protected function encryptEmail($string, $type) + { + $out = ''; + // obfuscates using the decimal HTML entity references for each character + if ($type === 'ascii') { + $stringLength = strlen($string); + for ($a = 0; $a < $stringLength; $a++) { + $out .= '&#' . ord(substr($string, $a, 1)) . ';'; + } + } else { + // like str_rot13() but with a variable offset and a wider character range + $len = strlen($string); + $offset = (int)$type; + for ($i = 0; $i < $len; $i++) { + $charValue = ord($string[$i]); + // 0-9 . , - + / : + if ($charValue >= 43 && $charValue <= 58) { + $out .= $this->encryptCharcode($charValue, 43, 58, $offset); + } elseif ($charValue >= 64 && $charValue <= 90) { + // A-Z @ + $out .= $this->encryptCharcode($charValue, 64, 90, $offset); + } elseif ($charValue >= 97 && $charValue <= 122) { + // a-z + $out .= $this->encryptCharcode($charValue, 97, 122, $offset); + } else { + $out .= $string[$i]; + } + } + } + return $out; + } + + /** + * Decryption of email addresses for <A>-tags See the spam protection setup in TS 'config.' + * + * @param string $string Input string to en/decode: "mailto:blabla@bla.com + * @param mixed $type - either "ascii" or a number between -10 and 10 taken from config.spamProtectEmailAddresses + * @return string decoded version of $string + */ + protected function decryptEmail($string, $type) + { + $out = ''; + // obfuscates using the decimal HTML entity references for each character + if ($type === 'ascii') { + $stringLength = strlen($string); + for ($a = 0; $a < $stringLength; $a++) { + $out .= '&#' . ord(substr($string, $a, 1)) . ';'; + } + } else { + // like str_rot13() but with a variable offset and a wider character range + $len = strlen($string); + $offset = (int)$type * -1; + for ($i = 0; $i < $len; $i++) { + $charValue = ord($string[$i]); + // 0-9 . , - + / : + if ($charValue >= 43 && $charValue <= 58) { + $out .= $this->encryptCharcode($charValue, 43, 58, $offset); + } elseif ($charValue >= 64 && $charValue <= 90) { + // A-Z @ + $out .= $this->encryptCharcode($charValue, 64, 90, $offset); + } elseif ($charValue >= 97 && $charValue <= 122) { + // a-z + $out .= $this->encryptCharcode($charValue, 97, 122, $offset); + } else { + $out .= $string[$i]; + } + } + } + return $out; + } + + /** + * Encryption (or decryption) of a single character. + * Within the given range the character is shifted with the supplied offset. + * + * @param int $n Ordinal of input character + * @param int $start Start of range + * @param int $end End of range + * @param int $offset Offset + * @return string encoded/decoded version of character + */ + protected function encryptCharcode($n, $start, $end, $offset) + { + $n = $n + $offset; + if ($offset > 0 && $n > $end) { + $n = $start + ($n - $end - 1); + } elseif ($offset < 0 && $n < $start) { + $n = $end - ($start - $n - 1); + } + return chr($n); + } + /** * Gets the query arguments and assembles them for URLs. * Arguments may be removed or set, depending on configuration. diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index caff67f60eda..cc5ccf59fa7f 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -488,6 +488,7 @@ class TypoScriptFrontendController /** * Factor for form-field widths compensation + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9 * @var string */ public $compensateFieldWidth = ''; @@ -531,6 +532,7 @@ class TypoScriptFrontendController * A string set with a comma list of additional GET vars which should NOT be * included in the cHash calculation. These vars should otherwise be detected * and involved in caching, eg. through a condition in TypoScript. + * @deprecatd since TYPO3 v8, will be removed in TYPO3 v9, this is taken care of via TYPO3_CONF_VARS nowadays * @var string */ public $excludeCHashVars = ''; @@ -703,6 +705,7 @@ class TypoScriptFrontendController /** * @var int + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, use the calculations in setParseTime() directly */ public $scriptParseTime = 0; @@ -3230,15 +3233,175 @@ class TypoScriptFrontendController $this->no_cacheBeforePageGen = $this->no_cache; } + /** + * Previously located in static method in PageGenerator::init. Is solely used to set up TypoScript + * config. options and set properties in $TSFE for that. + */ + public function preparePageContentGeneration() + { + if ($this->page['content_from_pid'] > 0) { + // make REAL copy of TSFE object - not reference! + $temp_copy_TSFE = clone $this; + // Set ->id to the content_from_pid value - we are going to evaluate this pid as was it a given id for a page-display! + $temp_copy_TSFE->id = $this->page['content_from_pid']; + $temp_copy_TSFE->MP = ''; + $temp_copy_TSFE->getPageAndRootlineWithDomain($this->config['config']['content_from_pid_allowOutsideDomain'] ? 0 : $this->domainStartPage); + $this->contentPid = (int)$temp_copy_TSFE->id; + unset($temp_copy_TSFE); + } + if ($this->config['config']['MP_defaults']) { + $temp_parts = GeneralUtility::trimExplode('|', $this->config['config']['MP_defaults'], true); + foreach ($temp_parts as $temp_p) { + list($temp_idP, $temp_MPp) = explode(':', $temp_p, 2); + $temp_ids = GeneralUtility::intExplode(',', $temp_idP); + foreach ($temp_ids as $temp_id) { + $this->MP_defaults[$temp_id] = $temp_MPp; + } + } + } + // Global vars... + $this->indexedDocTitle = $this->page['title']; + $this->debug = !empty($this->config['config']['debug']); + // Base url: + if (isset($this->config['config']['baseURL'])) { + $this->baseUrl = $this->config['config']['baseURL']; + } + // Internal and External target defaults + $this->intTarget = '' . $this->config['config']['intTarget']; + $this->extTarget = '' . $this->config['config']['extTarget']; + $this->fileTarget = '' . $this->config['config']['fileTarget']; + if ($this->config['config']['spamProtectEmailAddresses'] === 'ascii') { + $this->spamProtectEmailAddresses = 'ascii'; + } else { + $this->spamProtectEmailAddresses = MathUtility::forceIntegerInRange($this->config['config']['spamProtectEmailAddresses'], -10, 10, 0); + } + // calculate the absolute path prefix + if (!empty($this->config['config']['absRefPrefix'])) { + $absRefPrefix = trim($this->config['config']['absRefPrefix']); + if ($absRefPrefix === 'auto') { + $this->absRefPrefix = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'); + } else { + $this->absRefPrefix = $absRefPrefix; + } + } else { + $this->absRefPrefix = ''; + } + if ($this->type && $this->config['config']['frameReloadIfNotInFrameset']) { + $this->logDeprecatedTyposcript( + 'config.frameReloadIfNotInFrameset', + 'frameReloadIfNotInFrameset has been marked as deprecated since TYPO3 v8, ' . + 'and will be removed in TYPO3 v9.' + ); + $tdlLD = $this->tmpl->linkData($this->page, '_top', $this->no_cache, ''); + $this->additionalJavaScript['JSCode'] .= 'if(!parent.' . trim($this->sPre) . ' && !parent.view_frame) top.location.href="' . $this->baseUrlWrap($tdlLD['totalURL']) . '"'; + } + $this->compensateFieldWidth = '' . $this->config['config']['compensateFieldWidth']; + $this->lockFilePath = '' . $this->config['config']['lockFilePath']; + $this->lockFilePath = $this->lockFilePath ?: $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']; + if (isset($this->config['config']['noScaleUp'])) { + $this->logDeprecatedTyposcript( + 'config.noScaleUp', + 'The TypoScript property "config.noScaleUp" is deprecated since TYPO3 v8 and will be removed in TYPO3 v9. ' . + 'Please use the global TYPO3 configuration setting "GFX/processor_allowUpscaling" instead.' + ); + } + $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_allowUpscaling'] = (bool)(isset($this->config['config']['noScaleUp']) ? !$this->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_allowUpscaling']); + $this->ATagParams = trim($this->config['config']['ATagParams']) ? ' ' . trim($this->config['config']['ATagParams']) : ''; + if ($this->config['config']['setJS_mouseOver']) { + $this->setJS('mouseOver'); + } + if ($this->config['config']['setJS_openPic']) { + $this->setJS('openPic'); + } + $this->initializeSearchWordDataInTsfe(); + // linkVars + $this->calculateLinkVars(); + // dtdAllowsFrames indicates whether to use the target attribute in links + $this->dtdAllowsFrames = false; + if ($this->config['config']['doctype']) { + if (in_array( + (string)$this->config['config']['doctype'], + ['xhtml_trans', 'xhtml_frames', 'xhtml_basic', 'html5'], + true) + ) { + $this->dtdAllowsFrames = true; + } + } else { + $this->dtdAllowsFrames = true; + } + // Setting XHTML-doctype from doctype + if (!$this->config['config']['xhtmlDoctype']) { + $this->config['config']['xhtmlDoctype'] = $this->config['config']['doctype']; + } + if ($this->config['config']['xhtmlDoctype']) { + $this->xhtmlDoctype = $this->config['config']['xhtmlDoctype']; + // Checking XHTML-docytpe + switch ((string)$this->config['config']['xhtmlDoctype']) { + case 'xhtml_trans': + case 'xhtml_strict': + $this->xhtmlVersion = 100; + break; + case 'xhtml_frames': + $this->logDeprecatedTyposcript( + 'config.xhtmlDoctype=frames', + 'xhtmlDoctype = xhtml_frames and doctype = xhtml_frames have been marked as deprecated since TYPO3 v8, ' . + 'and will be removed in TYPO3 v9.' + ); + $this->xhtmlVersion = 100; + break; + case 'xhtml_basic': + $this->xhtmlVersion = 105; + break; + case 'xhtml_11': + case 'xhtml+rdfa_10': + $this->xhtmlVersion = 110; + break; + default: + $this->pageRenderer->setRenderXhtml(false); + $this->xhtmlDoctype = ''; + $this->xhtmlVersion = 0; + } + } else { + $this->pageRenderer->setRenderXhtml(false); + } + + // Global content object + $this->newCObj(); + } + + /** + * Fills the sWordList property and builds the regular expression in TSFE that can be used to split + * strings by the submitted search words. + * + * @see sWordList + * @see sWordRegEx + */ + protected function initializeSearchWordDataInTsfe() + { + $this->sWordRegEx = ''; + $this->sWordList = GeneralUtility::_GP('sword_list'); + if (is_array($this->sWordList)) { + $space = !empty($this->config['config']['sword_standAlone']) ? '[[:space:]]' : ''; + foreach ($this->sWordList as $val) { + if (trim($val) !== '') { + $this->sWordRegEx .= $space . preg_quote($val, '/') . $space . '|'; + } + } + $this->sWordRegEx = rtrim($this->sWordRegEx, '|'); + } + } + /** * Determines to include custom or pagegen.php script * returns script-filename if a TypoScript (config) script is defined and should be included instead of pagegen.php * * @return string|NULL The relative filepath of "config.pageGenScript" if found and allowed + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9 */ public function generatePage_whichScript() { if (!$GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude'] && $this->config['config']['pageGenScript']) { + GeneralUtility::logDeprecatedFunction(); return $this->tmpl->getFileName($this->config['config']['pageGenScript']); } return null; @@ -3681,9 +3844,11 @@ class TypoScriptFrontendController * * @return void * @access private + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, as the Request Handler is taking care of that now */ public function setParseTime() { + GeneralUtility::logDeprecatedFunction(); // Compensates for the time consumed with Back end user initialization. $microtime_start = isset($GLOBALS['TYPO3_MISC']['microtime_start']) ? $GLOBALS['TYPO3_MISC']['microtime_start'] : null; $microtime_end = isset($GLOBALS['TYPO3_MISC']['microtime_end']) ? $GLOBALS['TYPO3_MISC']['microtime_end'] : null; @@ -3779,9 +3944,11 @@ class TypoScriptFrontendController * @param int $end End of range * @param int $offset Offset * @return string encoded/decoded version of character + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, this functionality has been moved to ContentObjectRenderer */ public function encryptCharcode($n, $start, $end, $offset) { + GeneralUtility::logDeprecatedFunction(); $n = $n + $offset; if ($offset > 0 && $n > $end) { $n = $start + ($n - $end - 1); @@ -3797,9 +3964,11 @@ class TypoScriptFrontendController * @param string $string Input string to en/decode: "mailto:blabla@bla.com * @param bool $back If set, the process is reversed, effectively decoding, not encoding. * @return string encoded/decoded version of $string + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, this functionality has been moved to ContentObjectRenderer */ public function encryptEmail($string, $back = false) { + GeneralUtility::logDeprecatedFunction(); $out = ''; // obfuscates using the decimal HTML entity references for each character if ($this->spamProtectEmailAddresses === 'ascii') { diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php index 1a50dea4e811..050e192f5d82 100644 --- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php +++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php @@ -206,9 +206,7 @@ class RequestHandler implements RequestHandlerInterface if ($temp_theScript) { include $temp_theScript; } else { - PageGenerator::pagegenInit(); - // Global content object - $this->controller->newCObj(); + $this->controller->preparePageContentGeneration(); // Content generation if (!$this->controller->isINTincScript()) { PageGenerator::renderContent(); @@ -217,9 +215,7 @@ class RequestHandler implements RequestHandlerInterface } $this->controller->generatePage_postProcessing(); } elseif ($this->controller->isINTincScript()) { - PageGenerator::pagegenInit(); - // Global content object - $this->controller->newCObj(); + $this->controller->preparePageContentGeneration(); } $this->controller->releaseLocks(); $this->timeTracker->pull(); @@ -243,14 +239,15 @@ class RequestHandler implements RequestHandlerInterface $this->controller->storeSessionData(); // Statistics $GLOBALS['TYPO3_MISC']['microtime_end'] = microtime(true); - $this->controller->setParseTime(); - if (isset($this->controller->config['config']['debug'])) { - $debugParseTime = (bool)$this->controller->config['config']['debug']; - } else { - $debugParseTime = !empty($GLOBALS['TYPO3_CONF_VARS']['FE']['debug']); - } - if ($this->controller->isOutputting() && $debugParseTime) { - $this->controller->content .= LF . '<!-- Parsetime: ' . $this->controller->scriptParseTime . 'ms -->'; + if ($this->controller->isOutputting()) { + if (isset($this->controller->config['config']['debug'])) { + $debugParseTime = (bool)$this->controller->config['config']['debug']; + } else { + $debugParseTime = !empty($GLOBALS['TYPO3_CONF_VARS']['FE']['debug']); + } + if ($debugParseTime) { + $this->controller->content .= LF . '<!-- Parsetime: ' . $this->getParseTime() . 'ms -->'; + } } $this->controller->redirectToExternalUrl(); // Preview info @@ -361,4 +358,22 @@ class RequestHandler implements RequestHandlerInterface // This is a dirty workaround and bypasses the protected access modifier of the controller member. $GLOBALS['TSFE'] = &$this->controller; } + + /** + * Calculates the parsetime of the page and returns it. + * + * @return int the parse time of the page + */ + protected function getParseTime() + { + // Compensates for the time consumed with Back end user initialization. + $processStart = isset($GLOBALS['TYPO3_MISC']['microtime_start']) ? $GLOBALS['TYPO3_MISC']['microtime_start'] : null; + $processEnd = isset($GLOBALS['TYPO3_MISC']['microtime_end']) ? $GLOBALS['TYPO3_MISC']['microtime_end'] : null; + $beUserInitializationStart = isset($GLOBALS['TYPO3_MISC']['microtime_BE_USER_start']) ? $GLOBALS['TYPO3_MISC']['microtime_BE_USER_start'] : null; + $beUserInitializationEnd = isset($GLOBALS['TYPO3_MISC']['microtime_BE_USER_end']) ? $GLOBALS['TYPO3_MISC']['microtime_BE_USER_end'] : null; + return $this->timeTracker->getMilliseconds($processStart) + - $this->timeTracker->getMilliseconds($processEnd) + - ($this->timeTracker->getMilliseconds($beUserInitializationStart) + - $this->timeTracker->getMilliseconds($beUserInitializationEnd)); + } } diff --git a/typo3/sysext/frontend/Classes/Page/PageGenerator.php b/typo3/sysext/frontend/Classes/Page/PageGenerator.php index bf6c61a9147d..73c8d19ec947 100644 --- a/typo3/sysext/frontend/Classes/Page/PageGenerator.php +++ b/typo3/sysext/frontend/Classes/Page/PageGenerator.php @@ -41,10 +41,12 @@ class PageGenerator /** * Setting some vars in TSFE, primarily based on TypoScript config settings. * + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9 * @return void */ public static function pagegenInit() { + GeneralUtility::logDeprecatedFunction(); /** @var TypoScriptFrontendController $tsfe */ $tsfe = $GLOBALS['TSFE']; if ($tsfe->page['content_from_pid'] > 0) { @@ -95,7 +97,7 @@ class PageGenerator $tsfe->absRefPrefix = ''; } if ($tsfe->type && $tsfe->config['config']['frameReloadIfNotInFrameset']) { - \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog( + GeneralUtility::deprecationLog( 'frameReloadIfNotInFrameset has been marked as deprecated since TYPO3 v8, ' . 'and will be removed in TYPO3 v9.' ); @@ -145,7 +147,7 @@ class PageGenerator $tsfe->xhtmlVersion = 100; break; case 'xhtml_frames': - \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog( + GeneralUtility::deprecationLog( 'xhtmlDoctype = xhtml_frames and doctype = xhtml_frames have been marked as deprecated since TYPO3 v8, ' . 'and will be removed in TYPO3 v9.' ); @@ -873,7 +875,7 @@ class PageGenerator } // Header complete, now add content if ($tsfe->pSetup['frameSet.']) { - \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog( + GeneralUtility::deprecationLog( 'frameSet, FRAME and FRAMESET have been marked as deprecated since TYPO3 v8 ' . 'and will be removed in TYPO3 v9.' ); -- GitLab