diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 40c7d85cc6e2876e5497ba6d9b3c52b72bc02b99..f6b3da6900f998767cd725948429fc200f2ac59d 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -356,13 +356,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface */ protected string $uniqueString = ''; - /** - * This value will be used as the title for the page in the indexer (if - * indexing happens) - * @internal only used by TYPO3 Core, use PageTitle API instead. - */ - public string $indexedDocTitle = ''; - /** * The base URL set for the page header. * @var string @@ -1183,11 +1176,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface // Restore the current tags as they can be retrieved by getPageCacheTags() $this->pageCacheTags = $cachedData['cacheTags'] ?? []; - // Restore page title information, this is needed to generate the page title for - // partially cached pages. - $this->page['title'] = $cachedData['pageTitleInfo']['title']; - $this->indexedDocTitle = $cachedData['pageTitleInfo']['indexedDocTitle']; - if (isset($this->config['config']['debug'])) { $debugCacheTime = (bool)$this->config['config']['debug']; } else { @@ -1666,10 +1654,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface 'cache_data' => $data, 'expires' => $expirationTstamp, 'tstamp' => $GLOBALS['EXEC_TIME'], - 'pageTitleInfo' => [ - 'title' => $this->page['title'], - 'indexedDocTitle' => $this->indexedDocTitle, - ], ]; $this->cacheExpires = $expirationTstamp; $this->pageCacheTags[] = 'pageId_' . $cacheData['page_id']; @@ -1820,8 +1804,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface public function preparePageContentGeneration(ServerRequestInterface $request) { $this->getTimeTracker()->push('Prepare page content generation'); - // Global vars... - $this->indexedDocTitle = $this->page['title'] ?? null; // Base url: if (isset($this->config['config']['baseURL'])) { $this->baseUrl = $this->config['config']['baseURL']; @@ -1929,10 +1911,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface $pageTitle = $titleProvider->getTitle(); $this->config['config']['pageTitleCache'] = $titleProvider->getPageTitleCache(); - if ($pageTitle !== '') { - $this->indexedDocTitle = $pageTitle; - } - $titleTagContent = $this->printTitle( $pageTitle, (bool)($this->config['config']['noPageTitle'] ?? false), diff --git a/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php b/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php index 9e9ceb42c164470bef80001a9c9ecd50c608d633..f4d35dcf2da8fbab2002c3ce02ae269a20ac9fb6 100644 --- a/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php @@ -40,7 +40,6 @@ use TYPO3\CMS\Core\Package\PackageManager; use TYPO3\CMS\Core\Page\ImportMap; use TYPO3\CMS\Core\Page\ImportMapFactory; use TYPO3\CMS\Core\Page\PageRenderer; -use TYPO3\CMS\Core\PageTitle\PageTitleProviderManager; use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; @@ -278,34 +277,6 @@ class TypoScriptFrontendControllerTest extends UnitTestCase self::assertSame($expected, $this->subject->baseUrlWrap($url)); } - /** - * @test - * @see https://forge.typo3.org/issues/88041 - */ - public function indexedSearchHookUsesPageTitleApi(): void - { - $pageTitle = 'This is a test page title coming from PageTitleProviderManager'; - - $pageTitleProvider = $this->prophesize(PageTitleProviderManager::class); - $pageTitleProvider->getTitle()->willReturn($pageTitle); - $pageTitleProvider->getPageTitleCache()->willReturn([]); - GeneralUtility::setSingletonInstance(PageTitleProviderManager::class, $pageTitleProvider->reveal()); - - $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class); - $cacheFrontendProphecy->get(Argument::cetera())->willReturn(false); - $cacheFrontendProphecy->set(Argument::cetera())->willReturn(null); - $cacheManagerProphecy = $this->prophesize(CacheManager::class); - $cacheManagerProphecy->getCache('pages')->willReturn($cacheFrontendProphecy->reveal()); - GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal()); - - $contentObjectRendererProphecy = $this->prophesize(ContentObjectRenderer::class); - $contentObjectRendererProphecy->stdWrapValue(Argument::cetera())->willReturn(''); - $this->subject->cObj = $contentObjectRendererProphecy->reveal(); - - $this->subject->generatePageTitle(); - self::assertSame($pageTitle, $this->subject->indexedDocTitle); - } - /** * @test */ diff --git a/typo3/sysext/indexed_search/Classes/Hook/TypoScriptFrontendHook.php b/typo3/sysext/indexed_search/Classes/Hook/TypoScriptFrontendHook.php index f0c0c3998759fe210a98312e32644780f61dd8dd..838e647d8d56f3c6c222a34471e4fca051df36ad 100644 --- a/typo3/sysext/indexed_search/Classes/Hook/TypoScriptFrontendHook.php +++ b/typo3/sysext/indexed_search/Classes/Hook/TypoScriptFrontendHook.php @@ -18,6 +18,7 @@ namespace TYPO3\CMS\IndexedSearch\Hook; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspect; +use TYPO3\CMS\Core\PageTitle\PageTitleProviderManager; use TYPO3\CMS\Core\TimeTracker\TimeTracker; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; @@ -107,10 +108,14 @@ class TypoScriptFrontendHook // Content of page $configuration['content'] = $tsfe->content; // Content string (HTML of TYPO3 page) - $configuration['indexedDocTitle'] = $tsfe->indexedDocTitle; + // Alternative title for indexing - $configuration['mtime'] = $tsfe->register['SYS_LASTCHANGED'] ?? $tsfe->page['SYS_LASTCHANGED']; + // @see https://forge.typo3.org/issues/88041 + $titleProvider = GeneralUtility::makeInstance(PageTitleProviderManager::class); + $configuration['indexedDocTitle'] = $titleProvider->getTitle(); + // Most recent modification time (seconds) of the content on the page. Used to evaluate whether it should be re-indexed. + $configuration['mtime'] = $tsfe->register['SYS_LASTCHANGED'] ?? $tsfe->page['SYS_LASTCHANGED']; // Configuration of behavior $configuration['index_externals'] = $tsfe->config['config']['index_externals']; // Whether to index external documents like PDF, DOC etc. (if possible)