/** * Download an extension * * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension * @return void */ public function download(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension) { $mirrorUrl = $this->repositoryHelper->getMirrors()->getMirrorUrl(); $fetchedExtension = $this->terUtility->fetchExtension($extension->getExtensionKey(), $extension->getVersion(), $extension->getMd5hash(), $mirrorUrl); if (isset($fetchedExtension['extKey']) && !empty($fetchedExtension['extKey']) && is_string($fetchedExtension['extKey'])) { $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($fetchedExtension, $extension, $this->getDownloadPath()); } }
/** * Extracts a given t3x file and installs the extension * * @param string $file Path to uploaded file * @param bool $overwrite Overwrite existing extension if TRUE * @throws ExtensionManagerException * @throws DependencyConfigurationNotFoundException * @return array */ protected function getExtensionFromT3xFile($file, $overwrite = false) { $fileContent = file_get_contents($file); if (!$fileContent) { throw new ExtensionManagerException('File had no or wrong content.', 1342859339); } $extensionData = $this->terUtility->decodeExchangeData($fileContent); if (empty($extensionData['extKey'])) { throw new ExtensionManagerException('Decoding the file went wrong. No extension key found', 1342864309); } $isExtensionAvailable = $this->managementService->isAvailable($extensionData['extKey']); if (!$overwrite && $isExtensionAvailable) { throw new ExtensionManagerException($this->translate('extensionList.overwritingDisabled'), 1342864310); } if ($isExtensionAvailable) { $this->copyExtensionFolderToTempFolder($extensionData['extKey']); } $this->removeFromOriginalPath = true; $extension = $this->extensionRepository->findOneByExtensionKeyAndVersion($extensionData['extKey'], $extensionData['EM_CONF']['version']); $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($extensionData, $extension); if (empty($extension) && empty($extensionData['EM_CONF']['constraints']) && !isset($extensionData['FILES']['ext_emconf.php']) && !isset($extensionData['FILES']['/ext_emconf.php'])) { throw new DependencyConfigurationNotFoundException('Extension cannot be installed automatically because no dependencies could be found! Please check dependencies manually (on typo3.org) before installing the extension.', 1439587168); } return $extensionData; }
/** * Extracts a given t3x file and installs the extension * * @param string $file * @throws \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException * @return array */ protected function getExtensionFromT3xFile($file) { $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($file); if (!$fileContent) { throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('File had no or wrong content.', 1342859339); } $extensionData = $this->terUtility->decodeExchangeData($fileContent); if ($extensionData['extKey']) { $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($extensionData); $this->installUtility->install($extensionData['extKey']); } else { throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('Decoding the file went wrong. No extension key found', 1342864309); } return $extensionData; }
/** * Extracts a given t3x file and installs the extension * * @param string $file Path to uploaded file * @param boolean $overwrite Overwrite existing extension if TRUE * @throws \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException * @return array */ protected function getExtensionFromT3xFile($file, $overwrite = FALSE) { $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($file); if (!$fileContent) { throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('File had no or wrong content.', 1342859339); } $extensionData = $this->terUtility->decodeExchangeData($fileContent); if (empty($extensionData['extKey'])) { throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('Decoding the file went wrong. No extension key found', 1342864309); } if (!$overwrite && $this->installUtility->isAvailable($extensionData['extKey'])) { throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException($this->translate('extensionList.overwritingDisabled'), 1342864310); } $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($extensionData); $this->installUtility->install($extensionData['extKey']); return $extensionData; }
/** * Extracts a given t3x file and installs the extension * * @param string $file Path to uploaded file * @param boolean $overwrite Overwrite existing extension if TRUE * @throws ExtensionManagerException * @return array */ protected function getExtensionFromT3xFile($file, $overwrite = FALSE) { $fileContent = GeneralUtility::getUrl($file); if (!$fileContent) { throw new ExtensionManagerException('File had no or wrong content.', 1342859339); } $extensionData = $this->terUtility->decodeExchangeData($fileContent); if (empty($extensionData['extKey'])) { throw new ExtensionManagerException('Decoding the file went wrong. No extension key found', 1342864309); } $isExtensionAvailable = $this->managementService->isAvailable($extensionData['extKey']); if (!$overwrite && $isExtensionAvailable) { throw new ExtensionManagerException($this->translate('extensionList.overwritingDisabled'), 1342864310); } if ($isExtensionAvailable) { $this->copyExtensionFolderToTempFolder($extensionData['extKey']); } $this->removeFromOriginalPath = TRUE; $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($extensionData); return $extensionData; }