Cherry Blossom feature
Updates: Registry
Registers migrations and orders their execution.
Registers migrations and orders their execution.
Capabilities and extension points
Validates and orders parent-theme migrations.
Registered migrations keyed by immutable ID.
- var array
Registration positions keyed by immutable ID.
- var array
Registers a migration class.
The class must have a constructor that requires no arguments and must implement the migration interface. Extending the supplied Migration base class is the simplest way to meet this contract.
- param string $class Migration class name.
- return Migration Registered migration instance.
- throws \InvalidArgumentException When the class is invalid.
Registers a callback migration.
The update callback is required. Installation and detection callbacks are optional. All callbacks receive Context as their only argument. An absent installation callback does nothing; it does not run the update callback. Detection defaults to true. A false detection result records completion without execution. Execution callbacks report failure with WP_Error or a thrown exception; returning false alone does not report a failure.
- param string $id Immutable migration identifier.
- param string $version Target parent version.
- param callable $update_callback Existing-site callback.
- param callable|null $install_callback Clean-installation callback.
- param callable|null $should_run_callback Applicability callback.
- return Migration Registered migration instance.
- throws \InvalidArgumentException When a callback or migration metadata is invalid.
Gets migrations in deterministic execution order.
- return Migration[] Migrations ordered by version, then registration order.
Validates migration targets against the running parent version.
- param string $current_version Running parent version.
- throws \UnexpectedValueException When the current version is not a non-empty string or a migration targets a newer version.
Validates and stores a migration instance.
- param Migration $migration Migration instance.
- return Migration Registered migration instance.
- throws \InvalidArgumentException When its metadata is invalid.
Source reference
This editable reference page is based on the PHP documentation in updates/class-registry.php.