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[]
@@ -158,12 +171,17 @@ Some examples:
158171Marking wizard as done
159172======================
160173
174+ .. deprecated :: 14.0
175+ :php: `\T YPO3\C MS\I nstall\U pdates\R epeatableInterface ` has been deprecated,
176+ implement :php: `\T YPO3\C MS\C ore\U pgrades\R epeatableInterface ` once dropping
177+ TYPO3 v13 support.
178+
161179As soon as the wizard has completely finished, for example, it detected that no
162180upgrade is necessary anymore, the wizard is marked as done and will not be
163181checked anymore.
164182
165183To force TYPO3 to check the wizard every time, the interface
166- :t3src: ` install/Classes/Updates/ RepeatableInterface.php ` has to be implemented.
184+ :php: ` \T YPO3 \C MS \C ore \U pgrades \ R epeatableInterface ` has to be implemented.
167185This interface works as a marker and does not force any methods to be
168186implemented.
169187
@@ -175,23 +193,24 @@ implemented.
175193Generating output
176194=================
177195
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
196+ The :php: `\T YPO3\C MS\I nstall\U pdates\C hattyInterface ` can be implemented for
197+ wizards which should generate
198+ output. It uses the Symfony interface
199+ :php: `\S ymfony\C omponent\C onsole\O utput\O utputInterface `.
183200
184201Classes using this interface must implement the following method:
185202
186203.. code-block :: php
187204 :caption: vendor/symfony/console/Output/OutputInterface.php
188205
206+ use Symfony\Component\Console\Output\OutputInterface;
207+
189208 /**
190209 * Setter injection for output into upgrade wizards
191210 */
192211 public function setOutput(OutputInterface $output): void;
193212
194- The class :t3src: ` install/Classes/Updates/ DatabaseUpdatedPrerequisite.php `
213+ The class :php: ` \T YPO3 \C MS \C ore \U pgrades \ D atabaseUpdatedPrerequisite `
195214implements this interface. We are showing a simplified example here, based on
196215this class:
197216
@@ -200,6 +219,8 @@ this class:
200219 :emphasize-lines: 8,10-13,20
201220
202221 use Symfony\Component\Console\Output\OutputInterface;
222+ use TYPO3\CMS\Core\Upgrades\DatabaseUpdatedPrerequisite;
223+ use TYPO3\CMS\Core\Upgrades\ChattyInterface;
203224
204225 class DatabaseUpdatedPrerequisite implements PrerequisiteInterface, ChattyInterface
205226 {
@@ -234,6 +255,12 @@ this class:
234255Executing the wizard
235256====================
236257
258+ .. versionchanged :: 14.0
259+ While extensions implementing the
260+ :php-short: `\T YPO3\C MS\C ore\U pgrades\U pgradeWizardInterface ` do not have to
261+ require :composer: `typo3/cms-install ` anymore, that extension is still
262+ required to actually run upgrade wizards.
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