[BUGFIX] Download as zip must use same filename structure as TER
authorJigal van Hemert <jigal@xs4all.nl>
Thu, 18 Oct 2012 21:11:18 +0000 (23:11 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 19 Oct 2012 07:04:56 +0000 (09:04 +0200)
Upload in EM assumes <extkey>_<version>.zip, so the download as zip
feature must use the same format.

Change-Id: Ide7eb7aac3c8f213b7db2bc9dad5e014e8faa666
Fixes: #42067
Release: 6.0
Reviewed-on: http://review.typo3.org/15801
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/extensionmanager/Classes/Utility/FileHandlingUtility.php

index d36fa67..8636ba2 100644 (file)
@@ -238,6 +238,18 @@ class FileHandlingUtility implements \TYPO3\CMS\Core\SingletonInterface {
        }
 
        /**
+        * Get version of an available or installed extension
+        *
+        * @param string $extension
+        * @return string
+        */
+       public function getExtensionVersion($extension) {
+               $extensionData = $this->installUtility->enrichExtensionWithDetails($extension);
+               $version = $extensionData['version'];
+               return $version;
+       }
+
+       /**
         * Create a zip file from an extension
         *
         * @param array $extension
@@ -245,7 +257,8 @@ class FileHandlingUtility implements \TYPO3\CMS\Core\SingletonInterface {
         */
        public function createZipFileFromExtension($extension) {
                $extensionPath = $this->getAbsoluteExtensionPath($extension);
-               $fileName = PATH_site . 'typo3temp/' . $extension . '.zip';
+               $version = $this->getExtensionVersion($extension);
+               $fileName = PATH_site . 'typo3temp/' . $extension . '_' . $version . '.zip';
                $zip = new \ZipArchive();
                $zip->open($fileName, \ZipArchive::CREATE);
                $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($extensionPath));