[TASK] Use file_get_contents instead of getUrl() 09/47309/5
authorBenni Mack <benni@typo3.org>
Fri, 18 Mar 2016 07:53:32 +0000 (08:53 +0100)
committerBenni Mack <benni@typo3.org>
Tue, 29 Mar 2016 05:24:42 +0000 (07:24 +0200)
The method GeneralUtility::getUrl() is used a lot in the
core where only local files are allowed.

Most occurrences can be replaced by using the native
file_get_contents() PHP function.

file_get_contents() is now always used when

* is_file() is called
* only local paths (e.g. prefixed with PATH_site)
* absolute paths (GeneralUtility::getFileAbsFileName)
* ensured that files within extensions

are checked before. In these cases getUrl() MUST NOT BE
USED but built-in file_get_contents() must be used instead.

Resolves: #75178
Releases: master
Change-Id: Ia88879d8fa44fd88e604b3332c1a710c33e5d3ec
Reviewed-on: https://review.typo3.org/47309
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Daniel Gorges <daniel.gorges@b13.de>
Tested-by: Daniel Gorges <daniel.gorges@b13.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
30 files changed:
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaFlexFetch.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/core/Classes/Charset/CharsetConverter.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Messaging/AbstractStandaloneMessage.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Resource/ResourceCompressor.php
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
typo3/sysext/core/Classes/TypoScript/TemplateService.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/extensionmanager/Classes/Controller/UploadExtensionFileController.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/impexp/Classes/Export.php
typo3/sysext/impexp/Classes/Import.php
typo3/sysext/indexed_search/Classes/FileContentParser.php
typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionCompatibilityTester.php
typo3/sysext/install/Classes/Controller/Action/Tool/AllConfiguration.php
typo3/sysext/install/Classes/Service/SqlExpectedSchemaService.php
typo3/sysext/install/Classes/Updates/ExtensionManagerTables.php
typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
typo3/sysext/lowlevel/Classes/CleanerCommand.php
typo3/sysext/rtehtmlarea/Classes/Extension/MicroDataSchema.php
typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php
typo3/sysext/t3editor/Classes/T3editor.php
typo3/sysext/version/Classes/Hook/PreviewHook.php

index 8804edb..ecabf5e 100644 (file)
@@ -365,7 +365,7 @@ class BackendController
             $cssFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css');
             if (file_exists($absoluteComponentPath . 'css/loadorder.txt')) {
                 // Don't allow inclusion outside directory
-                $loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'css/loadorder.txt'));
+                $loadOrder = str_replace('../', '', file_get_contents($absoluteComponentPath . 'css/loadorder.txt'));
                 $cssFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, true);
                 $cssFiles = array_merge($cssFilesOrdered, $cssFiles);
             }
@@ -375,7 +375,7 @@ class BackendController
             $jsFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'javascript/', 'js');
             if (file_exists($absoluteComponentPath . 'javascript/loadorder.txt')) {
                 // Don't allow inclusion outside directory
-                $loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'javascript/loadorder.txt'));
+                $loadOrder = str_replace('../', '', file_get_contents($absoluteComponentPath . 'javascript/loadorder.txt'));
                 $jsFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, true);
                 $jsFiles = array_merge($jsFilesOrdered, $jsFiles);
             }
