‪TYPO3CMS  10.4
UpdateFromTerController.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
26 
32 {
36  protected ‪$repositoryHelper;
37 
41  protected ‪$repositoryRepository;
42 
46  protected ‪$listUtility;
47 
52 
56  protected ‪$defaultViewObjectName = JsonView::class;
57 
62  {
63  $this->repositoryHelper = ‪$repositoryHelper;
64  }
65 
70  {
71  $this->repositoryRepository = ‪$repositoryRepository;
72  }
73 
78  {
79  $this->listUtility = ‪$listUtility;
80  }
81 
86  {
87  $this->extensionRepository = ‪$extensionRepository;
88  }
89 
95  public function ‪updateExtensionListFromTerAction($forceUpdateCheck = false)
96  {
97  $updated = false;
98  $errorMessage = '';
99 
100  if ($this->extensionRepository->countAll() === 0 || $forceUpdateCheck) {
101  try {
102  $updated = $this->repositoryHelper->updateExtList();
103  } catch (ExtensionManagerException $e) {
104  $errorMessage = $e->getMessage();
105  }
106  }
107  $repository = $this->repositoryRepository->findOneTypo3OrgRepository();
108 
109  $timeFormat = $this->‪getLanguageService()->‪sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:extensionList.updateFromTer.lastUpdate.fullTimeFormat');
110  $lastUpdateTime = $repository ? $repository->getLastUpdate() : null;
111  if (null === $lastUpdateTime) {
112  $lastUpdatedSince = $this->‪getLanguageService()->‪sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:extensionList.updateFromTer.never');
113  $lastUpdateTime = date($timeFormat);
114  } else {
115  $lastUpdatedSince = ‪BackendUtility::calcAge(
116  time() - $lastUpdateTime->format('U'),
117  $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears')
118  );
119  $lastUpdateTime = $lastUpdateTime->format($timeFormat);
120  }
121  $this->view->assign('value', [
122  'updated' => $updated,
123  'lastUpdateTime' => $lastUpdateTime,
124  'timeSinceLastUpdate' => $lastUpdatedSince,
125  'errorMessage' => $errorMessage
126  ]);
127  }
128 
132  protected function ‪getLanguageService()
133  {
134  return ‪$GLOBALS['LANG'];
135  }
136 }
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\injectRepositoryHelper
‪injectRepositoryHelper(Helper $repositoryHelper)
Definition: UpdateFromTerController.php:56
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\$defaultViewObjectName
‪string $defaultViewObjectName
Definition: UpdateFromTerController.php:51
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\$repositoryHelper
‪Helper $repositoryHelper
Definition: UpdateFromTerController.php:35
‪TYPO3\CMS\Backend\Utility\BackendUtility\calcAge
‪static string calcAge($seconds, $labels='min|hrs|days|yrs|min|hour|day|year')
Definition: BackendUtility.php:1017
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\injectRepositoryRepository
‪injectRepositoryRepository(RepositoryRepository $repositoryRepository)
Definition: UpdateFromTerController.php:64
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\$extensionRepository
‪ExtensionRepository $extensionRepository
Definition: UpdateFromTerController.php:47
‪TYPO3\CMS\Extensionmanager\Controller
Definition: AbstractController.php:16
‪TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository
Definition: RepositoryRepository.php:26
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Extensionmanager\Utility\ListUtility
Definition: ListUtility.php:41
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\getLanguageService
‪LanguageService getLanguageService()
Definition: UpdateFromTerController.php:127
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\updateExtensionListFromTerAction
‪updateExtensionListFromTerAction($forceUpdateCheck=false)
Definition: UpdateFromTerController.php:90
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\injectExtensionRepository
‪injectExtensionRepository(ExtensionRepository $extensionRepository)
Definition: UpdateFromTerController.php:80
‪TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository
Definition: ExtensionRepository.php:35
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\$repositoryRepository
‪RepositoryRepository $repositoryRepository
Definition: UpdateFromTerController.php:39
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\injectListUtility
‪injectListUtility(ListUtility $listUtility)
Definition: UpdateFromTerController.php:72
‪TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
Definition: ExtensionManagerException.php:24
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController\$listUtility
‪ListUtility $listUtility
Definition: UpdateFromTerController.php:43
‪TYPO3\CMS\Extensionmanager\Controller\AbstractController
Definition: AbstractController.php:26
‪TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController
Definition: UpdateFromTerController.php:32
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Extensionmanager\Utility\Repository\Helper
Definition: Helper.php:37
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Extbase\Mvc\View\JsonView
Definition: JsonView.php:29