[TASK] Migrate extension install upgrade wizards to new API
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / FuncExtractionUpdate.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:func
21 */
22 class FuncExtractionUpdate extends AbstractDownloadExtensionUpdate
23 {
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 'func',
34 'Web->Functions module',
35 '9.0.1',
36 'friendsoftypo3/cms-func',
37 'Provides Web->Functions BE module used in previous TYPO3 versions for extensions that still rely on it.'
38 );
39
40 $this->confirmation = new Confirmation(
41 'Are you sure?',
42 'You should install EXT:func 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 'funcExtension';
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 "func" 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 "func" that brings the "Web->Functions" backend module has been extracted to'
86 . ' the TYPO3 Extension Repository. This update downloads the TYPO3 extension func from the TER.'
87 . ' Use this if you\'re dealing with extensions in the instance that rely on "Web->Functions" and bring own'
88 . ' modules.';
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($this->extension->getKey());
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 }