[BUGFIX] Add extension suggestions to EXT:form
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / Typo3DbExtractionUpdate.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:typo3db_legacy
21 * @internal This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.
22 */
23 class Typo3DbExtractionUpdate extends AbstractDownloadExtensionUpdate
24 {
25 /**
26 * @var \TYPO3\CMS\Install\Updates\Confirmation
27 */
28 protected $confirmation;
29
30 public function __construct()
31 {
32 $this->extension = new ExtensionModel(
33 'typo3db_legacy',
34 '$GLOBALS[\'TYPO3_DB\'] compatibility layer',
35 '1.1.1',
36 'friendsoftypo3/typo3db-legacy',
37 'This extension provides the well-known database API $GLOBALS[\'TYPO3_DB\'] used in previous TYPO3 versions for extensions that still rely on it.'
38 );
39
40 $this->confirmation = new Confirmation(
41 'Are you sure?',
42 'You should install EXT:typo3db_legacy only if you really need it. ' . $this->extension->getDescription(),
43 false
44 );
45 }
46
47 /**
48 * Return a confirmation message instance
49 *
50 * @return \TYPO3\CMS\Install\Updates\Confirmation
51 */
52 public function getConfirmation(): Confirmation
53 {
54 return $this->confirmation;
55 }
56
57 /**
58 * Return the identifier for this wizard
59 * This should be the same string as used in the ext_localconf class registration
60 *
61 * @return string
62 */
63 public function getIdentifier(): string
64 {
65 return 'typo3DbLegacyExtension';
66 }
67
68 /**
69 * Return the speaking name of this wizard
70 *
71 * @return string
72 */
73 public function getTitle(): string
74 {
75 return 'Install extension "typo3db_legacy" from TER';
76 }
77
78 /**
79 * Return the description for this wizard
80 *
81 * @return string
82 */
83 public function getDescription(): string
84 {
85 return 'The old database API populated as $GLOBALS[\'TYPO3_DB\'] has been extracted into'
86 . ' the TYPO3 Extension Repository. This update downloads the TYPO3 extension typo3db_legacy from the TER.'
87 . ' Use this if you\'re dealing with extensions in the instance that still rely on the old database API.';
88 }
89
90 /**
91 * Is an update necessary?
92 * Is used to determine whether a wizard needs to be run.
93 *
94 * @return bool
95 */
96 public function updateNecessary(): bool
97 {
98 return !ExtensionManagementUtility::isLoaded($this->extension->getKey());
99 }
100
101 /**
102 * Returns an array of class names of Prerequisite classes
103 * This way a wizard can define dependencies like "database up-to-date" or
104 * "reference index updated"
105 *
106 * @return string[]
107 */
108 public function getPrerequisites(): array
109 {
110 return [];
111 }
112 }