.. include:: ../../Includes.txt .. preferably, use label "upgrade-wizards-creation" .. _update-wizards-creation-generic: .. _upgrade-wizards-creation: .. _upgrade-wizard-interface: ================================ Creating Generic Upgrade Wizards ================================ 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:: `__. Classes using this interface must implement the following method:: /** * Setter injection for output into upgrade wizards * * @param OutputInterface $output */ 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:: use Symfony\Component\Console\Output\OutputInterface; use TYPO3\CMS\Install\Updates\ChattyInterface; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; class FormFileExtensionUpdate implements ChattyInterface, UpgradeWizardInterface { /** * @var OutputInterface */ protected $output; public function setOutput(OutputInterface $output): void { $this->output = $output; } /** * Checks whether updates are required. * * @return bool Whether an update is required (TRUE) or not (FALSE) */ public function updateNecessary(): bool { $updateNeeded = false; if ( $formDefinitionInformation['hasNewFileExtension'] === false && $formDefinitionInformation['location'] === 'storage' ) { $updateNeeded = true; $this->output->writeln('Form definition files were found that should be migrated to be named .form.yaml.'); } // etc. return $updateNeeded; } // etc. } Registering 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; Executing wizard ================ Wizards are listed inside the install tool, inside navigation "Upgrade" and the card "Upgrade Wizard". The registered wizard should be shown there, as long as he is not done.