/** * Extracts a given zip file and installs the extension * As there is no information about the extension key in the zip * we have to use the file name to get that information * filename format is expected to be extensionkey_version.zip * * @param string $file Path to uploaded file * @param string $fileName Filename (basename) of uploaded file * @param bool $overwrite Overwrite existing extension if TRUE * @return array * @throws ExtensionManagerException */ protected function getExtensionFromZipFile($file, $fileName, $overwrite = false) { // Remove version and extension from filename to determine the extension key $extensionKey = $this->getExtensionKeyFromFileName($fileName); $isExtensionAvailable = $this->managementService->isAvailable($extensionKey); if (!$overwrite && $isExtensionAvailable) { throw new ExtensionManagerException('Extension is already available and overwriting is disabled.', 1342864311); } if ($isExtensionAvailable) { $this->copyExtensionFolderToTempFolder($extensionKey); } $this->removeFromOriginalPath = true; $this->fileHandlingUtility->unzipExtensionFromFile($file, $extensionKey); return array('extKey' => $extensionKey); }