[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / Action / Ajax / AbstractCoreUpdate.php
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
17 /**
18 * Abstract core update class contains general core update
19 * related methods
20 */
21 abstract class AbstractCoreUpdate extends AbstractAjaxAction {
22
23 /**
24 * @var \TYPO3\CMS\Install\View\JsonView
25 * @inject
26 */
27 protected $view = NULL;
28
29 /**
30 * @var \TYPO3\CMS\Install\Service\CoreUpdateService
31 * @inject
32 */
33 protected $coreUpdateService;
34
35 /**
36 * @var \TYPO3\CMS\Install\Status\StatusUtility
37 * @inject
38 */
39 protected $statusUtility;
40
41 /**
42 * @var \TYPO3\CMS\Install\Service\CoreVersionService
43 * @inject
44 */
45 protected $coreVersionService;
46
47 /**
48 * Initialize the handle action, sets up fluid stuff and assigns default variables.
49 *
50 * @return void
51 * @throws \TYPO3\CMS\Install\Controller\Exception
52 */
53 protected function initializeHandle() {
54 if (!$this->coreUpdateService->isCoreUpdateEnabled()) {
55 throw new \TYPO3\CMS\Install\Controller\Exception(
56 'Core Update disabled in this environment',
57 1381609294
58 );
59 }
60 $this->loadExtLocalconfDatabaseAndExtTables();
61 }
62
63 /**
64 * Find out which version upgrade should be handled. This may
65 * be different depending on whether development or regular release.
66 *
67 * @throws \TYPO3\CMS\Install\Controller\Exception
68 * @return string Version to handle, eg. 6.2.2
69 */
70 protected function getVersionToHandle() {
71 $getVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('install');
72 if (!isset($getVars['type'])) {
73 throw new \TYPO3\CMS\Install\Controller\Exception(
74 'Type must be set to either "regular" or "development"',
75 1380975303
76 );
77 }
78 $type = $getVars['type'];
79 if ($type === 'development') {
80 $versionToHandle = $this->coreVersionService->getYoungestPatchDevelopmentRelease();
81 } else {
82 $versionToHandle = $this->coreVersionService->getYoungestPatchRelease();
83 }
84 return $versionToHandle;
85 }
86 }