1<?php
2
3declare(strict_types=1);
4
5/*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18namespace TYPO3\CMS\Install\Updates;
19
20use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
21
22/**
23 * Installs EXT:adminpanel
24 * @internal This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.
25 */
26class AdminPanelInstall extends AbstractDownloadExtensionUpdate
27{
28
29    /**
30     * @var \TYPO3\CMS\Install\Updates\Confirmation
31     */
32    protected $confirmation;
33
34    public function __construct()
35    {
36        $this->extension = new ExtensionModel(
37            'adminpanel',
38            'TYPO3 Admin Panel',
39            '9.2',
40            'typo3/cms-adminpanel',
41            'The TYPO3 admin panel provides a panel with additional functionality in the frontend (Debugging, Caching, Preview...)'
42        );
43
44        $this->confirmation = new Confirmation(
45            'Are you sure?',
46            'You should install the "adminpanel" only if needed. ' . $this->extension->getDescription(),
47            true
48        );
49    }
50
51    /**
52     * Return a confirmation message instance
53     *
54     * @return \TYPO3\CMS\Install\Updates\Confirmation
55     */
56    public function getConfirmation(): Confirmation
57    {
58        return $this->confirmation;
59    }
60
61    /**
62     * Return the identifier for this wizard
63     * This should be the same string as used in the ext_localconf class registration
64     *
65     * @return string
66     */
67    public function getIdentifier(): string
68    {
69        return 'adminpanelExtension';
70    }
71
72    /**
73     * Return the speaking name of this wizard
74     *
75     * @return string
76     */
77    public function getTitle(): string
78    {
79        return 'Install extension "adminpanel"';
80    }
81
82    /**
83     * Return the description for this wizard
84     *
85     * @return string
86     */
87    public function getDescription(): string
88    {
89        return 'The TYPO3 admin panel was extracted to an own extension. This update installs the extension.';
90    }
91
92    /**
93     * Is an update necessary?
94     * Is used to determine whether a wizard needs to be run.
95     *
96     * @return bool
97     */
98    public function updateNecessary(): bool
99    {
100        return !ExtensionManagementUtility::isLoaded('adminpanel');
101    }
102
103    /**
104     * Returns an array of class names of Prerequisite classes
105     * This way a wizard can define dependencies like "database up-to-date" or
106     * "reference index updated"
107     *
108     * @return string[]
109     */
110    public function getPrerequisites(): array
111    {
112        return [];
113    }
114}
115