Skip to content

Commit 454771f

Browse files
committed
[TASK] Allow shipping upgrade wizards w/o requiring EXT:install
Resolves: TYPO3-Documentation/Changelog-To-Doc#1496 Releases: main
1 parent 1fecb76 commit 454771f

File tree

4 files changed

+52
-27
lines changed

4 files changed

+52
-27
lines changed

Documentation/ExtensionArchitecture/HowTo/UpdateExtensions/UpdateWizards/Concept.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@ Each wizard is able to check pre-conditions to prevent execution, if nothing has
2626
to be updated. The wizard can log information and executed SQL statements, that
2727
can be displayed after execution.
2828

29-
Best practice
30-
=============
29+
.. rubric:: Best practice
3130

3231
Each extension can provide as many upgrade wizards as necessary. Each wizard
3332
should perform exactly one specific update.
3433

35-
Examples
36-
========
34+
.. rubric:: Examples
3735

38-
The TYPO3 Core itself provides upgrade wizards inside
39-
:t3src:`install/Classes/Updates/`.
36+
See `Examples for common upgrade wizards <https://docs.typo3.org/permalink/t3coreapi:upgrade-wizard-examples>`_.

Documentation/ExtensionArchitecture/HowTo/UpdateExtensions/UpdateWizards/Creation.rst

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
Implementing 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:`\TYPO3\CMS\Install\Attribute\UpgradeWizard` has been
16+
deprecated in favour of :php:`\TYPO3\CMS\Core\Attribute\UpgradeWizard`.
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

1924
To 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):
3540
UpgradeWizardInterface
3641
======================
3742

43+
.. deprecated:: 14.0
44+
:php:`\TYPO3\CMS\Install\Updates\UpgradeWizardInterface` has been deprecated,
45+
implement :php:`\TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface` once dropping
46+
TYPO3 v13 support.
47+
48+
The attribute :php:`\TYPO3\CMS\Install\Attribute\UpgradeWizard` has been
49+
deprecated in favour of :php:`\TYPO3\CMS\Core\Attribute\UpgradeWizard`.
50+
3851
Each upgrade wizard consists of a single PHP file containing a single PHP class.
39-
This class has to implement :php:`TYPO3\CMS\Install\Updates\UpgradeWizardInterface`
52+
This class has to implement :php:`\TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface`
4053
and its methods.
4154

4255
The registration of an upgrade wizard is done directly in the class by adding
43-
the class attribute :php:`\TYPO3\CMS\Install\Attribute\UpgradeWizard`. The
56+
the class attribute :php:`\TYPO3\CMS\Core\Attribute\UpgradeWizard`. 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:`\TYPO3\CMS\Core\Upgrades\DatabaseUpdatedPrerequisite`:
7285
Ensures that the database table fields are up-to-date.
73-
* `ReferenceIndexUpdatedPrerequisite`:
86+
* :php-short:`\TYPO3\CMS\Core\Upgrades\ReferenceIndexUpdatedPrerequisite`:
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:
158171
Marking wizard as done
159172
======================
160173

174+
.. deprecated:: 14.0
175+
:php:`\TYPO3\CMS\Install\Updates\RepeatableInterface` has been deprecated,
176+
implement :php:`\TYPO3\CMS\Core\Upgrades\RepeatableInterface` once dropping
177+
TYPO3 v13 support.
178+
161179
As soon as the wizard has completely finished, for example, it detected that no
162180
upgrade is necessary anymore, the wizard is marked as done and will not be
163181
checked anymore.
164182

165183
To force TYPO3 to check the wizard every time, the interface
166-
:t3src:`install/Classes/Updates/RepeatableInterface.php` has to be implemented.
184+
:php:`\TYPO3\CMS\Core\Upgrades\RepeatableInterface` has to be implemented.
167185
This interface works as a marker and does not force any methods to be
168186
implemented.
169187

@@ -175,23 +193,24 @@ implemented.
175193
Generating 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:`\TYPO3\CMS\Install\Updates\ChattyInterface` can be implemented for
197+
wizards which should generate
198+
output. It uses the Symfony interface
199+
:php:`\Symfony\Component\Console\Output\OutputInterface`.
183200

184201
Classes 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:`\TYPO3\CMS\Core\Upgrades\DatabaseUpdatedPrerequisite`
195214
implements this interface. We are showing a simplified example here, based on
196215
this 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:
234255
Executing the wizard
235256
====================
236257

258+
.. versionchanged:: 14.0
259+
While extensions implementing the
260+
:php-short:`\TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface` do not have to
261+
require :composer:`typo3/cms-install` anymore, that extension is still
262+
required to actually run upgrade wizards.
263+
237264
Wizards are listed in the backend module :guilabel:`System > Upgrade` and
238265
the card :guilabel:`Upgrade Wizard`. The registered wizard should be shown
239266
there, as long as it is not done.

Documentation/ExtensionArchitecture/HowTo/UpdateExtensions/UpdateWizards/_ExampleUpgradeWizard.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
namespace MyVendor\MyExtension\Upgrades;
66

7-
use TYPO3\CMS\Install\Attribute\UpgradeWizard;
8-
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
7+
8+
use TYPO3\CMS\Core\Attribute\UpgradeWizard;
9+
use TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface;
910

1011
#[UpgradeWizard('myExtension_exampleUpgradeWizard')]
1112
final class ExampleUpgradeWizard implements UpgradeWizardInterface

Documentation/ExtensionArchitecture/HowTo/UpdateExtensions/UpdateWizards/_SwitchableControllerActionUpgradeWizard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace MyVendor\MyExtension\Upgrades;
66

7+
use TYPO3\CMS\Core\Attribute\UpgradeWizard;
78
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
89
use TYPO3\CMS\Core\Database\ConnectionPool;
9-
use TYPO3\CMS\Install\Attribute\UpgradeWizard;
10-
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
10+
use TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface;
1111

1212
#[UpgradeWizard('myExtension_switchableControllerActionUpgradeWizard')]
1313
final class SwitchableControllerActionUpgradeWizard implements UpgradeWizardInterface

0 commit comments

Comments
 (0)