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