/** * 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]); }
/** * @test */ public function installCallsSaveDefaultConfigurationWithExtensionKey() { $cacheManagerMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $cacheManagerMock->expects($this->once())->method('flushCachesInGroup'); $this->installMock->_set('cacheManager', $cacheManagerMock); $this->installMock->expects($this->once())->method('saveDefaultConfiguration')->with('dummy'); $this->installMock->install('dummy'); }
/** * Install dependent extensions * * @param array $installQueue * @return array */ protected function installDependencies(array $installQueue) { $resolvedDependencies = array(); foreach ($installQueue as $extensionToInstall) { $this->installUtility->install($extensionToInstall); $resolvedDependencies['installed'][$extensionToInstall] = $extensionToInstall; } return $resolvedDependencies; }
/** * 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); }
/** * Install dependent extensions * * @param array $installQueue * @return array */ protected function installDependencies(array $installQueue) { $resolvedDependencies = array(); foreach ($installQueue as $extensionKey => $extensionDetails) { $this->installUtility->install($extensionDetails); if (!is_array($resolvedDependencies['installed'])) { $resolvedDependencies['installed'] = array(); } $resolvedDependencies['installed'][$extensionKey] = $extensionDetails; } return $resolvedDependencies; }
/** * Toggle extension installation state action * * @return void */ protected function toggleExtensionInstallationStateAction() { $installedExtensions = \TYPO3\CMS\Core\Extension\ExtensionManager::getLoadedExtensionListArray(); $extension = $this->request->getArgument('extension'); if (in_array($extension, $installedExtensions)) { // uninstall $this->installUtility->uninstall($extension); } else { // install $this->installUtility->install($extension); } $this->redirect('index', 'List'); }
/** * Install dependent extensions * * @param array $installQueue * @return array */ protected function installDependencies(array $installQueue) { if (!empty($installQueue)) { $this->emitWillInstallExtensionsSignal($installQueue); } $resolvedDependencies = array(); foreach ($installQueue as $extensionKey => $_) { $this->installUtility->install($extensionKey); $this->emitHasInstalledExtensionSignal($extensionKey); if (!is_array($resolvedDependencies['installed'])) { $resolvedDependencies['installed'] = array(); } $resolvedDependencies['installed'][$extensionKey] = $extensionKey; } return $resolvedDependencies; }
/** * @test */ public function installCallsSaveDefaultConfigurationWithExtensionKey() { $this->installMock->expects($this->once())->method('saveDefaultConfiguration')->with('dummy'); $this->installMock->install('dummy'); }
/** * Install (load) an extension. * * @param string $extensionKey extension key * * @throws RuntimeException * @throws InvalidArgumentException * @return void */ public function installExtension($extensionKey) { $this->checkExtensionExists($extensionKey); $this->installUtility->install($extensionKey); }
/** * @param string $extensionKey * @return void */ public function activateExtension($extensionKey) { $this->installUtility->install($extensionKey); }