2 namespace TYPO3\CMS\Extensionmanager\Utility\Repository;
75 public function __construct()
78 $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
80 $repositoryRepository = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository::class);
81 $this->extensionRepository = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository::class);
82 $this->configurationUtility = $this->objectManager->get(ConfigurationUtility::class);
145 protected function fetchFile($remoteResource, $localResource)
147 if ($this->configurationUtility->getCurrentConfiguration(
'extensionmanager')[
'offlineMode'][
'value']) {
150 if (is_string($remoteResource) && is_string($localResource) && !empty($remoteResource) && !empty($localResource)) {
151 $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($remoteResource, 0, array(TYPO3_user_agent));
152 if ($fileContent !==
false) {
171 $absFilePath = PATH_site .
'typo3temp/ExtensionManager/' . (int)$this->repository->getUid() .
'.extensions.xml.gz';
184 $mirror = $this->getMirrors(
true)->getMirror();
185 $filePath =
'http://' . $mirror[
'host'] . $mirror[
'path'] .
'extensions.xml.gz';
198 $mirror = $this->getMirrors(
true)->getMirror();
199 $filePath =
'http://' . $mirror[
'host'] . $mirror[
'path'] .
'extensions.md5';
212 $absFilePath = PATH_site .
'typo3temp/ExtensionManager/' . (int)$this->repository->getUid() .
'.mirrors.xml.gz';
225 $filePath = $this->repository->getMirrorListUrl();
241 public function getMirrors($forcedUpdateFromRemote =
true)
243 $assignedMirror = $this->repository->getMirrors();
244 if ($forcedUpdateFromRemote || is_null($assignedMirror) || !is_object($assignedMirror)) {
249 $objMirrorListImporter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility::class);
250 $this->repository->addMirrors($objMirrorListImporter->getMirrors($this->getLocalMirrorListFile()));
252 return $this->repository->getMirrors();
266 $updateNecessity = 0;
267 if ($this->extensionRepository->countByRepository($this->repository->getUid()) <= 0) {
268 $updateNecessity |= self::PROBLEM_NO_VERSIONS_IN_DATABASE;
271 $updateNecessity |= self::PROBLEM_EXTENSION_FILE_NOT_EXISTING;
273 $remotemd5 = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($this->
getRemoteExtHashFile(), 0, array(TYPO3_user_agent));
274 if ($remotemd5 !==
false) {
276 if ($remotemd5 !== $localmd5) {
277 $updateNecessity |= self::PROBLEM_EXTENSION_HASH_CHANGED;
283 return $updateNecessity;
298 if ($updateNecessity !== 0) {
300 $tmpBitmask = self::PROBLEM_EXTENSION_FILE_NOT_EXISTING | self::PROBLEM_EXTENSION_HASH_CHANGED;
301 if (($tmpBitmask & $updateNecessity) > 0) {
303 $updateNecessity &= ~$tmpBitmask;
306 if ($updateNecessity & self::PROBLEM_NO_VERSIONS_IN_DATABASE) {
315 if ($updateNecessity === 0) {
316 $uid = $this->repository->getUid();
318 $objExtListImporter = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Utility\Importer\ExtensionListUtility::class);