TYPO3 CMS  TYPO3_8-7
AbstractCoreUpdate.php
Go to the documentation of this file.
1 <?php
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 
22 
27 abstract class AbstractCoreUpdate extends AbstractAjaxAction
28 {
32  protected $view;
33 
37  protected $coreUpdateService;
38 
42  protected $statusUtility;
43 
48 
55  public function __construct(
56  JsonView $view = null,
60  ) {
61  $this->view = $view ?: GeneralUtility::makeInstance(JsonView::class);
62  $this->coreUpdateService = $coreUpdateService ?: GeneralUtility::makeInstance(CoreUpdateService::class);
63  $this->statusUtility = $statusUtility ?: GeneralUtility::makeInstance(StatusUtility::class);
64  $this->coreVersionService = $coreVersionService ?: GeneralUtility::makeInstance(CoreVersionService::class);
65  }
66 
72  protected function initializeHandle()
73  {
74  if (!$this->coreUpdateService->isCoreUpdateEnabled()) {
75  throw new \TYPO3\CMS\Install\Controller\Exception(
76  'Core Update disabled in this environment',
77  1381609294
78  );
79  }
81  }
82 
90  protected function getVersionToHandle()
91  {
93  if (!isset($getVars['type'])) {
94  throw new \TYPO3\CMS\Install\Controller\Exception(
95  'Type must be set to either "regular" or "development"',
96  1380975303
97  );
98  }
99  $type = $getVars['type'];
100  if ($type === 'development') {
101  $versionToHandle = $this->coreVersionService->getYoungestPatchDevelopmentRelease();
102  } else {
103  $versionToHandle = $this->coreVersionService->getYoungestPatchRelease();
104  }
105  return $versionToHandle;
106  }
107 }
static makeInstance($className,... $constructorArguments)
__construct(JsonView $view=null, CoreUpdateService $coreUpdateService=null, StatusUtility $statusUtility=null, CoreVersionService $coreVersionService=null)