/**
  * 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
  * @return array
  */
 protected function getExtensionFromZipFile($file, $fileName)
 {
     $fileNameParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $fileName, 2);
     $this->fileHandlingUtility->unzipExtensionFromFile($file, $fileNameParts[0]);
     $this->installUtility->install($fileNameParts[0]);
     return array('extKey' => $fileNameParts[0]);
 }
 /**
  * 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 boolean $overwrite Overwrite existing extension if TRUE
  * @return array
  */
 protected function getExtensionFromZipFile($file, $fileName, $overwrite = FALSE)
 {
     // Remove version and ending from filename to determine extension key
     $extensionKey = preg_replace('/_(\\d+)(\\.|\\-)(\\d+)(\\.|\\-)(\\d+)/i', '', strtolower($fileName));
     $extensionKey = substr($extensionKey, 0, strrpos($extensionKey, '.'));
     if (!$overwrite && $this->installUtility->isAvailable($extensionKey)) {
         throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('Extension is already available and overwriting is disabled.', 1342864311);
     }
     $this->fileHandlingUtility->unzipExtensionFromFile($file, $extensionKey);
     $this->installUtility->install($extensionKey);
     return array('extKey' => $extensionKey);
 }
 /**
  * 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);
 }