[TASK] Replace further usages with Environment API 00/57600/6
authorBenni Mack <benni@typo3.org>
Fri, 13 Jul 2018 21:45:47 +0000 (23:45 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Sat, 29 Sep 2018 10:53:42 +0000 (12:53 +0200)
Most of the occurrences have been replaced by using
Environment API.

On top, labels are now moved into "var/labels"
for existing composer-based installations, moving
XLF files out of the document root when the environment
is configured to allow files outside of the document
root.

For non-composer-based installations, labels are still
available under "typo3conf/l10n".

Resolves: #85560
Releases: master
Change-Id: Ib0a9e8e3dcd685109b9d922aee1970e68b265179
Reviewed-on: https://review.typo3.org/57600
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
23 files changed:
typo3/sysext/adminpanel/Classes/Modules/Debug/QueryInformation.php
typo3/sysext/core/Classes/Configuration/ConfigurationManager.php
typo3/sysext/core/Classes/Core/ClassLoadingInformation.php
typo3/sysext/core/Classes/IO/PharStreamWrapperInterceptor.php
typo3/sysext/core/Classes/Localization/Parser/AbstractXmlParser.php
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Classes/Resource/ResourceCompressor.php
typo3/sysext/core/Documentation/Changelog/8.5/Feature-58637-PurgeLanguagePacksInLanguageModule.rst
typo3/sysext/core/Documentation/Changelog/master/Important-85560-LocationOfXLFLabelsDownloaded.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php
typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php
typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/fluid/Classes/ViewHelpers/Debug/RenderViewHelper.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Resource/FilePathSanitizer.php
typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
typo3/sysext/impexp/Tests/Functional/Import/PagesAndTtContentWithImagesInEmptyDatabaseTest.php
typo3/sysext/install/Classes/Controller/EnvironmentController.php
typo3/sysext/install/Classes/Controller/UpgradeController.php
typo3/sysext/install/Classes/FolderStructure/DefaultFactory.php
typo3/sysext/install/Classes/Report/InstallStatusReport.php
typo3/sysext/install/Classes/Service/LanguagePackService.php

index 8685fa4..4b89ce8 100644 (file)
@@ -83,7 +83,7 @@ class QueryInformation extends AbstractSubModule implements DataProviderInterfac
     {
         $view = new StandaloneView();
         $view->setTemplatePathAndFilename(
-            'typo3/sysext/adminpanel/Resources/Private/Templates/Modules/Debug/QueryInformation.html'
+            'EXT:adminpanel/Resources/Private/Templates/Modules/Debug/QueryInformation.html'
         );
         $this->getLanguageService()->includeLLFile('EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf');
         $view->assignMultiple($data->getArrayCopy());
index f444467..982c109 100644 (file)
@@ -40,32 +40,32 @@ class ConfigurationManager
     /**
      * @var string Path to default TYPO3_CONF_VARS file, relative to the public web folder
      */
-    protected $defaultConfigurationFile = 'typo3/sysext/core/Configuration/DefaultConfiguration.php';
+    protected $defaultConfigurationFile = 'core/Configuration/DefaultConfiguration.php';
 
     /**
      * @var string Path to description file for TYPO3_CONF_VARS, relative to the public web folder
      */
-    protected $defaultConfigurationDescriptionFile = 'typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml';
+    protected $defaultConfigurationDescriptionFile = 'core/Configuration/DefaultConfigurationDescription.yaml';
 
     /**
      * @var string Path to local overload TYPO3_CONF_VARS file, relative to the public web folder
      */
-    protected $localConfigurationFile = 'typo3conf/LocalConfiguration.php';
+    protected $localConfigurationFile = 'LocalConfiguration.php';
 
     /**
      * @var string Path to additional local file, relative to the public web folder
      */
-    protected $additionalConfigurationFile = 'typo3conf/AdditionalConfiguration.php';
+    protected $additionalConfigurationFile = 'AdditionalConfiguration.php';
 
     /**
      * @var string Path to factory configuration file used during installation as LocalConfiguration boilerplate
      */
-    protected $factoryConfigurationFile = 'typo3/sysext/core/Configuration/FactoryConfiguration.php';
+    protected $factoryConfigurationFile = 'core/Configuration/FactoryConfiguration.php';
 
     /**
      * @var string Path to possible additional factory configuration file delivered by packages
      */
-    protected $additionalFactoryConfigurationFile = 'typo3conf/AdditionalFactoryConfiguration.php';
+    protected $additionalFactoryConfigurationFile = 'AdditionalFactoryConfiguration.php';
 
     /**
      * Writing to these configuration paths is always allowed,
@@ -101,7 +101,7 @@ class ConfigurationManager
      */
     public function getDefaultConfigurationFileLocation()
     {
-        return Environment::getPublicPath() . '/' . $this->defaultConfigurationFile;
+        return Environment::getFrameworkBasePath() . '/' . $this->defaultConfigurationFile;
     }
 
     /**
@@ -113,7 +113,7 @@ class ConfigurationManager
      */
     public function getDefaultConfigurationDescriptionFileLocation()
     {
-        return Environment::getPublicPath() . '/' . $this->defaultConfigurationDescriptionFile;
+        return Environment::getFrameworkBasePath() . '/' . $this->defaultConfigurationDescriptionFile;
     }
 
     /**
@@ -135,7 +135,7 @@ class ConfigurationManager
      */
     public function getLocalConfigurationFileLocation()
     {
-        return Environment::getPublicPath() . '/' . $this->localConfigurationFile;
+        return Environment::getLegacyConfigPath() . '/' . $this->localConfigurationFile;
     }
 
     /**
@@ -159,7 +159,7 @@ class ConfigurationManager
      */
     public function getAdditionalConfigurationFileLocation()
     {
-        return Environment::getPublicPath() . '/' . $this->additionalConfigurationFile;
+        return Environment::getLegacyConfigPath() . '/' . $this->additionalConfigurationFile;
     }
 
     /**
@@ -169,7 +169,7 @@ class ConfigurationManager
      */
     protected function getFactoryConfigurationFileLocation()
     {
-        return Environment::getPublicPath() . '/' . $this->factoryConfigurationFile;
+        return Environment::getFrameworkBasePath() . '/' . $this->factoryConfigurationFile;
     }
 
     /**
@@ -321,7 +321,7 @@ class ConfigurationManager
     public function canWriteConfiguration()
     {
         $fileLocation = $this->getLocalConfigurationFileLocation();
-        return @is_writable(file_exists($fileLocation) ? $fileLocation : Environment::getPublicPath() . '/typo3conf/');
+        return @is_writable(file_exists($fileLocation) ? $fileLocation : Environment::getLegacyConfigPath() . '/');
     }
 
     /**
index 56ceb6c..b6bcb1a 100644 (file)
@@ -33,12 +33,12 @@ class ClassLoadingInformation
     /**
      * Base directory storing all autoload information
      */
-    const AUTOLOAD_INFO_DIR = 'typo3conf/autoload/';
+    const AUTOLOAD_INFO_DIR = 'autoload/';
 
     /**
      * Base directory storing all autoload information in testing context
      */
-    const AUTOLOAD_INFO_DIR_TESTS = 'typo3conf/autoload-tests/';
+    const AUTOLOAD_INFO_DIR_TESTS = 'autoload-tests/';
 
     /**
      * Name of file that contains all classes-filename mappings
@@ -167,9 +167,9 @@ class ClassLoadingInformation
     protected static function getClassLoadingInformationDirectory()
     {
         if (self::isTestingContext()) {
-            return Environment::getPublicPath() . '/' . self::AUTOLOAD_INFO_DIR_TESTS;
+            return Environment::getLegacyConfigPath() . '/' . self::AUTOLOAD_INFO_DIR_TESTS;
         }
-        return Environment::getPublicPath() . '/' . self::AUTOLOAD_INFO_DIR;
+        return Environment::getLegacyConfigPath() . '/' . self::AUTOLOAD_INFO_DIR;
     }
 
     /**
index d84bcea..fb8ea98 100644 (file)
@@ -56,7 +56,7 @@ class PharStreamWrapperInterceptor implements \TYPO3\PharStreamWrapper\Assertabl
         if (GeneralUtility::validPathStr($path)
             && GeneralUtility::isFirstPartOfStr(
                 $path,
-                Environment::getPublicPath() . '/typo3conf/ext/'
+                Environment::getExtensionsPath()
             )
         ) {
             return true;
index b1ccea6..1249c73 100644 (file)
@@ -86,7 +86,7 @@ abstract class AbstractXmlParser implements LocalizationParserInterface
     }
 
     /**
-     * Checks if a localized file is found in typo3conf/l10n/ (e.g. a language pack was downloaded in the backend)
+     * Checks if a localized file is found in labels pack (e.g. a language pack was downloaded in the backend)
      * or if $sameLocation is set, then checks for a file located in "{language}.locallang.xlf" at the same directory
      *
      * @param string $fileRef Absolute file reference to locallang file
@@ -107,15 +107,15 @@ abstract class AbstractXmlParser implements LocalizationParserInterface
         }
 
         // Analyse file reference
-        if (GeneralUtility::isFirstPartOfStr($fileRef, Environment::getPublicPath() . '/typo3/sysext/')) {
+        if (GeneralUtility::isFirstPartOfStr($fileRef, Environment::getFrameworkBasePath() . '/')) {
             // Is system
-            $validatedPrefix = Environment::getPublicPath() . '/typo3/sysext/';
-        } elseif (GeneralUtility::isFirstPartOfStr($fileRef, Environment::getPublicPath() . '/typo3/ext/')) {
+            $validatedPrefix = Environment::getFrameworkBasePath() . '/';
+        } elseif (GeneralUtility::isFirstPartOfStr($fileRef, Environment::getBackendPath() . '/ext/')) {
             // Is global
-            $validatedPrefix = Environment::getPublicPath() . '/typo3/ext/';
-        } elseif (GeneralUtility::isFirstPartOfStr($fileRef, Environment::getPublicPath() . '/typo3conf/ext/')) {
+            $validatedPrefix = Environment::getBackendPath() . '/ext/';
+        } elseif (GeneralUtility::isFirstPartOfStr($fileRef, Environment::getExtensionsPath() . '/')) {
             // Is local
-            $validatedPrefix = Environment::getPublicPath() . '/typo3conf/ext/';
+            $validatedPrefix = Environment::getExtensionsPath() . '/';
         } else {
             $validatedPrefix = '';
         }
@@ -129,7 +129,7 @@ abstract class AbstractXmlParser implements LocalizationParserInterface
             // Add empty first-entry if not there.
             list($file_extPath, $file_fileName) = $temp;
             // The filename is prefixed with "[language key]." because it prevents the llxmltranslate tool from detecting it.
-            return Environment::getPublicPath() . '/typo3conf/l10n/' . $language . '/' . $extensionKey . '/' . ($file_extPath ? $file_extPath . '/' : '') . $language . '.' . $file_fileName;
+            return Environment::getLabelsPath() . '/' . $language . '/' . $extensionKey . '/' . ($file_extPath ? $file_extPath . '/' : '') . $language . '.' . $file_fileName;
         }
         return null;
     }
index 73bc906..b408eb9 100644 (file)
@@ -108,7 +108,7 @@ class PackageManager implements SingletonInterface
     public function __construct(DependencyOrderingService $dependencyOrderingService = null)
     {
         $this->packagesBasePath = Environment::getPublicPath() . '/';
-        $this->packageStatesPathAndFilename = Environment::getPublicPath() . '/typo3conf/PackageStates.php';
+        $this->packageStatesPathAndFilename = Environment::getLegacyConfigPath() . '/PackageStates.php';
         if ($dependencyOrderingService === null) {
             trigger_error(self::class . ' without constructor based dependency injection has been deprecated in v9.2 and will not work in TYPO3 v10.', E_USER_DEPRECATED);
             $dependencyOrderingService = GeneralUtility::makeInstance(DependencyOrderingService::class);
@@ -1075,13 +1075,13 @@ class PackageManager implements SingletonInterface
     {
         if (count($this->packagesBasePaths) < 3) {
             // Check if the directory even exists and if it is not empty
-            if (is_dir(Environment::getPublicPath() . '/typo3conf/ext') && $this->hasSubDirectories(Environment::getPublicPath() . '/typo3conf/ext')) {
-                $this->packagesBasePaths['local'] = Environment::getPublicPath() . '/typo3conf/ext/*/';
+            if (is_dir(Environment::getExtensionsPath()) && $this->hasSubDirectories(Environment::getExtensionsPath())) {
+                $this->packagesBasePaths['local'] = Environment::getExtensionsPath() . '/*/';
             }
-            if (is_dir(Environment::getPublicPath() . '/typo3/ext') && $this->hasSubDirectories(Environment::getPublicPath() . '/typo3/ext')) {
-                $this->packagesBasePaths['global'] = Environment::getPublicPath() . '/typo3/ext/*/';
+            if (is_dir(Environment::getBackendPath() . '/ext') && $this->hasSubDirectories(Environment::getBackendPath() . '/ext')) {
+                $this->packagesBasePaths['global'] = Environment::getBackendPath() . '/ext/*/';
             }
-            $this->packagesBasePaths['system'] = Environment::getPublicPath() . '/typo3/sysext/*/';
+            $this->packagesBasePaths['system'] = Environment::getFrameworkBasePath() . '/*/';
         }
         return $this->packagesBasePaths;
     }
index 5858f13..e74b5af 100644 (file)
@@ -85,7 +85,7 @@ class ResourceCompressor
                 $this->gzipCompressionLevel = (int)$compressionLevel;
             }
         }
