/** * Update extension list from TER * * @param boolean $forceUpdateCheck * @return void */ public function updateExtensionListFromTerAction($forceUpdateCheck = FALSE) { $updated = FALSE; $errorMessage = ''; if ($this->extensionRepository->countAll() === 0 || $forceUpdateCheck) { try { $updated = $this->repositoryHelper->updateExtList(); } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) { $errorMessage = $e->getMessage(); } } /** @var $repository \TYPO3\CMS\Extensionmanager\Domain\Model\Repository */ $repository = $this->repositoryRepository->findByUid((int) $this->settings['repositoryUid']); $this->view->assign('updated', $updated)->assign('repository', $repository)->assign('errorMessage', $errorMessage); }
/** * Handles checks to find a compatible extension version from TER to fulfill given dependency * * @todo unit tests * @param string $extensionKey * @param Dependency $dependency * @throws Exception\UnresolvedDependencyException * @return void */ protected function getExtensionFromTer($extensionKey, Dependency $dependency) { $isExtensionDownloadableFromTer = $this->isExtensionDownloadableFromTer($extensionKey); if (!$isExtensionDownloadableFromTer) { if (!$this->skipDependencyCheck) { if ($this->extensionRepository->countAll() > 0) { throw new Exception\MissingExtensionDependencyException('The extension ' . $extensionKey . ' is not available from TER.', 1399161266); } else { throw new Exception\MissingExtensionDependencyException('The extension ' . $extensionKey . ' could not be checked. Please update your Extension-List from TYPO3 Extension Repository (TER).', 1430580308); } } return; } $isDownloadableVersionCompatible = $this->isDownloadableVersionCompatible($dependency); if (!$isDownloadableVersionCompatible) { if (!$this->skipDependencyCheck) { throw new Exception\MissingVersionDependencyException('No compatible version found for extension ' . $extensionKey, 1399161284); } return; } $latestCompatibleExtensionByIntegerVersionDependency = $this->getLatestCompatibleExtensionByIntegerVersionDependency($dependency); if (!$latestCompatibleExtensionByIntegerVersionDependency instanceof Extension) { if (!$this->skipDependencyCheck) { throw new Exception\MissingExtensionDependencyException('Could not resolve dependency for "' . $dependency->getIdentifier() . '"', 1399161302); } return; } if ($this->isDependentExtensionLoaded($extensionKey)) { $this->managementService->markExtensionForUpdate($latestCompatibleExtensionByIntegerVersionDependency); } else { $this->managementService->markExtensionForDownload($latestCompatibleExtensionByIntegerVersionDependency); } }
/** * Update extension list from TER * * @param bool $forceUpdateCheck * @return void */ public function updateExtensionListFromTerAction($forceUpdateCheck = false) { $updated = false; $errorMessage = ''; if ($this->extensionRepository->countAll() === 0 || $forceUpdateCheck) { try { $updated = $this->repositoryHelper->updateExtList(); } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) { $errorMessage = $e->getMessage(); } } /** @var $repository \TYPO3\CMS\Extensionmanager\Domain\Model\Repository */ $repository = $this->repositoryRepository->findByUid((int) $this->settings['repositoryUid']); $timeFormat = $this->getLanguageService()->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:extensionList.updateFromTer.lastUpdate.fullTimeFormat'); $lastUpdateTime = $repository->getLastUpdate(); if (null === $lastUpdateTime) { $lastUpdatedSince = $this->getLanguageService()->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:extensionList.updateFromTer.never'); $lastUpdateTime = date($timeFormat); } else { $lastUpdatedSince = \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge(time() - $lastUpdateTime->format('U'), $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears')); $lastUpdateTime = $lastUpdateTime->format($timeFormat); } $this->view->assign('value', ['updated' => $updated, 'lastUpdateTime' => $lastUpdateTime, 'timeSinceLastUpdate' => $lastUpdatedSince, 'errorMessage' => $errorMessage]); }