[TASK] Migrate extension install upgrade wizards to new API
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / Compatibility7ExtractionUpdate.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\ExtensionManagementUtility;
18
19 /**
20 * Installs and downloads EXT:compatibility7 if needed
21 */
22 class Compatibility7ExtractionUpdate extends AbstractDownloadExtensionUpdate
23 {
24 /**
25 * @var string
26 */
27 protected $title = 'Install extension "compatibility7" from TER';
28
29 /**
30 * @var string
31 */
32 protected $extensionKey = 'compatibility7';
33
34 /**
35 * @var array
36 */
37 protected $extensionDetails = [
38 'compatibility7' => [
39 'title' => 'Compatibility Mode for TYPO3 v7',
40 'description' => 'Provides an additional backwards-compatibility layer with legacy functionality for sites that haven\'t fully migrated to TYPO3 v8 yet.',
41 'versionString' => '8.7.1',
42 'composerName' => 'friendsoftypo3/compatibility7',
43 ],
44 ];
45
46 /**
47 * @var \TYPO3\CMS\Install\Updates\ExtensionModel
48 */
49 protected $extension;
50
51 /**
52 * @var \TYPO3\CMS\Install\Updates\Confirmation
53 */
54 protected $confirmation;
55
56 public function __construct()
57 {
58 $this->extension = new ExtensionModel(
59 'compatibility7',
60 'Compatibility Mode for TYPO3 v7',
61 '8.7.1',
62 'friendsoftypo3/compatibility7',
63 'Provides an additional backwards-compatibility layer with legacy functionality for sites that haven\'t fully migrated to TYPO3 v8 yet.'
64 );
65
66 $this->confirmation = new Confirmation(
67 'Are you sure?',
68 'The compatibility extensions come with a performance penalty, use only if needed. ' . $this->extension->getDescription(),
69 false
70 );
71 }
72
73 /**
74 * Return a confirmation message instance
75 *
76 * @return \TYPO3\CMS\Install\Updates\Confirmation
77 */
78 public function getConfirmation(): Confirmation
79 {
80 return $this->confirmation;
81 }
82
83 /**
84 * Return the identifier for this wizard
85 * This should be the same string as used in the ext_localconf class registration
86 *
87 * @return string
88 */
89 public function getIdentifier(): string
90 {
91 return 'compatibility7Extension';
92 }
93
94 /**
95 * Return the speaking name of this wizard
96 *
97 * @return string
98 */
99 public function getTitle(): string
100 {
101 return 'Install compatibility extension for TYPO3 7 compatibility';
102 }
103
104 /**
105 * Return the description for this wizard
106 *
107 * @return string
108 */
109 public function getDescription(): string
110 {
111 return 'The extension "compatibility7" (Compatibility Mode for TYPO3 v7) was extracted into '
112 . 'the TYPO3 Extension Repository. This update downloads the TYPO3 Extension from the TER.';
113 }
114
115 /**
116 * Is an update necessary?
117 * Is used to determine whether a wizard needs to be run.
118 *
119 * @return bool
120 */
121 public function updateNecessary(): bool
122 {
123 return !ExtensionManagementUtility::isLoaded('compatibility7');
124 }
125
126 /**
127 * Returns an array of class names of Prerequisite classes
128 * This way a wizard can define dependencies like "database up-to-date" or
129 * "reference index updated"
130 *
131 * @return string[]
132 */
133 public function getPrerequisites(): array
134 {
135 return [];
136 }
137 }