-        $this->setRootPath(TYPO3_MODE === 'BE' ? Environment::getPublicPath() . '/typo3/' : Environment::getPublicPath() . '/');
+        $this->setRootPath(TYPO3_MODE === 'BE' ? Environment::getBackendPath() . '/' : Environment::getPublicPath() . '/');
     }
 
     /**
@@ -462,14 +462,14 @@ class ResourceCompressor
             return $fileNameWithoutSlash;
         }
         // if the file is from a special TYPO3 internal directory, add the missing typo3/ prefix
-        if (is_file(realpath(Environment::getPublicPath() . '/typo3/' . $filename))) {
+        if (is_file(realpath(Environment::getBackendPath() . '/' . $filename))) {
             $filename = 'typo3/' . $filename;
         }
         // build the file path relative to the public web path
         if (strpos($filename, 'EXT:') === 0) {
             $file = GeneralUtility::getFileAbsFileName($filename);
         } elseif (strpos($filename, '../') === 0) {
-            $file = GeneralUtility::resolveBackPath(Environment::getPublicPath() . '/typo3/' . $filename);
+            $file = GeneralUtility::resolveBackPath(Environment::getBackendPath() . '/' . $filename);
         } else {
             $file = Environment::getPublicPath() . '/' . $filename;
         }
index 07d9911..192714b 100644 (file)
@@ -10,9 +10,9 @@ Description
 ===========
 
 The language module in the backend offers the possibility to activate and deactivate language packs.
-If deactivating a language pack that previously had been loaded, the data stays in `typo3conf/l10n/<locale>/`.
+If deactivating a language pack that previously had been loaded, the data stays in `<labels-path>/<locale>/`.
 A remove button has been added to the actions. With the remove action the language is disabled and the data is removed
-from the `typo3conf/l10n/<locale>/` directory.
+from the `<labels-path>/<locale>/` directory.
 
 
 Impact
@@ -20,4 +20,4 @@ Impact
 
 The language data can now be removed from the installation file system using the backend user interface.
 
-.. index:: Backend
\ No newline at end of file
+.. index:: Backend
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-85560-LocationOfXLFLabelsDownloaded.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-85560-LocationOfXLFLabelsDownloaded.rst
new file mode 100644 (file)
index 0000000..775b76c
--- /dev/null
@@ -0,0 +1,18 @@
+.. include:: ../../Includes.txt
+
+=====================================================
+Important: #85560 - Location of XLF labels downloaded
+=====================================================
+
+See :issue:`85560`
+
+Description
+===========
+
+Downloaded files for XLF language files are usually stored within `typo3conf/l10n`, however, if the environment
+variable `TYPO3_PATH_ROOT` is set, which is common for all composer-based installations, the XLF language files
+are now found outside the document root, available under `var/labels/`.
+
+The Environment API :php:`Environment::getLabelsPath()` resolves the correct full location path prefix.
+
+.. index:: PHP-API
\ No newline at end of file
index 160aa9c..08d3b1d 100644 (file)
@@ -380,8 +380,8 @@ class ConfigurationManagerTest extends UnitTestCase
         /** @var $subject ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['dummy']);
 
-        $file = 'typo3temp/var/tests/' . $this->getUniqueId('test_');
-        $absoluteFile = Environment::getPublicPath() . '/' . $file;
+        $file = '../typo3temp/var/tests/' . $this->getUniqueId('test_');
+        $absoluteFile = Environment::getLegacyConfigPath() . '/' . $file;
         touch($absoluteFile);
         $this->testFilesToDelete[] = $absoluteFile;
         chmod($absoluteFile, 0444);
@@ -473,8 +473,8 @@ class ConfigurationManagerTest extends UnitTestCase
         /** @var $subject ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['dummy']);
 
-        $file = 'typo3temp/var/tests/' . $this->getUniqueId('test_');
-        $absoluteFile = Environment::getPublicPath() . '/' . $file;
+        $file = '../typo3temp/var/tests/' . $this->getUniqueId('test_');
+        $absoluteFile = Environment::getLegacyConfigPath() . '/' . $file;
         touch($absoluteFile);
         $this->testFilesToDelete[] = $absoluteFile;
         $subject->_set('localConfigurationFile', $file);
@@ -489,10 +489,10 @@ class ConfigurationManagerTest extends UnitTestCase
     {
         /** @var $subject ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['writeLocalConfiguration']);
-        $subject->_set('localConfigurationFile', 'typo3temp/var/tests/' . $this->getUniqueId('dummy_'));
+        $subject->_set('localConfigurationFile', '../../typo3temp/var/tests/' . $this->getUniqueId('dummy_'));
 
-        $factoryConfigurationFile = 'typo3temp/var/tests/' . $this->getUniqueId('test_') . '.php';
-        $factoryConfigurationAbsoluteFile = Environment::getPublicPath() . '/' . $factoryConfigurationFile;
+        $factoryConfigurationFile = '../../typo3temp/var/tests/' . $this->getUniqueId('test_') . '.php';
+        $factoryConfigurationAbsoluteFile = Environment::getFrameworkBasePath() . '/' . $factoryConfigurationFile;
         $uniqueContentString = $this->getUniqueId('string_');
         $validFactoryConfigurationFileContent =
             '<?php' . LF .
@@ -521,10 +521,10 @@ class ConfigurationManagerTest extends UnitTestCase
     {
         /** @var $subject ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['writeLocalConfiguration']);
-        $subject->_set('localConfigurationFile', 'typo3temp/var/tests/' . $this->getUniqueId('dummy_'));
+        $subject->_set('localConfigurationFile', '../../typo3temp/var/tests/' . $this->getUniqueId('dummy_'));
 
-        $factoryConfigurationFile = 'typo3temp/var/tests/' . $this->getUniqueId('test_') . '.php';
-        $factoryConfigurationAbsoluteFile = Environment::getPublicPath() . '/' . $factoryConfigurationFile;
+        $factoryConfigurationFile = '../../typo3temp/var/tests/' . $this->getUniqueId('test_') . '.php';
+        $factoryConfigurationAbsoluteFile = Environment::getFrameworkBasePath() . '/' . $factoryConfigurationFile;
         $validFactoryConfigurationFileContent =
             '<?php' . LF .
             'return [];' . LF;
index e665683..3090793 100644 (file)
@@ -58,7 +58,7 @@ class LocallangXmlParserTest extends UnitTestCase
     protected static function getFixtureFilePath($filename)
     {
         // We have to take the whole relative path as otherwise this test fails on Windows systems
-        return Environment::getPublicPath() . '/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/' . $filename;
+        return Environment::getFrameworkBasePath() . '/core/Tests/Unit/Localization/Parser/Fixtures/' . $filename;
     }
 
     /**
index a9b2e2a..c3eb2a6 100644 (file)
@@ -39,7 +39,7 @@ class XliffParserTest extends UnitTestCase
     protected function setUp()
     {
         // We have to take the whole relative path as otherwise this test fails on Windows systems
-        $fixturePath = Environment::getPublicPath() . '/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/';
+        $fixturePath = Environment::getFrameworkBasePath() . '/core/Tests/Unit/Localization/Parser/Fixtures/';
         $this->xliffFileNames = [
             'locallang' => $fixturePath . 'locallang.xlf',
             'locallang_override' => $fixturePath . 'locallang_override.xlf',
index 9d8b210..d91ba77 100644 (file)
@@ -2736,8 +2736,8 @@ class GeneralUtilityTest extends UnitTestCase
                 '"/dummy/path/" was not within directory Environment::getPublicPath() + "/typo3temp/"'
             ],
             [
-                Environment::getPublicPath() . '/typo3conf/path',
-                '"' . Environment::getPublicPath() . '/typo3conf/" was not within directory Environment::getPublicPath() + "/typo3temp/"',
+                Environment::getLegacyConfigPath() . '/path',
+                '"' . Environment::getLegacyConfigPath() . '/" was not within directory Environment::getPublicPath() + "/typo3temp/"',
             ],
             [
                 Environment::getPublicPath() . '/typo3temp/táylor/swíft',
@@ -3835,12 +3835,12 @@ class GeneralUtilityTest extends UnitTestCase
                 Environment::getPublicPath() . '/fileadmin/foo.txt'
             ],
             'Public web path . typo3/sysext/core/Resources/Public/Icons/Extension.png' => [
-                Environment::getPublicPath() . '/typo3/sysext/core/Resources/Public/Icons/Extension.png',
-                Environment::getPublicPath() . '/typo3/sysext/core/Resources/Public/Icons/Extension.png'
+                Environment::getFrameworkBasePath() . '/core/Resources/Public/Icons/Extension.png',
+                Environment::getFrameworkBasePath() . '/core/Resources/Public/Icons/Extension.png'
             ],
             'EXT:foo/Resources/Public/Icons/Extension.png' => [
                 'EXT:foo/Resources/Public/Icons/Extension.png',
-                Environment::getPublicPath() . '/typo3/sysext/foo/Resources/Public/Icons/Extension.png'
+                Environment::getFrameworkBasePath() . '/foo/Resources/Public/Icons/Extension.png'
             ]
         ];
     }
index 0fdbe40..8abd175 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Fluid\ViewHelpers\Debug;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
 
@@ -105,8 +106,16 @@ class RenderViewHelper extends AbstractViewHelper
         $debugInfo = [];
         if (isset($this->arguments['partial'])) {
             $path = $this->renderingContext->getTemplatePaths()->getPartialPathAndFilename($partial);
+            $path = str_replace(
+                [
+                    Environment::getBackendPath() . '/ext/',
+                    Environment::getExtensionsPath() . '/',
+                    Environment::getFrameworkBasePath() . '/'
+                ],
+                'EXT:',
+                $path
+            );
             $path = PathUtility::stripPathSitePrefix($path);
-            $path = str_replace(['typo3conf/ext/', 'typo3/sysext/'], 'EXT:', $path);
             $debugInfo['Partial'] = 'Partial: ' . $path;
         }
         if (isset($this->arguments['section'])) {
index bf72ff2..1cf1656 100644 (file)
@@ -4182,15 +4182,15 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         }
         $search = [
             '"typo3temp/',
-            '"typo3conf/ext/',
-            '"' . TYPO3_mainDir . 'ext/',
-            '"' . TYPO3_mainDir . 'sysext/'
+            '"' . PathUtility::stripPathSitePrefix(Environment::getExtensionsPath()) . '/',
+            '"' . PathUtility::stripPathSitePrefix(Environment::getBackendPath()) . '/ext/',
+            '"' . PathUtility::stripPathSitePrefix(Environment::getFrameworkBasePath()) . '/',
         ];
         $replace = [
             '"' . $this->absRefPrefix . 'typo3temp/',
-            '"' . $this->absRefPrefix . 'typo3conf/ext/',
-            '"' . $this->absRefPrefix . TYPO3_mainDir . 'ext/',
-            '"' . $this->absRefPrefix . TYPO3_mainDir . 'sysext/'
+            '"' . $this->absRefPrefix . PathUtility::stripPathSitePrefix(Environment::getExtensionsPath()) . '/',
+            '"' . $this->absRefPrefix . PathUtility::stripPathSitePrefix(Environment::getBackendPath()) . '/ext/',
+            '"' . $this->absRefPrefix . PathUtility::stripPathSitePrefix(Environment::getFrameworkBasePath()) . '/',
         ];
         /** @var StorageRepository $storageRepository */
         $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
@@ -4417,7 +4417,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         } else {
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
             // This is a hack to work around ___FILE___ resolving symbolic links
-            $realWebPath = PathUtility::dirname(realpath(Environment::getPublicPath() . '/typo3')) . '/';
+            $realWebPath = PathUtility::dirname(realpath(Environment::getBackendPath())) . '/';
             $file = $trace[0]['file'];
             if (strpos($file, $realWebPath) === 0) {
                 $file = str_replace($realWebPath, '', $file);
index 07aefbe..3f65ab6 100644 (file)
@@ -53,9 +53,9 @@ class FilePathSanitizer
             $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'],
             'uploads/',
             'typo3temp/',
-            TYPO3_mainDir . 'ext/',
-            TYPO3_mainDir . 'sysext/',
-            'typo3conf/ext/'
+            PathUtility::stripPathSitePrefix(Environment::getBackendPath()) . '/ext/',
+            PathUtility::stripPathSitePrefix(Environment::getFrameworkBasePath()) . '/',
+            PathUtility::stripPathSitePrefix(Environment::getExtensionsPath()) . '/',
         ];
         if (!empty($GLOBALS['TYPO3_CONF_VARS']['FE']['addAllowedPaths'])) {
             $paths = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['addAllowedPaths'], true);
index 7ddbf87..2bb5b0f 100644 (file)
@@ -180,7 +180,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase
         $this->standaloneView
             ->expects($this->any())
             ->method('setTemplatePathAndFilename')
-            ->with(Environment::getPublicPath() . '/typo3/sysext/core/bar.html');
+            ->with(Environment::getFrameworkBasePath() . '/core/bar.html');
         $this->subject->render(['file' => 'EXT:core/bar.html']);
     }
 
