Skip to content

Commit

Permalink
Change overview for upgrade wizard (#1329)
Browse files Browse the repository at this point in the history
* Change overview for upgrade wizard

On the implementation page an overview over necessary steps is displayed.
This way, the reader can see all the necessary steps in one place before
looking at the details.

Also, the necessary step of registering is moved up before the optional
interfaces.

Because an overview over the interfaces is now on the implementation page,
it is dropped from the start page in the chapter (Index.rst).

* Small text updates

Co-authored-by: Martin Bless <martin.bless@mbless.de>
  • Loading branch information
sypets and marble committed Mar 15, 2021
1 parent 6fe3f7a commit fee5f8a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 31 deletions.
70 changes: 47 additions & 23 deletions Documentation/ApiOverview/UpdateWizards/Creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@
Creating upgrade wizards
========================

These steps create an upgrade wizard:

.. rst-class:: bignums

#. Add a class implementing :ref:`UpgradeWizardInterface <upgrade-wizards-interface>`

#. The class *may* implement other interfaces (optional):

* :ref:`RepeatableInterface <repeatable-interface>` to not mark the wizard
as done after execution

* :ref:`ChattyInterface <uprade-wizards-chatty-interface>` for generating
output

* :php:`ConfirmableInferface` for wizards that need user confirmation

#. :ref:`Register the wizard <upgrade-wizards-register>` in the file
:file:`ext_localconf.php`


.. _upgrade-wizards-interface:

UpgradeWizardInterface
======================

Each upgrade wizard consists of a single PHP file containing a single PHP class. This
class has to implement :php:`TYPO3\CMS\Install\Updates\UpgradeWizardInterface` and its
methods::
Expand Down Expand Up @@ -124,22 +149,40 @@ Method :php:`getPrerequisites`
];
}
.. index:: Upgrade wizards; Registration
.. _upgrade-wizards-register:

Registering wizards
===================

Once the wizard is created, it needs to be registered. Registration is done in
:file:`ext_localconf.php`::

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['exampleUpdateWizard']
= \Vendor\ExtName\Updates\ExampleUpdateWizard::class;

**Important:** Use the same identifier as key (here: `exampleUpdateWizard`), which
is returned by :php:`UpgradeWizardInterface::getIdentifier()` in your wizard
class.

.. index:: Upgrade wizards; Marking wizard as done
.. _upgrade-wizards-mark-as-done:
.. _repeatable-interface:

Marking wizard as done
======================

As soon as the wizard has completely finished (e.g. it detected that no update is
necessary anymore) the wizard
As soon as the wizard has completely finished, for example it detected that no update is
necessary anymore, the wizard
is marked as done and won't be checked anymore.

To force TYPO3 to check the wizard every time, the interface
:php:`\TYPO3\CMS\Install\Updates\RepeatableInterface` has to be implemented.
This interface works as a marker and does not force any methods to be
implemented.


.. index:: Upgrade wizards; Generating output
.. _upgrade-wizards-generate-output:
.. _uprade-wizards-chatty-interface:
Expand All @@ -161,10 +204,8 @@ Classes using this interface must implement the following method::
public function setOutput(OutputInterface $output): void;




The class :php:`FormFileExtensionUpdate` in the extension "form" implements this interface.
We show a simplified example here, based on this class::
We are showing a simplified example here, based on this class::

use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Install\Updates\ChattyInterface;
Expand Down Expand Up @@ -208,23 +249,6 @@ We show a simplified example here, based on this class::

}


.. index:: Upgrade wizards; Registration

Registering the wizard
======================

Once the wizard is created, it needs to be registered. Registration is done in
:file:`ext_localconf.php`::

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['exampleUpdateWizard']
= \Vendor\ExtName\Updates\ExampleUpdateWizard::class;

**Important:** Use the same identifier as key (here: `exampleUpdateWizard`), which
is returned by :php:`UpgradeWizardInterface::getIdentifier()` in your wizard
class.


.. index:: Upgrade wizards; Execution

Executing the wizard
Expand All @@ -242,4 +266,4 @@ It is also possible to execute the wizard from the command line.
You can find more information about running upgrade wizards in the
:ref:`Upgrade wizard section <t3install:use-the-upgrade-wizard>` of the
Installation Guide.
Installation Guide.
8 changes: 0 additions & 8 deletions Documentation/ApiOverview/UpdateWizards/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ extensions. TYPO3 itself provides upgrade wizards to ease updates of TYPO3
versions. This chapter will explain the concept and how to write upgrade
wizards.

The API for upgrade wizards comes with the following interfaces:

* (required) :ref:`UpgradeWizardInterface <upgrade-wizard-interface>`: Main interface for UpgradeWizards. All
upgrade wizards using the API **must** implement this interface.
* (optional) :ref:`RepeatableInterface <repeatable-interface>`: Semantic interface to denote wizards that can be repeated
* (optional) :ref:`ChattyInterface <uprade-wizards-chatty-interface>`: Interface for wizards generating output
* (optional) :php:`ConfirmableInferface`: Interface for wizards that need user confirmation

.. toctree::
:titlesonly:

Expand Down

0 comments on commit fee5f8a

Please sign in to comment.