[BUGFIX] Fix relative path calculations in EM 25/28825/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 26 Mar 2014 11:27:58 +0000 (12:27 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 1 Apr 2014 19:57:55 +0000 (21:57 +0200)
The extension manager often uses the extension
relative path to calculate paths to different files,
but does not take into account that this path
already has a trailing slash.

Remove excess slashes to avoid double slashes in paths.

Resolves: #57327
Related: #57312
Releases: 6.2
Change-Id: I60519d4d7075a615d0505bfc4cbb2b6ee1b0c222
Reviewed-on: https://review.typo3.org/28825
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/extensionmanager/Classes/Utility/EmConfUtility.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ConfigureExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionDataViewHelper.php
typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html
typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php

index 3b6da86..8338896 100644 (file)
@@ -41,7 +41,7 @@ class EmConfUtility implements \TYPO3\CMS\Core\SingletonInterface {
         */
        public function includeEmConf(array $extension) {
                $_EXTKEY = $extension['key'];
-               $path = PATH_site . $extension['siteRelPath'] . '/ext_emconf.php';
+               $path = PATH_site . $extension['siteRelPath'] . 'ext_emconf.php';
                $EM_CONF = NULL;
                if (file_exists($path)) {
                        include $path;
index 9791e4a..513ff9e 100644 (file)
@@ -233,7 +233,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @param array $extension
         */
        public function processDatabaseUpdates(array $extension) {
-               $extTablesSqlFile = PATH_site . $extension['siteRelPath'] . '/ext_tables.sql';
+               $extTablesSqlFile = PATH_site . $extension['siteRelPath'] . 'ext_tables.sql';
                $extTablesSqlContent = '';
                if (file_exists($extTablesSqlFile)) {
                        $extTablesSqlContent .= \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($extTablesSqlFile);
@@ -376,8 +376,8 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
        public function getExtensionSqlDataDump($extension) {
                $extension = $this->enrichExtensionWithDetails($extension);
                $filePrefix = PATH_site . $extension['siteRelPath'];
-               $sqlData['extTables'] = $this->getSqlDataDumpForFile($filePrefix . '/ext_tables.sql');
-               $sqlData['staticSql'] = $this->getSqlDataDumpForFile($filePrefix . '/ext_tables_static+adt.sql');
+               $sqlData['extTables'] = $this->getSqlDataDumpForFile($filePrefix . 'ext_tables.sql');
+               $sqlData['staticSql'] = $this->getSqlDataDumpForFile($filePrefix . 'ext_tables_static+adt.sql');
                return $sqlData;
        }
 
@@ -431,7 +431,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @return void
         */
        protected function importT3DFile($extensionSiteRelPath) {
-               $t3dImportRelFile = $extensionSiteRelPath . '/Initialisation/data.t3d';
+               $t3dImportRelFile = $extensionSiteRelPath . 'Initialisation/data.t3d';
                if (!$this->registry->get('extensionDataImport', $t3dImportRelFile)) {
                        $t3dImportFile = PATH_site . $t3dImportRelFile;
                        if (file_exists($t3dImportFile)) {
@@ -457,7 +457,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @return void
         */
        protected function importStaticSqlFile($extensionSiteRelPath) {
-               $extTablesStaticSqlRelFile = $extensionSiteRelPath . '/ext_tables_static+adt.sql';
+               $extTablesStaticSqlRelFile = $extensionSiteRelPath . 'ext_tables_static+adt.sql';
                if (!$this->registry->get('extensionDataImport', $extTablesStaticSqlRelFile)) {
                        $extTablesStaticSqlFile = PATH_site . $extTablesStaticSqlRelFile;
                        if (file_exists($extTablesStaticSqlFile)) {
index 948bd8d..08d7886 100644 (file)
@@ -48,7 +48,7 @@ class ConfigureExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\Act
         */
        public function render($extension, $forceConfiguration = TRUE, $showDescription = FALSE) {
                $content = (string)$this->renderChildren();
-               if ($extension['installed'] && file_exists(PATH_site . $extension['siteRelPath'] . '/ext_conf_template.txt')) {
+               if ($extension['installed'] && file_exists(PATH_site . $extension['siteRelPath'] . 'ext_conf_template.txt')) {
                        $uriBuilder = $this->controllerContext->getUriBuilder();
                        $action = 'showConfigurationForm';
                        $uri = $uriBuilder->reset()->uriFor(
index 9aa4fd8..676fdb1 100644 (file)
@@ -46,7 +46,7 @@ class DownloadExtensionDataViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\
         */
        public function render($extension) {
                $filePrefix = PATH_site . $extension['siteRelPath'];
-               if (!file_exists(($filePrefix . '/ext_tables.sql')) && !file_exists(($filePrefix . '/ext_tables_static+adt.sql'))) {
+               if (!file_exists(($filePrefix . 'ext_tables.sql')) && !file_exists(($filePrefix . 'ext_tables_static+adt.sql'))) {
                        return '';
                }
                $uriBuilder = $this->controllerContext->getUriBuilder();
index af152d9..edf5809 100644 (file)
@@ -74,7 +74,7 @@
                                        </f:else>
                                </f:if>
                                        <f:if condition="{extension.ext_icon}">
-                                               <img class="ext-icon" src="../{extension.siteRelPath}/{extension.ext_icon}" alt="{extension.title}" />
+                                               <img class="ext-icon" src="../{extension.siteRelPath}{extension.ext_icon}" alt="{extension.title}" />
                                        </f:if>
                                        <em:configureExtension extension="{extension}" forceConfiguration="0" showDescription="1">{extension.title}</em:configureExtension>
                                </td>
index cb466f7..7445ad0 100644 (file)
@@ -110,7 +110,7 @@ class InstallUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        protected function createFakeExtension() {
                $extKey = strtolower(uniqid('testing'));
                $absExtPath = PATH_site . 'typo3temp/' . $extKey;
-               $relPath = 'typo3temp/' . $extKey;
+               $relPath = 'typo3temp/' . $extKey . '/';
                \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir($absExtPath);
                $this->fakedExtensions[$extKey] = array(
                        'siteRelPath' => $relPath
@@ -223,7 +223,7 @@ class InstallUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function processDatabaseUpdatesCallsImportStaticSqlFile() {
                $extKey = $this->createFakeExtension();
-               $extRelPath = 'typo3temp/' . $extKey;
+               $extRelPath = 'typo3temp/' . $extKey . '/';
                $installMock = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility',
                        array('importStaticSqlFile', 'updateDbWithExtTablesSql', 'importT3DFile'),
@@ -270,7 +270,7 @@ class InstallUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $registryMock
                        ->expects($this->once())
                        ->method('get')
-                       ->with('extensionDataImport', $this->fakedExtensions[$extKey]['siteRelPath'] . '/Initialisation/data.t3d')
+                       ->with('extensionDataImport', $this->fakedExtensions[$extKey]['siteRelPath'] . 'Initialisation/data.t3d')
                        ->will($this->returnValue(TRUE)
                        );
                $installMock = $this->getAccessibleMock(