index 316fc5a..c8c6f0a 100644 (file)
@@ -770,7 +770,7 @@ abstract class AbstractItemProvider
                     if (!is_array($dataStructure)) {
                         $file = GeneralUtility::getFileAbsFileName(str_ireplace('FILE:', '', $dataStructure));
                         if ($file && @is_file($file)) {
-                            $dataStructure = GeneralUtility::getUrl($file);
+                            $dataStructure = file_get_contents($file);
                         }
                         $dataStructure = GeneralUtility::xml2array($dataStructure);
                         if (!is_array($dataStructure)) {
index 64bfe0b..6a5b797 100644 (file)
@@ -131,7 +131,7 @@ class TcaFlexFetch implements FormDataProviderInterface
                 if (!is_array($sheetStructure)) {
                     $file = GeneralUtility::getFileAbsFileName($sheetStructure);
                     if ($file && @is_file($file)) {
-                        $sheetStructure = GeneralUtility::xml2array(GeneralUtility::getUrl($file));
+                        $sheetStructure = GeneralUtility::xml2array(file_get_contents($file));
                     }
                 }
                 $modifiedDataStructure['sheets'][$sheetName] = $sheetStructure;
index 47f697d..dc763f6 100644 (file)
@@ -1259,7 +1259,7 @@ function jumpToUrl(URL) {
         }
         $htmlTemplate = '';
         if ($filename !== '') {
-            $htmlTemplate = GeneralUtility::getUrl($filename);
+            $htmlTemplate = file_get_contents($filename);
         }
         return $htmlTemplate;
     }
index 4dee2a8..14561eb 100755 (executable)
@@ -848,7 +848,7 @@ class BackendUtility
             if (substr($ds_array[$srcPointer], 0, 5) == 'FILE:') {
                 $file = GeneralUtility::getFileAbsFileName(substr($ds_array[$srcPointer], 5));
                 if ($file && @is_file($file)) {
-                    $dataStructArray = GeneralUtility::xml2array(GeneralUtility::getUrl($file));
+                    $dataStructArray = GeneralUtility::xml2array(file_get_contents($file));
                 } else {
                     $dataStructArray = 'The file "' . substr($ds_array[$srcPointer], 5) . '" in ds-array key "' . $srcPointer . '" was not found ("' . $file . '")';
                 }
@@ -901,7 +901,7 @@ class BackendUtility
                         if (strpos($dataStructRec[$fName], '<') === false) {
                             if (is_file(PATH_site . $dataStructRec[$fName])) {
                                 // The value is a pointer to a file
-                                $dataStructArray = GeneralUtility::xml2array(GeneralUtility::getUrl(PATH_site . $dataStructRec[$fName]));
+                                $dataStructArray = GeneralUtility::xml2array(file_get_contents(PATH_site . $dataStructRec[$fName]));
                             } else {
                                 $dataStructArray = sprintf('File \'%s\' was not found', $dataStructRec[$fName]);
                             }
@@ -916,7 +916,7 @@ class BackendUtility
                     // Otherwise expect it to be a file:
                     $file = GeneralUtility::getFileAbsFileName($srcPointer);
                     if ($file && @is_file($file)) {
-                        $dataStructArray = GeneralUtility::xml2array(GeneralUtility::getUrl($file));
+                        $dataStructArray = GeneralUtility::xml2array(file_get_contents($file));
                     } else {
                         // Error message.
                         $dataStructArray = 'The file "' . $srcPointer . '" was not found ("' . $file . '")';
@@ -1043,7 +1043,7 @@ class BackendUtility
                                 $includeTsConfigFileAndPath = ExtensionManagementUtility::extPath($includeTsConfigFileExtensionKey) .
                                     $includeTsConfigFilename;
                                 if (file_exists($includeTsConfigFileAndPath)) {
-                                    $TSdataArray['uid_' . $v['uid'] . '_static_' . $key] = GeneralUtility::getUrl($includeTsConfigFileAndPath);
+                                    $TSdataArray['uid_' . $v['uid'] . '_static_' . $key] = file_get_contents($includeTsConfigFileAndPath);
                                 }
                             }
                         }
index 6c98ca5..d9f2689 100644 (file)
@@ -757,10 +757,10 @@ class CharsetConverter implements SingletonInterface
                 // Caching brought parsing time for gb2312 down from 2400 ms to 150 ms. For other charsets we are talking 11 ms down to zero.
                 $cacheFile = GeneralUtility::getFileAbsFileName('typo3temp/var/charset/charset_' . $charset . '.tbl');
                 if ($cacheFile && @is_file($cacheFile)) {
-                    $this->parsedCharsets[$charset] = unserialize(GeneralUtility::getUrl($cacheFile));
+                    $this->parsedCharsets[$charset] = unserialize(file_get_contents($cacheFile));
                 } else {
                     // Parse conversion table into lines:
-                    $lines = GeneralUtility::trimExplode(LF, GeneralUtility::getUrl($charsetConvTableFile), true);
+                    $lines = GeneralUtility::trimExplode(LF, file_get_contents($charsetConvTableFile), true);
                     // Initialize the internal variable holding the conv. table:
                     $this->parsedCharsets[$charset] = array('local' => array(), 'utf8' => array());
                     // traverse the lines:
@@ -824,7 +824,7 @@ class CharsetConverter implements SingletonInterface
                 }
                 // Use cached version if possible
                 if ($cacheFileCase && @is_file($cacheFileCase)) {
-                    $this->caseFolding['utf-8'] = unserialize(GeneralUtility::getUrl($cacheFileCase));
+                    $this->caseFolding['utf-8'] = unserialize(file_get_contents($cacheFileCase));
                     return 2;
                 }
                 break;
@@ -834,7 +834,7 @@ class CharsetConverter implements SingletonInterface
                 }
                 // Use cached version if possible
                 if ($cacheFileASCII && @is_file($cacheFileASCII)) {
-                    $this->toASCII['utf-8'] = unserialize(GeneralUtility::getUrl($cacheFileASCII));
+                    $this->toASCII['utf-8'] = unserialize(file_get_contents($cacheFileASCII));
                     return 2;
                 }
                 break;
@@ -1058,7 +1058,7 @@ class CharsetConverter implements SingletonInterface
         // Use cached version if possible
         $cacheFile = GeneralUtility::getFileAbsFileName('typo3temp/var/charset/cscase_' . $charset . '.tbl');
         if ($cacheFile && @is_file($cacheFile)) {
-            $this->caseFolding[$charset] = unserialize(GeneralUtility::getUrl($cacheFile));
+            $this->caseFolding[$charset] = unserialize(file_get_contents($cacheFile));
             return 2;
         }
         // init UTF-8 conversion for this charset
@@ -1120,7 +1120,7 @@ class CharsetConverter implements SingletonInterface
         // Use cached version if possible
         $cacheFile = GeneralUtility::getFileAbsFileName('typo3temp/var/charset/csascii_' . $charset . '.tbl');
         if ($cacheFile && @is_file($cacheFile)) {
-            $this->toASCII[$charset] = unserialize(GeneralUtility::getUrl($cacheFile));
+            $this->toASCII[$charset] = unserialize(file_get_contents($cacheFile));
             return 2;
         }
         // Init UTF-8 conversion for this charset
index f62e98b..a14fb60 100644 (file)
@@ -871,7 +871,7 @@ class Bootstrap
             throw new \RuntimeException('TYPO3 Backend locked: Backend and Install Tool are locked for maintenance. [BE][adminOnly] is set to "' . (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] . '".', 1294586847);
         }
         if (@is_file(PATH_typo3conf . 'LOCK_BACKEND') && $forceProceeding === false) {
-            $fileContent = GeneralUtility::getUrl(PATH_typo3conf . 'LOCK_BACKEND');
+            $fileContent = file_get_contents(PATH_typo3conf . 'LOCK_BACKEND');
             if ($fileContent) {
                 header('Location: ' . $fileContent);
             } else {
index d038965..268aa47 100644 (file)
@@ -134,7 +134,7 @@ abstract class AbstractStandaloneMessage extends AbstractMessage
     public function render()
     {
         $markers = array_merge($this->getDefaultMarkers(), $this->markers);
-        $content = GeneralUtility::getUrl($this->htmlTemplate);
+        $content = file_get_contents($this->htmlTemplate);
         $templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class);
         $content = $templateService->substituteMarkerArray($content, $markers, '', false, true);
         return $content;
index 6a81d63..9a01f32 100644 (file)
@@ -2007,13 +2007,17 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
     protected function getTemplateForPart($part)
     {
         $templateFile = GeneralUtility::getFileAbsFileName($this->templateFile);
-        $template = GeneralUtility::getUrl($templateFile);
-        if ($this->removeLineBreaksFromTemplate) {
-            $template = strtr($template, array(LF => '', CR => ''));
-        }
-        if ($part !== self::PART_COMPLETE) {
-            $templatePart = explode('###BODY###', $template);
-            $template = $templatePart[$part - 1];
+        if (is_file($templateFile)) {
+            $template = file_get_contents($templateFile);
+            if ($this->removeLineBreaksFromTemplate) {
+                $template = strtr($template, array(LF => '', CR => ''));
+            }
+            if ($part !== self::PART_COMPLETE) {
+                $templatePart = explode('###BODY###', $template);
+                $template = $templatePart[$part - 1];
+            }
+        } else {
+            $template = '';
         }
         return $template;
     }
index 410dcd3..194aaeb 100644 (file)
@@ -282,7 +282,7 @@ class ResourceCompressor
             foreach ($filesToInclude as $filename) {
                 $filenameAbsolute = GeneralUtility::resolveBackPath($this->rootPath . $filename);
                 $filename = PathUtility::stripPathSitePrefix($filenameAbsolute);
-                $contents = GeneralUtility::getUrl($filenameAbsolute);
+                $contents = file_get_contents($filenameAbsolute);
                 // remove any UTF-8 byte order mark (BOM) from files
                 if (StringUtility::beginsWith($contents, "\xEF\xBB\xBF")) {
                     $contents = substr($contents, 3);
@@ -354,7 +354,7 @@ class ResourceCompressor
         $targetFile = $this->targetDirectory . $pathinfo['filename'] . '-' . md5($unique) . '.css';
         // only create it, if it doesn't exist, yet
         if (!file_exists(PATH_site . $targetFile) || $this->createGzipped && !file_exists(PATH_site . $targetFile . '.gzip')) {
-            $contents = $this->compressCssString(GeneralUtility::getUrl($filenameAbsolute));
+            $contents = $this->compressCssString(file_get_contents($filenameAbsolute));
             if (strpos($filename, $this->targetDirectory) === false) {
                 $contents = $this->cssFixRelativeUrlPaths($contents, PathUtility::dirname($filename) . '/');
             }
@@ -406,7 +406,7 @@ class ResourceCompressor
         $targetFile = $this->targetDirectory . $pathinfo['filename'] . '-' . md5($unique) . '.js';
         // only create it, if it doesn't exist, yet
         if (!file_exists(PATH_site . $targetFile) || $this->createGzipped && !file_exists(PATH_site . $targetFile . '.gzip')) {
-            $contents = GeneralUtility::getUrl($filenameAbsolute);
+            $contents = file_get_contents($filenameAbsolute);
             $this->writeFileAndCompressed($targetFile, $contents);
         }
         return $this->returnFileReference($targetFile);
@@ -614,7 +614,7 @@ class ResourceCompressor
         $filename = $this->targetDirectory . 'external-' . md5($url);
         // write only if file does not exist and md5 of the content is not the same as fetched one
         if (!file_exists(PATH_site . $filename)
-            && (md5($externalContent) !== md5(GeneralUtility::getUrl(PATH_site . $filename)))
+            && (md5($externalContent) !== md5(file_get_contents(PATH_site . $filename)))
         ) {
             GeneralUtility::writeFile(PATH_site . $filename, $externalContent);
         }
index a820608..1596b84 100644 (file)
@@ -936,7 +936,7 @@ class TypoScriptParser
             } else {
                 $includedFiles[] = $absfilename;
                 // check for includes in included text
-                $included_text = self::checkIncludeLines(GeneralUtility::getUrl($absfilename), $cycle_counter + 1, $returnFiles, $absfilename);
+                $included_text = self::checkIncludeLines(file_get_contents($absfilename), $cycle_counter + 1, $returnFiles, $absfilename);
                 // If the method also has to return all included files, merge currently included
                 // files with files included by recursively calling itself
                 if ($returnFiles && is_array($included_text)) {
index 063db45..0725243 100644 (file)
@@ -803,8 +803,8 @@ class TemplateService
                             $subrow = array(
                                 'constants' => $this->getTypoScriptSourceFileContent($ISF_filePath, 'constants'),
                                 'config' => $this->getTypoScriptSourceFileContent($ISF_filePath, 'setup'),
-                                'include_static' => @file_exists(($ISF_filePath . 'include_static.txt')) ? implode(',', array_unique(GeneralUtility::intExplode(',', GeneralUtility::getUrl($ISF_filePath . 'include_static.txt')))) : '',
-                                'include_static_file' => @file_exists(($ISF_filePath . 'include_static_file.txt')) ? implode(',', array_unique(explode(',', GeneralUtility::getUrl($ISF_filePath . 'include_static_file.txt')))) : '',
+                                'include_static' => @file_exists(($ISF_filePath . 'include_static.txt')) ? implode(',', array_unique(GeneralUtility::intExplode(',', file_get_contents($ISF_filePath . 'include_static.txt')))) : '',
+                                'include_static_file' => @file_exists(($ISF_filePath . 'include_static_file.txt')) ? implode(',', array_unique(explode(',', file_get_contents($ISF_filePath . 'include_static_file.txt')))) : '',
                                 'title' => $ISF_file,
                                 'uid' => $mExtKey
                             );
@@ -848,7 +848,7 @@ class TemplateService
         foreach ($extensions as $extension) {
             $fileName = $filePath . $baseName . $extension;
             if (@file_exists($fileName)) {
-                return GeneralUtility::getUrl($fileName);
+                return file_get_contents($fileName);
             }
         }
         return '';
@@ -874,8 +874,8 @@ class TemplateService
             if ((is_array($files) || $files instanceof \ArrayAccess) && ($files['ext_typoscript_constants.txt'] || $files['ext_typoscript_setup.txt'])) {
                 $mExtKey = str_replace('_', '', $extKey);
                 $subrow = array(
-                    'constants' => $files['ext_typoscript_constants.txt'] ? GeneralUtility::getUrl($files['ext_typoscript_constants.txt']) : '',
-                    'config' => $files['ext_typoscript_setup.txt'] ? GeneralUtility::getUrl($files['ext_typoscript_setup.txt']) : '',
+                    'constants' => $files['ext_typoscript_constants.txt'] ? @file_get_contents($files['ext_typoscript_constants.txt']) : '',
+                    'config' => $files['ext_typoscript_setup.txt'] ? @file_get_contents($files['ext_typoscript_setup.txt']) : '',
                     'title' => $extKey,
                     'uid' => $mExtKey
                 );
@@ -1163,7 +1163,7 @@ class TemplateService
 
             $tsConfigFile = ExtensionManagementUtility::extPath($extensionKey) . $filePath;
             if (file_exists($tsConfigFile)) {
-                $TSdataArray[] = GeneralUtility::getUrl($tsConfigFile);
+                $TSdataArray[] = file_get_contents($tsConfigFile);
             }
         }
 
@@ -1397,7 +1397,7 @@ class TemplateService
      *
      * @param string $fileName Absolute filepath to record
      * @return NULL|string The content returned
-     * @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::fileResource(), \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::MULTIMEDIA(), GeneralUtility::getUrl()
+     * @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::fileResource(), GeneralUtility::getUrl()
      */
     public function fileContent($fileName)
     {
index 14f9fb0..b3d0f6c 100644 (file)
@@ -1661,7 +1661,7 @@ tt_content.' . $key . $suffix . ' {
                 $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
                 $phpCodeToCache[] = '';
                 // Add ext_localconf.php content of extension
-                $phpCodeToCache[] = trim(GeneralUtility::getUrl($extensionDetails['ext_localconf.php']));
+                $phpCodeToCache[] = trim(file_get_contents($extensionDetails['ext_localconf.php']));
                 $phpCodeToCache[] = '';
                 $phpCodeToCache[] = '';
             }
@@ -1916,7 +1916,7 @@ tt_content.' . $key . $suffix . ' {
                 $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
                 $phpCodeToCache[] = '';
                 // Add ext_tables.php content of extension
-                $phpCodeToCache[] = trim(GeneralUtility::getUrl($extensionDetails['ext_tables.php']));
+                $phpCodeToCache[] = trim(file_get_contents($extensionDetails['ext_tables.php']));
                 $phpCodeToCache[] = '';
             }
         }
index c0b6bcd..8897bb4 100755 (executable)
@@ -3784,7 +3784,7 @@ class GeneralUtility
             if ($dataStruct && !is_array($dataStruct)) {
                 $file = self::getFileAbsFileName($dataStruct);
                 if ($file && @is_file($file)) {
-                    $dataStruct = self::xml2array(self::getUrl($file));
+                    $dataStruct = self::xml2array(file_get_contents($file));
                 }
             }
         } else {
index a0fbc82..80aff46 100644 (file)
@@ -244,7 +244,7 @@ class UploadExtensionFileController extends AbstractController
      */
     protected function getExtensionFromT3xFile($file, $overwrite = false)
     {
-        $fileContent = GeneralUtility::getUrl($file);
+        $fileContent = file_get_contents($file);
         if (!$fileContent) {
             throw new ExtensionManagerException('File had no or wrong content.', 1342859339);
         }
index 6d6b5e9..9d34f06 100644 (file)
@@ -378,7 +378,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface
         $extTablesSqlFile = PATH_site . $extension['siteRelPath'] . 'ext_tables.sql';
         $extTablesSqlContent = '';
         if (file_exists($extTablesSqlFile)) {
-            $extTablesSqlContent .= GeneralUtility::getUrl($extTablesSqlFile);
+            $extTablesSqlContent .= file_get_contents($extTablesSqlFile);
         }
         if ($extTablesSqlContent !== '') {
             $this->updateDbWithExtTablesSql($extTablesSqlContent);
@@ -560,7 +560,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface
     {
         $sqlData = '';
         if (file_exists($sqlFile)) {
-            $sqlContent = GeneralUtility::getUrl($sqlFile);
+            $sqlContent = file_get_contents($sqlFile);
             $fieldDefinitions = $this->installToolSqlParser->getFieldDefinitions_fileContent($sqlContent);
             $sqlData = $this->databaseUtility->dumpStaticTables($fieldDefinitions);
         }
@@ -681,7 +681,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface
         if (!$this->registry->get('extensionDataImport', $extTablesStaticSqlRelFile)) {
             $extTablesStaticSqlFile = PATH_site . $extTablesStaticSqlRelFile;
             if (file_exists($extTablesStaticSqlFile)) {
-                $extTablesStaticSqlContent = GeneralUtility::getUrl($extTablesStaticSqlFile);
+                $extTablesStaticSqlContent = file_get_contents($extTablesStaticSqlFile);
                 $this->importStaticSql($extTablesStaticSqlContent);
             }
             $this->registry->set('extensionDataImport', $extTablesStaticSqlRelFile, 1);
index 9e0f10e..0b2f99d 100644 (file)
@@ -2037,7 +2037,7 @@ class TypoScriptFrontendController
                         GeneralUtility::getIndpEnv('REQUEST_URI'),
                         htmlspecialchars($reason)
                     ),
-                    GeneralUtility::getUrl($readFile)
+                    file_get_contents($readFile)
                 );
             } else {
                 throw new \RuntimeException('Configuration Error: 404 page "' . $readFile . '" could not be found.', 1294587214);
index d26c83a..a8788b9 100644 (file)
@@ -768,7 +768,7 @@ class Export extends ImportExport
         $fileMd5 = md5_file($fI['ID_absFile']);
         if (!$this->saveFilesOutsideExportFile) {
             // ... and finally add the heavy stuff:
-            $fileRec['content'] = GeneralUtility::getUrl($fI['ID_absFile']);
+            $fileRec['content'] = file_get_contents($fI['ID_absFile']);
         } else {
             GeneralUtility::upload_copy_move($fI['ID_absFile'], $this->getTemporaryFilesPathForExport() . $fileMd5);
         }
@@ -793,7 +793,7 @@ class Export extends ImportExport
                     $fileMd5 = md5_file($RTEoriginal_absPath);
                     if (!$this->saveFilesOutsideExportFile) {
                         // ... and finally add the heavy stuff:
-                        $fileRec['content'] = GeneralUtility::getUrl($RTEoriginal_absPath);
+                        $fileRec['content'] = file_get_contents($RTEoriginal_absPath);
                     } else {
                         GeneralUtility::upload_copy_move($RTEoriginal_absPath, $this->getTemporaryFilesPathForExport() . $fileMd5);
                     }
@@ -838,7 +838,7 @@ class Export extends ImportExport
                                 // Setting this data in the header
                                 $this->dat['header']['files'][$EXTres_ID] = $fileRec;
                                 // ... and finally add the heavy stuff:
-                                $fileRec['content'] = GeneralUtility::getUrl($EXTres_absPath);
+                                $fileRec['content'] = file_get_contents($EXTres_absPath);
                                 $fileRec['content_md5'] = md5($fileRec['content']);
                                 $this->dat['files'][$EXTres_ID] = $fileRec;
                             }
index 90dd435..361e11b 100644 (file)
@@ -1775,7 +1775,7 @@ class Import extends ImportExport
         }
         GeneralUtility::writeFile($fileName, $this->dat['files'][$fileID]['content']);
         $this->fileIDMap[$fileID] = $fileName;
-        if (md5(GeneralUtility::getUrl($fileName)) == $this->dat['files'][$fileID]['content_md5']) {
+        if (md5(file_get_contents($fileName)) == $this->dat['files'][$fileID]['content_md5']) {
             return true;
         } else {
             $this->error('ERROR: File content "' . $fileName . '" was corrupted');
@@ -1990,7 +1990,7 @@ class Import extends ImportExport
         }
         if (strtolower($fI['extension']) == 'xml') {
             // XML:
-            $xmlContent = GeneralUtility::getUrl($filename);
+            $xmlContent = file_get_contents($filename);
             if (strlen($xmlContent)) {
                 $this->dat = GeneralUtility::xml2array($xmlContent, '', true);
                 if (is_array($this->dat)) {
index 1732c08..9cc7be2 100644 (file)
@@ -483,7 +483,7 @@ class FileContentParser
                         $cmd = $this->app['pdftotext'] . ' -f ' . $low . ' -l ' . $high . ' -enc UTF-8 -q ' . escapeshellarg($absFile) . ' ' . $tempFileName;
                         CommandUtility::exec($cmd);
                         if (@is_file($tempFileName)) {
-                            $content = GeneralUtility::getUrl($tempFileName);
+                            $content = file_get_contents($tempFileName);
                             unlink($tempFileName);
                         } else {
                             $content = '';
index c52ec13..1dd9e85 100644 (file)
@@ -119,8 +119,12 @@ class ExtensionCompatibilityTester extends AbstractAjaxAction
      */
     protected function getExtensionsToExclude()
     {
-        $exclude = GeneralUtility::getUrl($this->protocolFile);
-        return GeneralUtility::trimExplode(',', (string)$exclude);
+        if (is_file($this->protocolFile)) {
+            $exclude = (string)file_get_contents($this->protocolFile);
+            return GeneralUtility::trimExplode(',', $exclude);
+        } else {
+            return [];
+        }
     }
 
     /**
@@ -205,7 +209,8 @@ class ExtensionCompatibilityTester extends AbstractAjaxAction
      */
     protected function writeCurrentExtensionToFile($extensionKey)
     {
-        $incompatibleExtensions = array_filter(GeneralUtility::trimExplode(',', (string)GeneralUtility::getUrl($this->protocolFile)));
+        $incompatibleExtensions = $this->getExtensionsToExclude();
+        $incompatibleExtensions = array_filter($incompatibleExtensions);
         $incompatibleExtensions = array_merge($incompatibleExtensions, array($extensionKey));
         GeneralUtility::writeFile($this->protocolFile, implode(', ', $incompatibleExtensions));
         $this->logError = true;
@@ -219,7 +224,8 @@ class ExtensionCompatibilityTester extends AbstractAjaxAction
      */
     protected function removeCurrentExtensionFromFile($extensionKey)
     {
-        $extensionsInFile = array_filter(GeneralUtility::trimExplode(',', (string)GeneralUtility::getUrl($this->protocolFile)));
+        $extensionsInFile = $this->getExtensionsToExclude();
+        $extensionsInFile = array_filter($extensionsInFile);
         $extensionsByKey = array_flip($extensionsInFile);
         unset($extensionsByKey[$extensionKey]);
         $extensionsForFile = array_flip($extensionsByKey);
@@ -244,7 +250,7 @@ class ExtensionCompatibilityTester extends AbstractAjaxAction
         $errors = array();
 
         if (file_exists($this->errorProtocolFile)) {
-            $errors = json_decode(GeneralUtility::getUrl($this->errorProtocolFile));
+            $errors = json_decode(file_get_contents($this->errorProtocolFile));
         }
         switch ($lastError['type']) {
             case E_ERROR:
index 4966524..92a7f80 100644 (file)
@@ -194,7 +194,7 @@ class AllConfiguration extends Action\AbstractAction
     {
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
         $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
-        $string = GeneralUtility::getUrl($configurationManager->getDefaultConfigurationFileLocation());
+        $string = file_get_contents($configurationManager->getDefaultConfigurationFileLocation());
 
         $commentArray = array();
         $lines = explode(LF, $string);
index 9dc4592..c4938f2 100644 (file)
@@ -68,13 +68,13 @@ class SqlExpectedSchemaService
         $loadedExtensionInformation = $GLOBALS['TYPO3_LOADED_EXT'];
         foreach ($loadedExtensionInformation as $extensionConfiguration) {
             if ((is_array($extensionConfiguration) || $extensionConfiguration instanceof \ArrayAccess) && $extensionConfiguration['ext_tables.sql']) {
-                $sqlString[] = GeneralUtility::getUrl($extensionConfiguration['ext_tables.sql']);
+                $sqlString[] = file_get_contents($extensionConfiguration['ext_tables.sql']);
             }
             if ($withStatic
                 && (is_array($extensionConfiguration) || $extensionConfiguration instanceof \ArrayAccess)
                 && $extensionConfiguration['ext_tables_static+adt.sql']
             ) {
-                $sqlString[] = GeneralUtility::getUrl($extensionConfiguration['ext_tables_static+adt.sql']);
+                $sqlString[] = file_get_contents($extensionConfiguration['ext_tables_static+adt.sql']);
             }
         }
 
index 0727911..26da1aa 100644 (file)
@@ -55,7 +55,7 @@ class ExtensionManagerTables extends AbstractUpdate
         $updateStatements = array();
 
         // Get all necessary statements for ext_tables.sql file
-        $rawDefinitions = GeneralUtility::getUrl(ExtensionManagementUtility::extPath('extensionmanager') . '/ext_tables.sql');
+        $rawDefinitions = file_get_contents(ExtensionManagementUtility::extPath('extensionmanager', 'ext_tables.sql'));
         $fieldDefinitionsFromFile = $this->getInstallToolSqlParser()->getFieldDefinitions_fileContent($rawDefinitions);
         if (count($fieldDefinitionsFromFile)) {
             $fieldDefinitionsFromCurrentDatabase = $this->getInstallToolSqlParser()->getFieldDefinitions_database();
@@ -137,9 +137,9 @@ class ExtensionManagerTables extends AbstractUpdate
             $result = ($result || $this->hasError($customMessages));
         }
 
-        // Perform statis import anyway
-        $rawDefinitions = GeneralUtility::getUrl(ExtensionManagementUtility::extPath('extensionmanager') . 'ext_tables_static+adt.sql');
-        $statements = $this->getInstallToolSqlParser()->getStatementarray($rawDefinitions, 1);
+        // Perform statics import anyway
+        $rawDefinitions = file_get_contents(ExtensionManagementUtility::extPath('extensionmanager', 'ext_tables_static+adt.sql'));
+        $statements = $this->getInstallToolSqlParser()->getStatementArray($rawDefinitions, 1);
         foreach ($statements as $statement) {
             if (trim($statement) !== '') {
                 $this->getDatabaseConnection()->admin_query($statement);
index d0917e2..9fd3608 100644 (file)
@@ -271,7 +271,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
                 );
             }
         }
-        $htmlFile = GeneralUtility::getURL($file);
+        $htmlFile = file_get_contents($file);
         $this->templateMail = $this->templateService->getSubpart($htmlFile, '###REPORT_TEMPLATE###');
         // The array to put the content into
         $pageSections = '';
index f234049..25a8d23 100644 (file)
@@ -111,7 +111,7 @@ This will show you missing files in the TYPO3 system and only report back if err
         $GLOBALS['BE_USER']->setWorkspace(0);
         // Print Howto:
         if ($this->cli_isArg('--showhowto')) {
-            $howto = GeneralUtility::getUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lowlevel') . 'README.rst');
+            $howto = file_get_contents(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lowlevel') . 'README.rst');
             echo wordwrap($howto, 120) . LF;
             die;
         }
index e8f03d3..31745f2 100644 (file)
@@ -66,7 +66,7 @@ class MicroDataSchema extends RteHtmlAreaApi
                     $fileName = 'EXT:' . $this->extensionKey . '/Resources/Public/Rdf/MicrodataSchema/SchemaOrgAll.rdf';
                 }
                 $fileName = $this->getFullFileName($fileName);
-                $rdf = GeneralUtility::getUrl($fileName);
+                $rdf = file_get_contents($fileName);
                 if ($rdf) {
                     $this->parseSchema($rdf, $schema);
                 }
index cb02e03..d48a360 100644 (file)
@@ -201,7 +201,7 @@ class T3editorElement extends AbstractFormElement
 
         $code[] = '<div class="t3editor">';
         $code[] = '    <div class="t3e_wrap">';
-        $code[] = str_replace(array(CR, LF), '', GeneralUtility::getUrl(GeneralUtility::getFileAbsFileName('EXT:t3editor/Resources/Private/Templates/t3editor.html')));
+        $code[] = str_replace(array(CR, LF), '', file_get_contents(GeneralUtility::getFileAbsFileName('EXT:t3editor/Resources/Private/Templates/t3editor.html')));
         $code[] = '    </div>';
         $code[] = '    <textarea ' . $attributesString . '>' . htmlspecialchars($content) . '</textarea>';
         $code[] = '</div>';
index 0008610..7ca0aab 100755 (executable)
@@ -200,7 +200,7 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface
      */
     protected function getPreparedTemplate()
     {
-        $T3editor_template = GeneralUtility::getUrl(
+        $T3editor_template = file_get_contents(
             GeneralUtility::getFileAbsFileName('EXT:t3editor/Resources/Private/Templates/t3editor.html')
         );
         return str_replace(array(CR, LF), '', $T3editor_template);
index 1fcf803..2b3b049 100644 (file)
@@ -160,7 +160,7 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
                 if ($this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate']) {
                     $templateFile = PATH_site . $this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate'];
                     if (@is_file($templateFile)) {
-                        $message = GeneralUtility::getUrl(PATH_site . $this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate']);
+                        $message = file_get_contents($templateFile);
                     } else {
                         $message = '<strong>ERROR!</strong><br>Template File "'
                             . $this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate']