TYPO3  7.6
AbstractCoreUpdate.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Install\Controller\Action\Ajax;
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 abstract class AbstractCoreUpdate extends AbstractAjaxAction
22 {
26  protected $view = null;
27 
31  protected $coreUpdateService;
32 
36  protected $statusUtility;
37 
42 
46  public function injectView(\TYPO3\CMS\Install\View\JsonView $view)
47  {
48  $this->view = $view;
49  }
50 
54  public function injectCoreUpdateService(\TYPO3\CMS\Install\Service\CoreUpdateService $coreUpdateService)
55  {
56  $this->coreUpdateService = $coreUpdateService;
57  }
58 
62  public function injectStatusUtility(\TYPO3\CMS\Install\Status\StatusUtility $statusUtility)
63  {
64  $this->statusUtility = $statusUtility;
65  }
66 
70  public function injectCoreVersionService(\TYPO3\CMS\Install\Service\CoreVersionService $coreVersionService)
71  {
72  $this->coreVersionService = $coreVersionService;
73  }
74 
81  protected function initializeHandle()
82  {
83  if (!$this->coreUpdateService->isCoreUpdateEnabled()) {
84  throw new \TYPO3\CMS\Install\Controller\Exception(
85  'Core Update disabled in this environment',
86  1381609294
87  );
88  }
90  }
91 
99  protected function getVersionToHandle()
100  {
101  $getVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('install');
102  if (!isset($getVars['type'])) {
103  throw new \TYPO3\CMS\Install\Controller\Exception(
104  'Type must be set to either "regular" or "development"',
105  1380975303
106  );
107  }
108  $type = $getVars['type'];
109  if ($type === 'development') {
110  $versionToHandle = $this->coreVersionService->getYoungestPatchDevelopmentRelease();
111  } else {
112  $versionToHandle = $this->coreVersionService->getYoungestPatchRelease();
113  }
114  return $versionToHandle;
115  }
116 }