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