7df66bfa20b597857ce60bfd66c03e9fa03d3694
[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 $this->loadExtLocalconfDatabaseAndExtTables();
66 }
67
68 /**
69 * Find out which version upgrade should be handled. This may
70 * be different depending on whether development or regular release.
71 *
72 * @throws \TYPO3\CMS\Install\Controller\Exception
73 * @return string Version to handle, eg. 6.2.2
74 */
75 protected function getVersionToHandle() {
76 $getVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('install');
77 if (!isset($getVars['type'])) {
78 throw new \TYPO3\CMS\Install\Controller\Exception(
79 'Type must be set to either "regular" or "development"',
80 1380975303
81 );
82 }
83 $type = $getVars['type'];
84 if ($type === 'development') {
85 $versionToHandle = $this->coreVersionService->getYoungestPatchDevelopmentRelease();
86 } else {
87 $versionToHandle = $this->coreVersionService->getYoungestPatchRelease();
88 }
89 return $versionToHandle;
90 }
91 }