index c042144..46167d8 100644 (file)
@@ -157,7 +157,7 @@ class PagesAndTtContentWithImagesInEmptyDatabaseTest extends AbstractImportExpor
 
         $subject->loadFile(
             // Files are parallel to the fixture .xml file in a folder - impexp tests for /../ not allowed in path, so we set an absolute path here
-            Environment::getPublicPath() . '/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlImports/pages-and-ttcontent-with-image-but-not-included.xml',
+            Environment::getFrameworkBasePath() . '/impexp/Tests/Functional/Fixtures/XmlImports/pages-and-ttcontent-with-image-but-not-included.xml',
             1
         );
         $subject->importData(0);
index cbe45b8..d26ebe9 100644 (file)
@@ -291,7 +291,7 @@ class EnvironmentController extends AbstractController
         return $this->getImageTestResponse([
             'fileExists' => $fileExists,
             'outputFile' => $outputFile,
-            'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Font.gif',
+            'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Font.gif',
         ]);
     }
 
@@ -397,7 +397,7 @@ class EnvironmentController extends AbstractController
                 'status' => $messages,
                 'fileExists' => true,
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Write-gif.gif',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Write-gif.gif',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
@@ -430,7 +430,7 @@ class EnvironmentController extends AbstractController
             $result = [
                 'fileExists' => true,
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Write-png.png',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Write-png.png',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
@@ -463,7 +463,7 @@ class EnvironmentController extends AbstractController
             $result = [
                 'fileExists' => true,
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Scale-gif.gif',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Scale-gif.gif',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
@@ -496,7 +496,7 @@ class EnvironmentController extends AbstractController
             $result = [
                 'fileExists' => true,
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Scale-png.png',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Scale-png.png',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
@@ -529,7 +529,7 @@ class EnvironmentController extends AbstractController
             $result = [
                 'fileExists' => true,
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Scale-jpg.jpg',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Scale-jpg.jpg',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
@@ -566,7 +566,7 @@ class EnvironmentController extends AbstractController
             $result = [
                 'fileExists' => true,
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Combine-1.jpg',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Combine-1.jpg',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
@@ -603,7 +603,7 @@ class EnvironmentController extends AbstractController
             $result = [
                 'fileExists' => true,
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Combine-2.jpg',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Combine-2.jpg',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
@@ -639,7 +639,7 @@ class EnvironmentController extends AbstractController
         $result = [
             'fileExists' => true,
             'outputFile' => $imResult[3],
-            'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Gdlib-simple.' . $gifOrPng,
+            'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Gdlib-simple.' . $gifOrPng,
             'command' => $imageProcessor->IM_commands,
         ];
         return $this->getImageTestResponse($result);
@@ -669,7 +669,7 @@ class EnvironmentController extends AbstractController
         $result = [
             'fileExists' => true,
             'outputFile' => $imResult[3],
-            'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Gdlib-box.' . $gifOrPng,
+            'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Gdlib-box.' . $gifOrPng,
             'command' => $imageProcessor->IM_commands,
         ];
         return $this->getImageTestResponse($result);
@@ -706,7 +706,7 @@ class EnvironmentController extends AbstractController
         $result = [
             'fileExists' => true,
             'outputFile' => $imResult[3],
-            'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Gdlib-text.' . $gifOrPng,
+            'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Gdlib-text.' . $gifOrPng,
             'command' => $imageProcessor->IM_commands,
         ];
         return $this->getImageTestResponse($result);
@@ -753,7 +753,7 @@ class EnvironmentController extends AbstractController
         $result = [
             'fileExists' => true,
             'outputFile' => $imResult[3],
-            'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Gdlib-niceText.' . $gifOrPng,
+            'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Gdlib-niceText.' . $gifOrPng,
             'command' => $imageProcessor->IM_commands,
         ];
         return $this->getImageTestResponse($result);
@@ -813,7 +813,7 @@ class EnvironmentController extends AbstractController
         $result = [
             'fileExists' => true,
             'outputFile' => $imResult[3],
-            'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Gdlib-shadow.' . $gifOrPng,
+            'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Gdlib-shadow.' . $gifOrPng,
             'command' => $imageProcessor->IM_commands,
         ];
         return $this->getImageTestResponse($result);
@@ -887,7 +887,7 @@ class EnvironmentController extends AbstractController
             $result = [
                 'fileExists' => file_exists($imResult[3]),
                 'outputFile' => $imResult[3],
-                'referenceFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Public/Images/TestReference/Read-' . $inputFormat . '.jpg',
+                'referenceFile' => Environment::getFrameworkBasePath() . '/install/Resources/Public/Images/TestReference/Read-' . $inputFormat . '.jpg',
                 'command' => $imageProcessor->IM_commands,
             ];
         } else {
index 7887825..c4059df 100644 (file)
@@ -481,7 +481,7 @@ class UpgradeController extends AbstractController
      */
     public function extensionScannerGetDataAction(ServerRequestInterface $request): ResponseInterface
     {
-        $extensionsInTypo3conf = (new Finder())->directories()->in(Environment::getPublicPath() . '/typo3conf/ext')->depth(0)->sortByName();
+        $extensionsInTypo3conf = (new Finder())->directories()->in(Environment::getExtensionsPath())->depth(0)->sortByName();
         $view = $this->initializeStandaloneView($request, 'Upgrade/ExtensionScanner.html');
         $formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
         $view->assignMultiple([
@@ -506,7 +506,7 @@ class UpgradeController extends AbstractController
     {
         // Get and validate path
         $extension = $request->getParsedBody()['install']['extension'];
-        $extensionBasePath = Environment::getPublicPath() . '/typo3conf/ext/' . $extension;
+        $extensionBasePath = Environment::getExtensionsPath() . '/' . $extension;
         if (empty($extension) || !GeneralUtility::isAllowedAbsPath($extensionBasePath)) {
             throw new \RuntimeException(
                 'Path to extension ' . $extension . ' not allowed.',
@@ -594,7 +594,7 @@ class UpgradeController extends AbstractController
     {
         // Get and validate path and file
         $extension = $request->getParsedBody()['install']['extension'];
-        $extensionBasePath = Environment::getPublicPath() . '/typo3conf/ext/' . $extension;
+        $extensionBasePath = Environment::getExtensionsPath() . '/' . $extension;
         if (empty($extension) || !GeneralUtility::isAllowedAbsPath($extensionBasePath)) {
             throw new \RuntimeException(
                 'Path to extension ' . $extension . ' not allowed.',
index 59d56d7..fe04ae3 100644 (file)
@@ -101,7 +101,7 @@ class DefaultFactory
                                     'name' => '.htaccess',
                                     'type' => FileNode::class,
                                     'targetPermission' => $filePermission,
-                                    'targetContentFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/typo3temp-var-htaccess',
+                                    'targetContentFile' => Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/typo3temp-var-htaccess',
                                 ],
                                 [
                                     'name' => 'charset',
@@ -153,13 +153,13 @@ class DefaultFactory
                                     'name' => '.htaccess',
                                     'type' => FileNode::class,
                                     'targetPermission' => $filePermission,
-                                    'targetContentFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess',
+                                    'targetContentFile' => Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess',
                                 ],
                                 [
                                     'name' => 'index.html',
                                     'type' => FileNode::class,
                                     'targetPermission' => $filePermission,
-                                    'targetContentFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
+                                    'targetContentFile' => Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
                                 ],
                             ],
                         ],
@@ -188,13 +188,13 @@ class DefaultFactory
                                                     'name' => '.htaccess',
                                                     'type' => FileNode::class,
                                                     'targetPermission' => $filePermission,
-                                                    'targetContentFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-user_upload-temp-importexport-htaccess',
+                                                    'targetContentFile' => Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-user_upload-temp-importexport-htaccess',
                                                 ],
                                                 [
                                                     'name' => 'index.html',
                                                     'type' => FileNode::class,
                                                     'targetPermission' => $filePermission,
-                                                    'targetContentFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
+                                                    'targetContentFile' => Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
                                                 ],
                                             ],
                                         ],
index 64f030a..d4917c9 100644 (file)
@@ -75,14 +75,14 @@ class InstallStatusReport implements \TYPO3\CMS\Reports\StatusProviderInterface
             $varPath . '/charset/' => 2,
             $varPath . '/lock/' => 2,
             $sitePath . '/typo3conf/' => 2,
-            $sitePath . '/typo3conf/ext/' => 0,
-            $sitePath . '/typo3conf/l10n/' => 0,
+            Environment::getExtensionsPath() => 0,
+            Environment::getLabelsPath() => 0,
             $sitePath . '/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] => -1,
             $sitePath . '/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . '_temp_/' => 0,
         ];
 
         if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowGlobalInstall']) {
-            $checkWritable[TYPO3_mainDir . 'ext/'] = -1;
+            $checkWritable[Environment::getBackendPath() . '/ext/'] = -1;
         }
 
         foreach ($checkWritable as $path => $requirementLevel) {
index 9edc37c..df32954 100644 (file)
@@ -143,7 +143,7 @@ class LanguagePackService
             ];
             $extension['packs'] = [];
             foreach ($activeLanguages as $iso) {
-                $isLanguagePackDownloaded = is_dir(GeneralUtility::getFileAbsFileName('typo3conf/l10n/' . $iso . '/' . $key . '/'));
+                $isLanguagePackDownloaded = is_dir(Environment::getLabelsPath() . '/' . $iso . '/' . $key . '/');
                 $lastUpdate = $this->registry->get('languagePacks', $iso . '-' . $key);
                 $extension['packs'][] = [
                     'iso' => $iso,
@@ -245,7 +245,7 @@ class LanguagePackService
             $packageUrl = $key[0] . '/' . $key[1] . '/' . $key . '-l10n/' . $key . '-l10n-' . $iso . '.zip';
         }
 
-        $absoluteLanguagePath = GeneralUtility::getFileAbsFileName('typo3conf/l10n/' . $iso . '/');
+        $absoluteLanguagePath = Environment::getLabelsPath() . '/' . $iso . '/';
         $absoluteExtractionPath = $absoluteLanguagePath . $key . '/';
         $absolutePathToZipFile = Environment::getVarPath() . '/transient/' . $key . '-l10n-' . $iso . '.zip';