[TASK] Migrate extension install upgrade wizards to new API
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / AdminPanelInstall.php
1 <?php
2 declare(strict_types = 1);
3
4 namespace TYPO3\CMS\Install\Updates;
5
6 /*
7 * This file is part of the TYPO3 CMS project.
8 *
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
12 *
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
15 *
16 * The TYPO3 project - inspiring people to share!
17 */
18
19 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
20
21 /**
22 * Installs EXT:adminpanel
23 */
24 class AdminPanelInstall extends AbstractDownloadExtensionUpdate
25 {
26
27 /**
28 * @var \TYPO3\CMS\Install\Updates\Confirmation
29 */
30 protected $confirmation;
31
32 public function __construct()
33 {
34 $this->extension = new ExtensionModel(
35 'adminpanel',
36 'TYPO3 Admin Panel',
37 '9.2',
38 'typo3/cms-adminpanel',
39 'The TYPO3 admin panel provides a panel with additional functionality in the frontend (Debugging, Caching, Preview...)'
40 );
41
42 $this->confirmation = new Confirmation(
43 'Are you sure?',
44 'You should install the "adminpanel" only if needed. ' . $this->extension->getDescription(),
45 true
46 );
47 }
48
49 /**
50 * Return a confirmation message instance
51 *
52 * @return \TYPO3\CMS\Install\Updates\Confirmation
53 */
54 public function getConfirmation(): Confirmation
55 {
56 return $this->confirmation;
57 }
58
59 /**
60 * Return the identifier for this wizard
61 * This should be the same string as used in the ext_localconf class registration
62 *
63 * @return string
64 */
65 public function getIdentifier(): string
66 {
67 return 'adminpanelExtension';
68 }
69
70 /**
71 * Return the speaking name of this wizard
72 *
73 * @return string
74 */
75 public function getTitle(): string
76 {
77 return 'Install extension "adminpanel"';
78 }
79
80 /**
81 * Return the description for this wizard
82 *
83 * @return string
84 */
85 public function getDescription(): string
86 {
87 return 'The TYPO3 admin panel was extracted to an own extension. This update installs the extension.';
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('adminpanel');
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 }