Updates extends Updater
Update functions to be used on plugin updates.
Tags
Table of Contents
- $updates : array<string|int, mixed>
- Callbacks functions that are called on a plugin update.
- __construct() : mixed
- {@inheritdoc}
- is_new_install() : bool
- Condition to verify if it's a new plugin installation and not an update.
- update_4_0_0_backup_old_settings() : mixed
- Migrate old settings into the new table settings.
- update_4_0_0_delete_unused_settings() : mixed
- Deletes unused old settings that were transfered to the table builder.
- update_4_0_0_migrate_checkbox_settings() : mixed
- Update checkbox settings with the new compatible values.
- update_4_0_0_migrate_settings_to_table_builder() : mixed
- Migrate old settings into the new table settings.
- update_4_0_0_migrate_wwp_layout_options() : mixed
- Migrate WWP layout options.
Properties
$updates
Callbacks functions that are called on a plugin update.
public
static array<string|int, mixed>
$updates
= ['4.0.0' => ['update_4_0_0_backup_old_settings', 'update_4_0_0_migrate_settings_to_table_builder', 'update_4_0_0_migrate_wwp_layout_options', 'update_4_0_0_migrate_checkbox_settings', 'update_4_0_0_delete_unused_settings']]
Please note that these functions are invoked when a plugin is updated from a previous version, but NOT when the plugin is newly installed.
The array keys should contain the version number, and it MUST be sorted from low to high.
Example:
'1.11.0' => [ 'update_1_11_0_do_something', 'update_1_11_0_do_something_else', ], '1.23.0' => [ 'update_1_23_0_do_something', ],
Methods
__construct()
{@inheritdoc}
public
__construct(Plugin $plugin[, mixed $args = null ]) : mixed
Parameters
- $plugin : Plugin
- $args : mixed = null
Return values
mixed —is_new_install()
Condition to verify if it's a new plugin installation and not an update.
public
is_new_install() : bool
Return values
bool —update_4_0_0_backup_old_settings()
Migrate old settings into the new table settings.
public
static update_4_0_0_backup_old_settings() : mixed
Return values
mixed —update_4_0_0_delete_unused_settings()
Deletes unused old settings that were transfered to the table builder.
public
static update_4_0_0_delete_unused_settings() : mixed
Return values
mixed —update_4_0_0_migrate_checkbox_settings()
Update checkbox settings with the new compatible values.
public
static update_4_0_0_migrate_checkbox_settings() : mixed
Return values
mixed —update_4_0_0_migrate_settings_to_table_builder()
Migrate old settings into the new table settings.
public
static update_4_0_0_migrate_settings_to_table_builder() : mixed
Return values
mixed —update_4_0_0_migrate_wwp_layout_options()
Migrate WWP layout options.
public
static update_4_0_0_migrate_wwp_layout_options() : mixed
Must run before update_4_0_0_delete_unused_settings so that it uses the old settings and not the default plugin ones.