[TASK] Raise version number of compatibility6 in update wizard
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / Compatibility6ExtractionUpdate.php
1 <?php
2 namespace TYPO3\CMS\Install\Updates;
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 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * Installs and downloads EXT:compatibility6 if needed
21 */
22 class Compatibility6ExtractionUpdate extends AbstractDownloadExtensionUpdate
23 {
24 /**
25 * @var string
26 */
27 protected $title = 'Installs extension "compatibility6" from TER';
28
29 /**
30 * @var string
31 */
32 protected $extensionKey = 'compatibility6';
33
34 /**
35 * @var array
36 */
37 protected $extensionDetails = [
38 'compatibility6' => [
39 'title' => 'Compatibility Mode for TYPO3 CMS 6.x',
40 'description' => 'Provides an additional backwards-compatibility layer with legacy functionality for sites that haven\'t fully migrated to TYPO3 CMS 7 yet.',
41 'versionString' => '7.6.4',
42 ]
43 ];
44
45 /**
46 * Checks if an update is needed
47 *
48 * @param string $description The description for the update
49 * @return bool Whether an update is needed (true) or not (false)
50 */
51 public function checkForUpdate(&$description)
52 {
53 $description = 'The extension "compatibility6" (Compatibility Mode for TYPO3 CMS 6.x) was extracted into '
54 . 'the TYPO3 Extension Repository. This update downloads the TYPO3 Extension from the TER.';
55
56 $updateNeeded = false;
57
58 if (!$this->isWizardDone()) {
59 $updateNeeded = true;
60 }
61
62 return $updateNeeded;
63 }
64
65 /**
66 * Second step: Ask user to install the extension
67 *
68 * @param string $inputPrefix input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
69 * @return string HTML output
70 */
71 public function getUserInput($inputPrefix)
72 {
73 return '
74 <div class="panel panel-danger">
75 <div class="panel-heading">Are you really sure?</div>
76 <div class="panel-body">
77 <p>You should install EXT:compatibility6 only if you really need it.</p>
78 <p>This update wizard cannot check if the extension was installed before the update.</p>
79 <p>Are you really sure, you want to install EXT:compatibility6?</p>
80 <div class="btn-group clearfix" data-toggle="buttons">
81 <label class="btn btn-default active">
82 <input type="radio" name="' . $inputPrefix . '[install]" value="0" checked="checked" /> no, don\'t install
83 </label>
84 <label class="btn btn-default">
85 <input type="radio" name="' . $inputPrefix . '[install]" value="1" /> yes, please install
86 </label>
87 </div>
88 </div>
89 </div>
90 ';
91 }
92
93 /**
94 * Performs the update if EXT:compatibility6 should be installed.
95 *
96 * @param array $databaseQueries Queries done in this update
97 * @param mixed $customMessages Custom messages
98 * @return bool
99 */
100 public function performUpdate(array &$databaseQueries, &$customMessages)
101 {
102 $requestParams = GeneralUtility::_GP('install');
103 if (!isset($requestParams['values']['compatibility6Extension']['install'])) {
104 return false;
105 }
106 $install = (int)$requestParams['values']['compatibility6Extension']['install'];
107
108 if ($install === 1) {
109 // user decided to install extension, install and mark wizard as done
110 $updateSuccessful = $this->installExtension($this->extensionKey, $customMessages);
111 if ($updateSuccessful) {
112 $this->markWizardAsDone();
113 return true;
114 }
115 } else {
116 // user decided to not install extension, mark wizard as done
117 $this->markWizardAsDone();
118 return true;
119 }
120 return $updateSuccessful;
121 }
122 }