1111Implementing an upgrade wizard
1212==============================
1313
14- .. versionchanged :: 13.0
15- The registration via
16- :php: `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] `
17- in :file: `ext_localconf.php ` was removed in TYPO3 v13.
14+ .. deprecated :: 14.0
15+ The attribute :php: `\T YPO3\C MS\I nstall\A ttribute\U pgradeWizard ` has been
16+ deprecated in favour of :php: `\T YPO3\C MS\C ore\A ttribute\U pgradeWizard `.
17+
18+ The interfaces and classes used for upgrade wizards have been moved from
19+ namespace `\TYPO3\CMS\Install\Updates ` to `\TYPO3\CMS\Core\Upgrades `.
20+
21+ Using the old locations is deprecated in v14 but can be used to provide
22+ compatibility with both TYPO3 v13 and v14.
1823
1924To create an upgrade wizard you have to add a class which implements the
2025:ref: `UpgradeWizardInterface <upgrade-wizards-interface >`.
@@ -35,12 +40,20 @@ The class *may* implement other interfaces (optional):
3540UpgradeWizardInterface
3641======================
3742
43+ .. deprecated :: 14.0
44+ :php: `\T YPO3\C MS\I nstall\U pdates\U pgradeWizardInterface ` has been deprecated,
45+ implement :php: `\T YPO3\C MS\C ore\U pgrades\U pgradeWizardInterface ` once dropping
46+ TYPO3 v13 support.
47+
48+ The attribute :php: `\T YPO3\C MS\I nstall\A ttribute\U pgradeWizard ` has been
49+ deprecated in favour of :php: `\T YPO3\C MS\C ore\A ttribute\U pgradeWizard `.
50+
3851Each upgrade wizard consists of a single PHP file containing a single PHP class.
39- This class has to implement :php: `TYPO3\C MS\I nstall \U pdates \U pgradeWizardInterface `
52+ This class has to implement :php: `\ T YPO3\C MS\C ore \U pgrades \U pgradeWizardInterface `
4053and its methods.
4154
4255The registration of an upgrade wizard is done directly in the class by adding
43- the class attribute :php: `\T YPO3\C MS\I nstall \A ttribute\U pgradeWizard `. The
56+ the class attribute :php: `\T YPO3\C MS\C ore \A ttribute\U pgradeWizard `. The
4457:ref: `unique identifier <upgrade-wizards-identifier >` is passed as an argument.
4558
4659.. literalinclude :: _ExampleUpgradeWizard.php
@@ -68,16 +81,16 @@ Method :php:`getPrerequisites()`
6881 can define dependencies before it can be performed. Currently, the following
6982 prerequisites exist:
7083
71- * ` DatabaseUpdatedPrerequisite `:
84+ * :php-short: ` \T YPO3 \C MS \C ore \U pgrades \ D atabaseUpdatedPrerequisite `:
7285 Ensures that the database table fields are up-to-date.
73- * ` ReferenceIndexUpdatedPrerequisite `:
86+ * :php-short: ` \T YPO3 \C MS \C ore \U pgrades \ R eferenceIndexUpdatedPrerequisite `:
7487 The reference index needs to be up-to-date.
7588
7689 .. code-block :: php
7790 :caption: EXT:my_extension/Classes/Upgrades/ExampleUpgradeWizard.php
7891
79- use TYPO3\CMS\Install\Updates \DatabaseUpdatedPrerequisite;
80- use TYPO3\CMS\Install\Updates \ReferenceIndexUpdatedPrerequisite;
92+ use TYPO3\CMS\Core\Upgrades \DatabaseUpdatedPrerequisite;
93+ use TYPO3\CMS\Core\Upgrades \ReferenceIndexUpdatedPrerequisite;
8194
8295 /**
8396 * @return string[]
@@ -107,7 +120,6 @@ command:
107120
108121.. include :: /_includes/CliCacheFlush.rst.txt
109122
110-
111123.. index :: Upgrade wizards; Identifier
112124.. _upgrade-wizards-identifier :
113125
@@ -158,12 +170,17 @@ Some examples:
158170Marking wizard as done
159171======================
160172
173+ .. deprecated :: 14.0
174+ :php: `\T YPO3\C MS\I nstall\U pdates\R epeatableInterface ` has been deprecated,
175+ implement :php: `\T YPO3\C MS\C ore\U pgrades\R epeatableInterface ` once dropping
176+ TYPO3 v13 support.
177+
161178As soon as the wizard has completely finished, for example, it detected that no
162179upgrade is necessary anymore, the wizard is marked as done and will not be
163180checked anymore.
164181
165182To force TYPO3 to check the wizard every time, the interface
166- :t3src: ` install/Classes/Updates/ RepeatableInterface.php ` has to be implemented.
183+ :php: ` \T YPO3 \C MS \C ore \U pgrades \ R epeatableInterface ` has to be implemented.
167184This interface works as a marker and does not force any methods to be
168185implemented.
169186
@@ -175,23 +192,24 @@ implemented.
175192Generating output
176193=================
177194
178- The :php: `ChattyInterface ` can be implemented for wizards which should generate
179- output. :t3src: `install/Classes/Updates/ChattyInterface.php ` uses the Symfony
180- interface `OutputInterface `_.
181-
182- .. _OutputInterface : https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Console/Output/OutputInterface.php
195+ The :php: `\T YPO3\C MS\I nstall\U pdates\C hattyInterface ` can be implemented for
196+ wizards which should generate
197+ output. It uses the Symfony interface
198+ :php: `\S ymfony\C omponent\C onsole\O utput\O utputInterface `.
183199
184200Classes using this interface must implement the following method:
185201
186202.. code-block :: php
187203 :caption: vendor/symfony/console/Output/OutputInterface.php
188204
205+ use Symfony\Component\Console\Output\OutputInterface;
206+
189207 /**
190208 * Setter injection for output into upgrade wizards
191209 */
192210 public function setOutput(OutputInterface $output): void;
193211
194- The class :t3src: ` install/Classes/Updates/ DatabaseUpdatedPrerequisite.php `
212+ The class :php: ` \T YPO3 \C MS \C ore \U pgrades \ D atabaseUpdatedPrerequisite `
195213implements this interface. We are showing a simplified example here, based on
196214this class:
197215
@@ -200,6 +218,8 @@ this class:
200218 :emphasize-lines: 8,10-13,20
201219
202220 use Symfony\Component\Console\Output\OutputInterface;
221+ use TYPO3\CMS\Core\Upgrades\DatabaseUpdatedPrerequisite;
222+ use TYPO3\CMS\Core\Upgrades\ChattyInterface;
203223
204224 class DatabaseUpdatedPrerequisite implements PrerequisiteInterface, ChattyInterface
205225 {
@@ -234,6 +254,13 @@ this class:
234254Executing the wizard
235255====================
236256
257+ .. versionchanged :: 14.0
258+ The upgrade wizards can always be run via the console command
259+ `typo3 upgrade:run `.
260+
261+ The backend module :guilabel: `System > Upgrade ` can only be used if
262+ :composer: `typo3/cms-install ` is installed.
263+
237264Wizards are listed in the backend module :guilabel: `System > Upgrade ` and
238265the card :guilabel: `Upgrade Wizard `. The registered wizard should be shown
239266there, as long as it is not done.
0 commit comments