[!!!][TASK] Remove deprecated code from TemplateService 04/59204/5
authorBenni Mack <benni@typo3.org>
Wed, 19 Dec 2018 07:27:57 +0000 (08:27 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 19 Dec 2018 13:20:07 +0000 (14:20 +0100)
The TemplateService class can now be reduced into smaller parts due
to deprecation removals.

Properties now marked as internal:
- absoluteRootLine
- matchAll
- nextLevel
- outermostRootlineIndexWithTemplate
- rootId
- rowSum
- sectionsMatch
- simulationHiddenOrTime
- sitetitle

Removed properties:
- allowedPaths
- debug
- fileCache
- frames
- MPmap
- whereClause

Methods now marked as protected:
- flattenSetup()
- mergeConstantsFromPageTSconfig()
- prependStaticExtra()
- processIncludes()
- substituteConstants()
- versionOL()

Removed public methods:
- getFileName()
- getFromMPmap()
- init()
- initMPmap_create()
- linkData()
- printTitle()

Resolves: #87207
Releases: master
Change-Id: I264a44ee00450cb9cef23aad365a2266bb7bfa70
Reviewed-on: https://review.typo3.org/59204
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/TypoScript/TemplateService.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript
typo3/sysext/core/Tests/UnitDeprecated/TypoScript/TemplateServiceTest.php [deleted file]
typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php

index a1427f0..12d9d06 100644 (file)
@@ -16,30 +16,19 @@ namespace TYPO3\CMS\Core\TypoScript;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait;
-use TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait;
 use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\Restriction\AbstractRestrictionContainer;
 use TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer;
-use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
 use TYPO3\CMS\Core\Package\PackageManager;
-use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
-use TYPO3\CMS\Core\Resource\Exception\InvalidFileException;
-use TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException;
-use TYPO3\CMS\Core\Resource\Exception\InvalidPathException;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Core\Utility\HttpUtility;
-use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
-use TYPO3\CMS\Frontend\Page\PageRepository;
-use TYPO3\CMS\Frontend\Resource\FilePathSanitizer;
 
 /**
  * Template object that is responsible for generating the TypoScript template based on template records.
@@ -48,44 +37,6 @@ use TYPO3\CMS\Frontend\Resource\FilePathSanitizer;
  */
 class TemplateService
 {
-    use PublicPropertyDeprecationTrait;
-    use PublicMethodDeprecationTrait;
-
-    /**
-     * Properties which have been moved to protected status from public
-     * @var array
-     */
-    protected $deprecatedPublicProperties = [
-        'matchAll' => 'Using $matchAll of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'whereClause' => 'Using $whereClause of class TemplateService is discouraged, as this has been superseded by Doctrine DBAL API.',
-        'debug' => 'Using $debug of class TemplateService is discouraged, as this option has no effect anymore.',
-        'allowedPaths' => 'Using $allowedPaths of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'simulationHiddenOrTime' => 'Using $simulationHiddenOrTime of class TemplateService is discouraged, as this has been superseeded by Doctrine DBAL API.',
-        'nextLevel' => 'Using $nextLevel of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'rootId' => 'Using $rootId of class TemplateService from the outside is discouraged, use TemplateService->getRootId() instead.',
-        'absoluteRootLine' => 'Using $absoluteRootLine of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'outermostRootlineIndexWithTemplate' => 'Using $outermostRootlineIndexWithTemplate of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'rowSum' => 'Using $rowSum of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'sitetitle' => 'Using $sitetitle of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'sectionsMatch' => 'Using $sectionsMatch of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'frames' => 'Using $frames of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'MPmap' => 'Using $MPmap of class TemplateService from the outside is discouraged, as this variable is only used for internal storage.',
-        'fileCache' => 'Using $fileCache of class TemplateService from the outside is discouraged, the property will be removed in TYPO3 v10.0.',
-    ];
-
-    /**
-     * Methods which have been moved to protected status from public
-     * @var array
-     */
-    protected $deprecatedPublicMethods = [
-        'prependStaticExtra' => 'Using prependStaticExtra() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
-        'versionOL' => 'Using versionOL() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
-        'processIncludes' => 'Using processIncludes() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
-        'mergeConstantsFromPageTSconfig' => 'Using mergeConstantsFromPageTSconfig() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
-        'flattenSetup' => 'Using flattenSetup() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
-        'substituteConstants' => 'Using substituteConstants() of class TemplateService from the outside is discouraged, as this method is only meant to be used internally.',
-    ];
-
     /**
      * option to enable logging, time-tracking (FE-only)
      * usually, this is only done when
@@ -149,31 +100,11 @@ class TemplateService
     public $ext_regComments = false;
 
     /**
-     * This MUST be initialized by the init() function
+     * Set if preview of some kind is enabled.
      *
-     * @var string
-     */
-    protected $whereClause = '';
-
-    /**
      * @var bool
      */
-    protected $debug = false;
-
-    /**
-     * This is the only paths (relative!!) that are allowed for resources in TypoScript.
-     * Should all be appended with '/'. You can extend these by the global array TYPO3_CONF_VARS. See init() function.
-     *
-     * @var array
-     */
-    protected $allowedPaths = [];
-
-    /**
-     * See init(); Set if preview of some kind is enabled.
-     *
-     * @var int
-     */
-    protected $simulationHiddenOrTime = 0;
+    protected $simulationHiddenOrTime = false;
 
     /**
      * Set, if the TypoScript template structure is loaded and OK, see ->start()
@@ -315,29 +246,6 @@ class TemplateService
     public $setup_constants = [];
 
     /**
-     * Used by getFileName for caching of references to file resources
-     *
-     * @var array
-     * @deprecated Will be removed in TYPO3 v10.0
-     */
-    protected $fileCache = [];
-
-    /**
-     * Keys are frame names and values are type-values, which must be used to refer correctly to the content of the frames.
-     *
-     * @var array
-     */
-    protected $frames = [];
-
-    /**
-     * Contains mapping of Page id numbers to MP variables.
-     * This is not used anymore, and will be removed in TYPO3 v10.0.
-     *
-     * @var string
-     */
-    protected $MPmap = '';
-
-    /**
      * Indicator that extension statics are processed.
      *
      * These files are considered if either a root template
@@ -401,27 +309,8 @@ class TemplateService
         $this->initializeDatabaseQueryRestrictions();
         if ($this->context->getPropertyFromAspect('visibility', 'includeHiddenContent', false) || $GLOBALS['SIM_ACCESS_TIME'] !== $GLOBALS['ACCESS_TIME']) {
             // Set the simulation flag, if simulation is detected!
-            $this->simulationHiddenOrTime = 1;
-        }
-
-        // Sets the paths from where TypoScript resources are allowed to be used:
-        $this->allowedPaths = [
-            $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'],
-            // fileadmin/ path
-            'uploads/',
-            'typo3temp/',
-            TYPO3_mainDir . 'ext/',
-            TYPO3_mainDir . 'sysext/',
-            'typo3conf/ext/'
-        ];
-        if ($GLOBALS['TYPO3_CONF_VARS']['FE']['addAllowedPaths']) {
-            $pathArr = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['addAllowedPaths'], true);
-            foreach ($pathArr as $p) {
-                // Once checked for path, but as this may run from typo3/mod/web/ts/ dir, that'll not work!! So the paths ar uncritically included here.
-                $this->allowedPaths[] = $p;
-            }
+            $this->simulationHiddenOrTime = true;
         }
-
         $this->tt_track = $this->verbose = (bool)$this->context->getPropertyFromAspect('backend.user', 'isLoggedIn', false);
     }
 
@@ -451,56 +340,13 @@ class TemplateService
     }
 
     /**
-     * Initialize
-     *
-     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
-     */
-    public function init()
-    {
-        trigger_error('TemplateService->init() will be removed in TYPO3 v10.0, __construct() does the job.', E_USER_DEPRECATED);
-        $this->initializeDatabaseQueryRestrictions();
-        if ($this->context->getPropertyFromAspect('visibility', 'includeHiddenContent', false) || $GLOBALS['SIM_ACCESS_TIME'] !== $GLOBALS['ACCESS_TIME']) {
-            // Set the simulation flag, if simulation is detected!
-            $this->simulationHiddenOrTime = 1;
-        }
-
-        // Sets the paths from where TypoScript resources are allowed to be used:
-        $this->allowedPaths = [
-            $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'],
-            // fileadmin/ path
-            'uploads/',
-            'typo3temp/',
-            TYPO3_mainDir . 'ext/',
-            TYPO3_mainDir . 'sysext/',
-            'typo3conf/ext/'
-        ];
-        if ($GLOBALS['TYPO3_CONF_VARS']['FE']['addAllowedPaths']) {
-            $pathArr = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['addAllowedPaths'], true);
-            foreach ($pathArr as $p) {
-                // Once checked for path, but as this may run from typo3/mod/web/ts/ dir, that'll not work!! So the paths ar uncritically included here.
-                $this->allowedPaths[] = $p;
-            }
-        }
-    }
-
-    /**
-     * $this->whereclause is kept for backwards compatibility
+     * Set up the query builder restrictions, optionally include hidden records
      */
     protected function initializeDatabaseQueryRestrictions()
     {
-        $includeHiddenRecords = $this->context->getPropertyFromAspect('visibility', 'includeHiddenContent', false);
-        // $this->whereClause is used only to select templates from sys_template.
-        // $GLOBALS['SIM_ACCESS_TIME'] is used so that we're able to simulate a later time as a test...
-        $this->whereClause = 'AND deleted=0 ';
-        if (!$includeHiddenRecords) {
-            $this->whereClause .= 'AND hidden=0 ';
-        }
-        $this->whereClause .= 'AND (starttime<=' . $GLOBALS['SIM_ACCESS_TIME'] . ') AND (endtime=0 OR endtime>' . $GLOBALS['SIM_ACCESS_TIME'] . ')';
-
-        // set up the query builder restrictions
         $this->queryBuilderRestrictions = GeneralUtility::makeInstance(DefaultRestrictionContainer::class);
 
-        if ($includeHiddenRecords) {
+        if ($this->context->getPropertyFromAspect('visibility', 'includeHiddenContent', false)) {
             $this->queryBuilderRestrictions->removeByType(HiddenRestriction::class);
         }
     }
@@ -1428,72 +1274,6 @@ class TemplateService
      *******************************************************************/
 
     /**
-     * Returns the reference used for the frontend inclusion, checks against allowed paths for inclusion.
-     *
-     * @param string $fileFromSetup TypoScript "resource" data type value.
-     * @return string|null Resulting filename, is either a full absolute URL or a relative path. Returns NULL if invalid filename or a directory is given
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    public function getFileName($fileFromSetup)
-    {
-        trigger_error('TemplateService->getFileName() will be removed in TYPO3 v10.0. Use FilePathSanitizer->sanitize() of EXT:frontend instead.', E_USER_DEPRECATED);
-        try {
-            $file = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize((string)$fileFromSetup);
-            $hash = md5($file);
-            if (!isset($this->fileCache[$hash])) {
-                $this->fileCache[$hash] = $file;
-            }
-            return $file;
-        } catch (InvalidFileNameException $e) {
-            // Empty file name
-        } catch (InvalidPathException $e) {
-            if ($this->tt_track) {
-                $this->getTimeTracker()->setTSlogMessage('File path "' . $fileFromSetup . '" contained illegal string "../"!', 3);
-            }
-        } catch (FileDoesNotExistException $e) {
-            if ($this->tt_track) {
-                $this->getTimeTracker()->setTSlogMessage('File "' . $fileFromSetup . '" was not found!', 3);
-            }
-        } catch (InvalidFileException $e) {
-            if ($this->tt_track) {
-                $this->getTimeTracker()->setTSlogMessage('"' . $fileFromSetup . '" was not located in the allowed paths: (' . implode(',', $this->allowedPaths) . ')', 3);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Compiles the content for the page <title> tag.
-     *
-     * @param string $pageTitle The input title string, typically the "title" field of a page's record.
-     * @param bool $noTitle If set, then only the site title is outputted (from $this->setup['sitetitle'])
-     * @param bool $showTitleFirst If set, then "sitetitle" and $title is swapped
-     * @param string $pageTitleSeparator an alternative to the ": " as the separator between site title and page title
-     * @return string The page title on the form "[sitetitle]: [input-title]". Not htmlspecialchar()'ed.
-     * @see \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::tempPageCacheContent(), \TYPO3\CMS\Frontend\Page\PageGenerator::renderContentWithHeader()
-     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use $TSFE->generatePageTitle() instead.
-     */
-    public function printTitle($pageTitle, $noTitle = false, $showTitleFirst = false, $pageTitleSeparator = '')
-    {
-        trigger_error('TemplateService->printTitle() will be removed in TYPO3 v10.0. Title tag generation has been moved into $TSFE itself, re-implement this method if you need to, otherwise use TSFE->generatePageTitle() for full usage.', E_USER_DEPRECATED);
-        $siteTitle = trim($this->setup['sitetitle']);
-        $pageTitle = $noTitle ? '' : $pageTitle;
-        if ($showTitleFirst) {
-            $temp = $siteTitle;
-            $siteTitle = $pageTitle;
-            $pageTitle = $temp;
-        }
-        // only show a separator if there are both site title and page title
-        if ($pageTitle === '' || $siteTitle === '') {
-            $pageTitleSeparator = '';
-        } elseif (empty($pageTitleSeparator)) {
-            // use the default separator if non given
-            $pageTitleSeparator = ': ';
-        }
-        return $siteTitle . $pageTitleSeparator . $pageTitle;
-    }
-
-    /**
      * Returns the level of the given page in the rootline - Multiple pages can be given by separating the UIDs by comma.
      *
      * @param string $list A list of UIDs for which the rootline-level should get returned
@@ -1526,224 +1306,6 @@ class TemplateService
      * Functions for creating links
      *
      *******************************************************************/
-    /**
-     * The mother of all functions creating links/URLs etc in a TypoScript environment.
-     * See the references below.
-     * Basically this function takes care of issues such as type,id,alias and Mount Points, URL rewriting (through hooks), M5/B6 encoded parameters etc.
-     * It is important to pass all links created through this function since this is the guarantee that globally configured settings for link creating are observed and that your applications will conform to the various/many configuration options in TypoScript Templates regarding this.
-     *
-     * @param array $page The page record of the page to which we are creating a link. Needed due to fields like uid, alias, target, title and sectionIndex_uid.
-     * @param string $oTarget Default target string to use IF not $page['target'] is set.
-     * @param bool $no_cache If set, then the "&no_cache=1" parameter is included in the URL.
-     * @param string $_ not in use anymore
-     * @param array $overrideArray Array with overriding values for the $page array.
-     * @param string $addParams Additional URL parameters to set in the URL. Syntax is "&foo=bar&foo2=bar2" etc. Also used internally to add parameters if needed.
-     * @param string $typeOverride If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $this->getTypoScriptFrontendController()->config['config']['forceTypeValue'] if found.
-     * @param string $targetDomain The target Doamin, if any was detected in typolink
-     * @return array Contains keys like "totalURL", "url", "sectionIndex", "linkVars", "no_cache", "type", "target" of which "totalURL" is normally the value you would use while the other keys contains various parts that was used to construct "totalURL
-     * @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::typoLink(), \TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject::link()
-     * @deprecated - will be removed in TYPO3 v10.0 - have a look at PageLinkBuilder
-     */
-    public function linkData($page, $oTarget, $no_cache, $_ = null, $overrideArray = null, $addParams = '', $typeOverride = '', $targetDomain = '')
-    {
-        trigger_error('Creating URLs to pages is now encapsulated into PageLinkBuilder, and should be used in the future. TemplateService->linkData() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
-        $LD = [];
-        // Overriding some fields in the page record and still preserves the values by adding them as parameters. Little strange function.
-        if (is_array($overrideArray)) {
-            foreach ($overrideArray as $theKey => $theNewVal) {
-                $addParams .= '&real_' . $theKey . '=' . rawurlencode($page[$theKey]);
-                $page[$theKey] = $theNewVal;
-            }
-        }
-        // Adding Mount Points, "&MP=", parameter for the current page if any is set:
-        if (!strstr($addParams, '&MP=')) {
-            // Looking for hardcoded defaults:
-            if (trim($this->getTypoScriptFrontendController()->MP_defaults[$page['uid']])) {
-                $addParams .= '&MP=' . rawurlencode(trim($this->getTypoScriptFrontendController()->MP_defaults[$page['uid']]));
-            } elseif ($this->getTypoScriptFrontendController()->config['config']['MP_mapRootPoints']) {
-                // Else look in automatically created map:
-                $m = $this->getFromMPmap($page['uid']);
-                if ($m) {
-                    $addParams .= '&MP=' . rawurlencode($m);
-                }
-            }
-        }
-        // Setting ID/alias:
-        $script = 'index.php';
-        if ($page['alias']) {
-            $LD['url'] = $script . '?id=' . rawurlencode($page['alias']);
-        } else {
-            $LD['url'] = $script . '?id=' . $page['uid'];
-        }
-        // Setting target
-        $LD['target'] = trim($page['target']) ?: $oTarget;
-        // typeNum
-        $typeNum = $this->setup[$LD['target'] . '.']['typeNum'];
-        if (!MathUtility::canBeInterpretedAsInteger($typeOverride) && (int)$this->getTypoScriptFrontendController()->config['config']['forceTypeValue']) {
-            $typeOverride = (int)$this->getTypoScriptFrontendController()->config['config']['forceTypeValue'];
-        }
-        if ((string)$typeOverride !== '') {
-            $typeNum = $typeOverride;
-        }
-        // Override...
-        if ($typeNum) {
-            $LD['type'] = '&type=' . (int)$typeNum;
-        } else {
-            $LD['type'] = '';
-        }
-        // Preserving the type number.
-        $LD['orig_type'] = $LD['type'];
-        // noCache
-        $LD['no_cache'] = $no_cache ? '&no_cache=1' : '';
-        // linkVars
-        if ($addParams) {
-            $LD['linkVars'] = HttpUtility::buildQueryString(GeneralUtility::explodeUrl2Array($this->getTypoScriptFrontendController()->linkVars . $addParams), '&');
-        } else {
-            $LD['linkVars'] = $this->getTypoScriptFrontendController()->linkVars;
-        }
-        // Add absRefPrefix if exists.
-        $LD['url'] = $this->getTypoScriptFrontendController()->absRefPrefix . $LD['url'];
-        // If the special key 'sectionIndex_uid' (added 'manually' in tslib/menu.php to the page-record) is set, then the link jumps directly to a section on the page.
-        $LD['sectionIndex'] = $page['sectionIndex_uid'] ? '#c' . $page['sectionIndex_uid'] : '';
-        // Compile the normal total url
-        $LD['totalURL'] = rtrim($LD['url'] . $LD['type'] . $LD['no_cache'] . $LD['linkVars'] . $this->getTypoScriptFrontendController()->getMethodUrlIdToken, '?') . $LD['sectionIndex'];
-        // Call post processing function for link rendering:
-        $_params = [
-            'LD' => &$LD,
-            'args' => ['page' => $page, 'oTarget' => $oTarget, 'no_cache' => $no_cache, 'script' => $script, 'overrideArray' => $overrideArray, 'addParams' => $addParams, 'typeOverride' => $typeOverride, 'targetDomain' => $targetDomain],
-            'typeNum' => $typeNum
-        ];
-        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'] ?? [] as $_funcRef) {
-            GeneralUtility::callUserFunction($_funcRef, $_params, $this);
-        }
-        // Return the LD-array
-        return $LD;
-    }
-
-    /**
-     * Initializes the automatically created MPmap coming from the "config.MP_mapRootPoints" setting
-     * Can be called many times with overhead only the first time since then the map is generated and cached in memory.
-     *
-     * @param int $pageId Page id to return MPvar value for.
-     * @return string
-     * @see initMPmap_create()
-     * @todo Implement some caching of the result between hits. (more than just the memory caching used here)
-     * @deprecated - will be removed in TYPO3 v10.0.
-     */
-    public function getFromMPmap($pageId = 0)
-    {
-        trigger_error('Getting a mount point parameter for a page is now built into PageLinkBuilder, and should be used in the future. TemplateService->getFromMPmap() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
-        // Create map if not found already:
-        if (!is_array($this->MPmap)) {
-            $this->MPmap = [];
-            $rootPoints = GeneralUtility::trimExplode(',', strtolower($this->getTypoScriptFrontendController()->config['config']['MP_mapRootPoints']), true);
-            // Traverse rootpoints:
-            foreach ($rootPoints as $p) {
-                $initMParray = [];
-                if ($p === 'root') {
-                    $p = $this->rootLine[0]['uid'];
-                    if ($this->rootLine[0]['_MOUNT_OL'] && $this->rootLine[0]['_MP_PARAM']) {
-                        $initMParray[] = $this->rootLine[0]['_MP_PARAM'];
-                    }
-                }
-                $this->initMPmap_create($p, $initMParray);
-            }
-        }
-        // Finding MP var for Page ID:
-        if ($pageId) {
-            if (is_array($this->MPmap[$pageId]) && !empty($this->MPmap[$pageId])) {
-                return implode(',', $this->MPmap[$pageId]);
-            }
-        }
-        return '';
-    }
-
-    /**
-     * Creating MPmap for a certain ID root point.
-     *
-     * @param int $id Root id from which to start map creation.
-     * @param array $MP_array MP_array passed from root page.
-     * @param int $level Recursion brake. Incremented for each recursive call. 20 is the limit.
-     * @see getFromMPvar()
-     * @deprecated will be removed in TYPO3 v10.0
-     */
-    public function initMPmap_create($id, $MP_array = [], $level = 0)
-    {
-        trigger_error('Building a mount point parameter map is now built into PageLinkBuilder, and should be used in the future. TemplateService->initMPmap_creat() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
-        $id = (int)$id;
-        if ($id <= 0) {
-            return;
-        }
-        // First level, check id
-        if (!$level) {
-            // Find mount point if any:
-            $mount_info = $this->getTypoScriptFrontendController()->sys_page->getMountPointInfo($id);
-            // Overlay mode:
-            if (is_array($mount_info) && $mount_info['overlay']) {
-                $MP_array[] = $mount_info['MPvar'];
-                $id = $mount_info['mount_pid'];
-            }
-            // Set mapping information for this level:
-            $this->MPmap[$id] = $MP_array;
-            // Normal mode:
-            if (is_array($mount_info) && !$mount_info['overlay']) {
-                $MP_array[] = $mount_info['MPvar'];
-                $id = $mount_info['mount_pid'];
-            }
-        }
-        if ($id && $level < 20) {
-            $nextLevelAcc = [];
-            // Select and traverse current level pages:
-            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
-            $queryBuilder->getRestrictions()
-                ->removeAll()
-                ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
-            $queryResult = $queryBuilder
-                ->select('uid', 'pid', 'doktype', 'mount_pid', 'mount_pid_ol')
-                ->from('pages')
-                ->where(
-                    $queryBuilder->expr()->eq(
-                        'pid',
-                        $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)
-                    ),
-                    $queryBuilder->expr()->neq(
-                        'doktype',
-                        $queryBuilder->createNamedParameter(PageRepository::DOKTYPE_RECYCLER, \PDO::PARAM_INT)
-                    ),
-                    $queryBuilder->expr()->neq(
-                        'doktype',
-                        $queryBuilder->createNamedParameter(PageRepository::DOKTYPE_BE_USER_SECTION, \PDO::PARAM_INT)
-                    )
-                )->execute();
-            while ($row = $queryResult->fetch()) {
-                // Find mount point if any:
-                $next_id = $row['uid'];
-                $next_MP_array = $MP_array;
-                $mount_info = $this->getTypoScriptFrontendController()->sys_page->getMountPointInfo($next_id, $row);
-                // Overlay mode:
-                if (is_array($mount_info) && $mount_info['overlay']) {
-                    $next_MP_array[] = $mount_info['MPvar'];
-                    $next_id = $mount_info['mount_pid'];
-                }
-                if (!isset($this->MPmap[$next_id])) {
-                    // Set mapping information for this level:
-                    $this->MPmap[$next_id] = $next_MP_array;
-                    // Normal mode:
-                    if (is_array($mount_info) && !$mount_info['overlay']) {
-                        $next_MP_array[] = $mount_info['MPvar'];
-                        $next_id = $mount_info['mount_pid'];
-                    }
-                    // Register recursive call
-                    // (have to do it this way since ALL of the current level should be registered BEFORE the sublevel at any time)
-                    $nextLevelAcc[] = [$next_id, $next_MP_array];
-                }
-            }
-            // Call recursively, if any:
-            foreach ($nextLevelAcc as $pSet) {
-                $this->initMPmap_create($pSet[0], $pSet[1], $level + 1);
-            }
-        }
-    }
 
     /**
      * Adds the TypoScript from the global array.
index d95aac0..6c86096 100644 (file)
@@ -107,6 +107,12 @@ The following PHP class methods that have been previously deprecated for v9 have
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\PhpassPasswordHash->setHashCount()`
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\PhpassPasswordHash->setMaxHashCount()`
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\PhpassPasswordHash->setMinHashCount()`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->getFileName()`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->getFromMPmap()`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->init()`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->initMPmap_create()`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->linkData()`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->printTitle()`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->getFirstWebPage()`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->getDomainStartPage()`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->getRootLine()`
@@ -153,6 +159,12 @@ The following methods changed signature according to previous deprecations in v9
 The following public class properties have been dropped:
 
 * :php:`TYPO3\CMS\Core\Charset\CharsetConverter->synonyms`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->allowedPaths`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->debug`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->fileCache`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->frames`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->MPmap`
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->whereClause`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->error_getRootLine_failPid`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->error_getRootLine`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->versioningPreview`
@@ -169,6 +181,12 @@ The following class methods have changed visibility:
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\Pbkdf2PasswordHash->isValidSalt()` changed from public to protected
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\PhpassPasswordHash->base64Encode()` changed from public to protected
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\PhpassPasswordHash->isValidSalt()` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->flattenSetup()` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->mergeConstantsFromPageTSconfig()` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->prependStaticExtra()` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->processIncludes()` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->substituteConstants()` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->versionOL()` changed from public to protected
 
 
 The following class properties have changed visibility:
@@ -180,6 +198,15 @@ The following class properties have changed visibility:
 * :php:`TYPO3\CMS\Core\Charset\CharsetConverter->twoByteSets` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->sys_language_uid` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->versioningWorkspaceId` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->absoluteRootLine` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->matchAll` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->nextLevel` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->outermostRootlineIndexWithTemplate` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->rootId` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->rowSum` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->sectionsMatch` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->simulationHiddenOrTime` changed from public to protected
+* :php:`TYPO3\CMS\Core\TypoScript\TemplateService->sitetitle` changed from public to protected
 
 
 The following scheduler tasks have been removed:
index 49c9486..eef92b4 100644 (file)
@@ -241,7 +241,7 @@ page {
                stdWrap.postUserFunc = TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Renderer->renderValues
                stdWrap.postUserFunc.values {
                        template.children {
-                               sitetitle.data = tsfe:tmpl|sitetitle
+                               sitetitle.data = tsfe:tmpl|setup|sitetitle
                        }
                        page.children {
                                uid.data = page:uid
diff --git a/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/TemplateServiceTest.php b/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/TemplateServiceTest.php
deleted file mode 100644 (file)
index deb5b01..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-declare(strict_types = 1);
-
-namespace TYPO3\CMS\Core\Tests\UnitDeprecated\TypoScript;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Context\Context;
-use TYPO3\CMS\Core\Package\PackageManager;
-use TYPO3\CMS\Core\TypoScript\TemplateService;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-/**
- * Test case
- */
-class TemplateServiceTest extends UnitTestCase
-{
-    /**
-     * @var TemplateService
-     */
-    protected $templateService;
-
-    /**
-     * Set up
-     */
-    protected function setUp(): void
-    {
-        $packageManagerProphecy = $this->prophesize(PackageManager::class);
-        $this->templateService = new TemplateService(new Context(), $packageManagerProphecy->reveal());
-    }
-
-    /**
-     * @test
-     */
-    public function getFileNameReturnsUrlCorrectly(): void
-    {
-        $this->assertSame('http://example.com', $this->templateService->getFileName('http://example.com'));
-        $this->assertSame('https://example.com', $this->templateService->getFileName('https://example.com'));
-    }
-
-    /**
-     * @test
-     */
-    public function getFileNameReturnsFileCorrectly(): void
-    {
-        $this->assertSame('typo3/index.php', $this->templateService->getFileName('typo3/index.php'));
-    }
-
-    /**
-     * @test
-     */
-    public function getFileNameReturnsNullIfDirectory(): void
-    {
-        $this->assertNull($this->templateService->getFileName(__DIR__));
-    }
-
-    /**
-     * @test
-     */
-    public function getFileNameReturnsNullWithInvalidFileName(): void
-    {
-        $this->assertNull($this->templateService->getFileName('  '));
-        $this->assertNull($this->templateService->getFileName('something/../else'));
-    }
-}
index 2bb5b0f..ee2d2bd 100644 (file)
@@ -115,21 +115,6 @@ class FluidTemplateContentObjectTest extends UnitTestCase
     /**
      * @test
      */
-    public function renderCallsTemplateServiceGetFileNameForGivenTemplateFile(): void
-    {
-        $this->addMockViewToSubject();
-        /** @var $templateService \PHPUnit_Framework_MockObject_MockObject */
-        $templateService = $GLOBALS['TSFE']->tmpl;
-        $templateService
-            ->expects($this->any())
-            ->method('getFileName')
-            ->with('foo');
-        $this->subject->render(['file' => 'foo']);
-    }
-
-    /**
-     * @test
-     */
     public function renderCallsStandardWrapForGivenTemplateFileWithStandardWrap(): void
     {
         $this->addMockViewToSubject();
index 5252423..4d8a741 100644 (file)
@@ -1744,6 +1744,7 @@ return [
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
             'Deprecation-83254-MovedPageGenerationMethodsIntoTSFE.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\Html\RteHtmlParser->transformStyledATags' => [
@@ -2276,6 +2277,7 @@ return [
         'maximumNumberOfArguments' => 8,
         'restFiles' => [
             'Deprecation-84637-TemplateService-linkDataFunctionalityMovedInPageLinkBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->getFromMPmap' => [
@@ -2283,6 +2285,7 @@ return [
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
             'Deprecation-84637-TemplateService-linkDataFunctionalityMovedInPageLinkBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->initMPmap_create' => [
@@ -2290,6 +2293,7 @@ return [
         'maximumNumberOfArguments' => 3,
         'restFiles' => [
             'Deprecation-84637-TemplateService-linkDataFunctionalityMovedInPageLinkBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Backend\FrontendBackendUserAuthentication->initializeAdminPanel' => [
@@ -2641,7 +2645,8 @@ return [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Deprecation-85445-TemplateService-getFileName.rst'
+            'Deprecation-85445-TemplateService-getFileName.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Frontend\Page\PageRepository->getRootLine' => [
@@ -3666,42 +3671,48 @@ return [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst'
+            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->versionOL' => [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst'
+            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->processIncludes' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst'
+            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->mergeConstantsFromPageTSconfig' => [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst'
+            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->flattenSetup' => [
         'numberOfMandatoryArguments' => 2,
         'maximumNumberOfArguments' => 2,
         'restFiles' => [
-            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst'
+            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->substituteConstants' => [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst'
+            'Deprecation-86439-MarkSeveralMethodsWithinTemplateServiceAsInternal.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\Authentication\BackendUserAuthentication->isPSet' => [
index 9e3ddd7..1f8d508 100644 (file)
@@ -242,71 +242,85 @@ return [
     'TYPO3\CMS\Core\TypoScript\TemplateService->matchAll' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->whereClause' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->debug' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->allowedPaths' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->simulationHiddenOrTime' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->nextLevel' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->rootId' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->absoluteRootLine' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->outermostRootlineIndexWithTemplate' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->rowSum' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->sitetitle' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->sectionsMatch' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->frames' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->MPmap' => [
         'restFiles' => [
             'Deprecation-83273-PublicPropertiesOfTemplateService.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Impexp\Export->maxFileSize' => [
@@ -455,7 +469,8 @@ return [
     ],
     'TYPO3\CMS\Core\TypoScript\TemplateService->fileCache' => [
         'restFiles' => [
-            'Deprecation-85445-TemplateService-getFileName.rst'
+            'Deprecation-85445-TemplateService-getFileName.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Backend\View\PageLayoutView->languageIconTitles' => [