1<?php
2namespace 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
17use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
18
19/**
20 * Installs and downloads EXT:rtehtmlarea if needed
21 * @internal This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.
22 */
23class RteHtmlAreaExtractionUpdate 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            'rtehtmlarea',
34            'RTE HTMLArea for TYPO3',
35            '8.7.0',
36            'friendsoftypo3/rtehtmlarea',
37            'The extension provides the well-known RTE used in previous TYPO3 versions, if handling of images or custom legacy configurations are necessary.'
38        );
39
40        $this->confirmation = new Confirmation(
41            'Are you sure?',
42            'You should install EXT:rtehtmlarea 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 'rtehtmlareaExtension';
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 "rtehtmlarea" 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 extension "rtehtmlarea" (RTE based on HtmlArea) was extracted into'
86               . ' the TYPO3 Extension Repository. This update downloads the TYPO3 Extension from the TER.'
87               . ' Use this if you have special configurations or image handling within Rich Text fields and uninstall the shipped EXT:rte_ckeditor.';
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('rtehtmlarea');
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}
113