TYPO3  7.6
UpdateFromTerController.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Controller;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
25  protected $repositoryHelper;
26 
31 
35  protected $listUtility;
36 
41 
45  public function injectRepositoryHelper(\TYPO3\CMS\Extensionmanager\Utility\Repository\Helper $repositoryHelper)
46  {
47  $this->repositoryHelper = $repositoryHelper;
48  }
49 
53  public function injectRepositoryRepository(\TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository $repositoryRepository)
54  {
55  $this->repositoryRepository = $repositoryRepository;
56  }
57 
61  public function injectListUtility(\TYPO3\CMS\Extensionmanager\Utility\ListUtility $listUtility)
62  {
63  $this->listUtility = $listUtility;
64  }
65 
69  public function injectExtensionRepository(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository $extensionRepository)
70  {
71  $this->extensionRepository = $extensionRepository;
72  }
73 
80  public function updateExtensionListFromTerAction($forceUpdateCheck = false)
81  {
82  $updated = false;
83  $errorMessage = '';
84 
85  if ($this->extensionRepository->countAll() === 0 || $forceUpdateCheck) {
86  try {
87  $updated = $this->repositoryHelper->updateExtList();
88  } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) {
89  $errorMessage = $e->getMessage();
90  }
91  }
93  $repository = $this->repositoryRepository->findByUid((int)$this->settings['repositoryUid']);
94  $this->view->assign('updated', $updated)
95  ->assign('repository', $repository)
96  ->assign('errorMessage', $errorMessage);
97  }
98 }