Updates implements Standard_Service, Registerable, Plugin_Activation_Listener
Update functions to be used on plugin updates.
Tags
Interfaces, Classes and Traits
- Standard_Service
- Registerable
- Plugin_Activation_Listener
Table of Contents
- $updates : array<string|int, mixed>
- Callbacks functions that are called on a plugin update.
- $plugin : Plugin
- Plugin instance.
- __construct() : mixed
- Constructor.
- check_db_updates() : mixed
- Check if plugin has updates.
- get_current_code_version() : string
- Gets the current plugin version as stored in the code.
- get_current_database_version() : string|false
- Gets the current plugin version as stored in the database.
- get_update_callbacks() : array<string|int, mixed>
- Get the list of update callbacks.
- is_new_install() : bool
- Condition to verify if it's a new plugin installation and not an update.
- on_activate() : mixed
- Handle activation for brand-new installs.
- on_deactivate() : mixed
- Handle deactivation.
- queue_dataviews_reindex() : mixed
- Queue a forced DataViews reindex.
- register() : mixed
- Register update checks.
- update_4_0_0_enable_legacy_frontend_for_upgrades() : mixed
- Preserve legacy DataTables frontend for existing installs upgrading to v4.
- update_4_0_1_queue_dataviews_reindex() : mixed
- Queue a DataViews reindex after broadening PTP's index scope.
- update_db_version() : bool
- Updates the database version, normalizing prerelease package versions.
- update_version() : mixed
- Updates a specific version.
- get_version_option_name() : string
- Get the option name used to store the plugin database version.
- has_existing_install_markers() : bool
- Determine if this site has pre-v4 PTP install markers.
- is_existing_install_without_database_version() : bool
- Determine if this is an existing pre-updater install.
- is_filter_setting_enabled_for_upgrade() : bool
- Determine whether the pre-v4 filters setting represented enabled filters.
- normalize_database_version() : string
- Strip prerelease/build metadata from versions stored as database versions.
- run_updates_for_existing_install() : void
- Run applicable update callbacks for existing installs with no stored DB version.
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_enable_legacy_frontend_for_upgrades'], '4.0.1' => ['update_4_0_1_queue_dataviews_reindex']]
Tags
$plugin
Plugin instance.
private
Plugin
$plugin
Tags
Methods
__construct()
Constructor.
public
__construct(Plugin $plugin) : mixed
Parameters
- $plugin : Plugin
Tags
Return values
mixed —check_db_updates()
Check if plugin has updates.
public
check_db_updates() : mixed
Tags
Return values
mixed —get_current_code_version()
Gets the current plugin version as stored in the code.
public
get_current_code_version() : string
Tags
Return values
string —get_current_database_version()
Gets the current plugin version as stored in the database.
public
get_current_database_version() : string|false
Tags
Return values
string|false —get_update_callbacks()
Get the list of update callbacks.
public
static get_update_callbacks() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —is_new_install()
Condition to verify if it's a new plugin installation and not an update.
public
is_new_install() : bool
Tags
Return values
bool —on_activate()
Handle activation for brand-new installs.
public
on_activate(bool $network_wide) : mixed
Parameters
- $network_wide : bool
-
Whether the plugin is being activated network-wide.
Tags
Return values
mixed —on_deactivate()
Handle deactivation.
public
on_deactivate(bool $network_wide) : mixed
Parameters
- $network_wide : bool
-
Whether the plugin is being deactivated network-wide.
Tags
Return values
mixed —queue_dataviews_reindex()
Queue a forced DataViews reindex.
public
static queue_dataviews_reindex() : mixed
Tags
Return values
mixed —register()
Register update checks.
public
register() : mixed
Tags
Return values
mixed —update_4_0_0_enable_legacy_frontend_for_upgrades()
Preserve legacy DataTables frontend for existing installs upgrading to v4.
public
static update_4_0_0_enable_legacy_frontend_for_upgrades() : mixed
Tags
Return values
mixed —update_4_0_1_queue_dataviews_reindex()
Queue a DataViews reindex after broadening PTP's index scope.
public
static update_4_0_1_queue_dataviews_reindex() : mixed
Tags
Return values
mixed —update_db_version()
Updates the database version, normalizing prerelease package versions.
public
update_db_version([string|null $version = null ]) : bool
Parameters
- $version : string|null = null
-
Version number or null to use the current plugin version.
Tags
Return values
bool —update_version()
Updates a specific version.
public
static update_version([string $version = '' ]) : mixed
Parameters
- $version : string = ''
-
The version to update to.
Tags
Return values
mixed —get_version_option_name()
Get the option name used to store the plugin database version.
private
get_version_option_name() : string
Tags
Return values
string —has_existing_install_markers()
Determine if this site has pre-v4 PTP install markers.
private
has_existing_install_markers() : bool
Tags
Return values
bool —is_existing_install_without_database_version()
Determine if this is an existing pre-updater install.
private
is_existing_install_without_database_version() : bool
Tags
Return values
bool —is_filter_setting_enabled_for_upgrade()
Determine whether the pre-v4 filters setting represented enabled filters.
private
static is_filter_setting_enabled_for_upgrade(mixed $filters) : bool
Parameters
- $filters : mixed
-
The stored filters option.
Tags
Return values
bool —normalize_database_version()
Strip prerelease/build metadata from versions stored as database versions.
private
normalize_database_version(string $version) : string
Parameters
- $version : string
-
Version number.
Tags
Return values
string —run_updates_for_existing_install()
Run applicable update callbacks for existing installs with no stored DB version.
private
run_updates_for_existing_install() : void