[FEATURE] Allow to disable "Core Updater": not only optically
[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 * Copyright notice
6 *
7 * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 use TYPO3\CMS\Install\Controller\Action;
28
29 /**
30 * Abstract core update class contains general core update
31 * related methods
32 */
33 abstract class AbstractCoreUpdate extends Action\AbstractAction {
34
35 /**
36 * @var \TYPO3\CMS\Install\View\JsonView
37 * @inject
38 */
39 protected $view = NULL;
40
41 /**
42 * @var \TYPO3\CMS\Install\Service\CoreUpdateService
43 * @inject
44 */
45 protected $coreUpdateService;
46
47 /**
48 * @var \TYPO3\CMS\Install\Status\StatusUtility
49 * @inject
50 */
51 protected $statusUtility;
52
53 /**
54 * @var \TYPO3\CMS\Install\Service\CoreVersionService
55 * @inject
56 */
57 protected $coreVersionService;
58
59 /**
60 * Common stuff to be done before performing update tasks
61 *
62 * @return void
63 */
64 protected function initializeCoreUpdate() {
65 if (!$this->coreUpdateService->isCoreUpdateEnabled()) {
66 throw new \TYPO3\CMS\Install\Controller\Exception(
67 'Core Update disabled in this environment',
68 1381609294
69 );
70 }
71 $this->loadExtLocalconfDatabaseAndExtTables();
72 }
73
74 /**
75 * Find out which version upgrade should be handled. This may
76 * be different depending on whether development or regular release.
77 *
78 * @throws \TYPO3\CMS\Install\Controller\Exception
79 * @return string Version to handle, eg. 6.2.2
80 */
81 protected function getVersionToHandle() {
82 $getVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('install');
83 if (!isset($getVars['type'])) {
84 throw new \TYPO3\CMS\Install\Controller\Exception(
85 'Type must be set to either "regular" or "development"',
86 1380975303
87 );
88 }
89 $type = $getVars['type'];
90 if ($type === 'development') {
91 $versionToHandle = $this->coreVersionService->getYoungestPatchDevelopmentRelease();
92 } else {
93 $versionToHandle = $this->coreVersionService->getYoungestPatchRelease();
94 }
95 return $versionToHandle;
96 }
97 }