Version_Updater implements Registerable, Standard_Service

Hook into the plugin activation process.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
Standard_Service

Table of Contents

$file  : string
Plugin's entry file
$plugin  : Plugin
Plugin instance
$version_updates  : array<string|int, mixed>
Version updates available for the current version
__construct()  : mixed
Class constructor
convert_formula()  : void
Convert a price formula option to the new format.
convert_formulas()  : void
Convert all the formulas to version 2.3.0
register()  : void
Register the service
run_updates()  : void
Run updates based on the database version number.
update_220()  : void
Update to version 2.2.0
update_230()  : void
Update to version 2.3.0
do_option_need_conversion()  : mixed
Determine whether an option are already converted to the new format.
process_new_variable()  : array<string|int, mixed>
Process a variable from an older formula to a new variable format.

Properties

$version_updates

Version updates available for the current version

private array<string|int, mixed> $version_updates = ['2.2.0', '2.3.0']

Array of version numbers

Tags

Methods

__construct()

Class constructor

public __construct(Licensed_Plugin $plugin) : mixed
Parameters
$plugin : Licensed_Plugin
Tags
Return values
mixed

convert_formula()

Convert a price formula option to the new format.

public static convert_formula(Option $option) : void
Parameters
$option : Option

The option to convert.

Tags
Return values
void

convert_formulas()

Convert all the formulas to version 2.3.0

public convert_formulas() : void
Tags
Return values
void

register()

Register the service

public register() : void
Tags
Return values
void

run_updates()

Run updates based on the database version number.

public run_updates() : void
Tags
Return values
void

update_220()

Update to version 2.2.0

public update_220() : void
Tags
Return values
void

update_230()

Update to version 2.3.0

public update_230() : void
Tags
Return values
void

do_option_need_conversion()

Determine whether an option are already converted to the new format.

private static do_option_need_conversion(Option $option) : mixed

The method will check if the option has a formula and if the formula has any variables that need conversion. If the formula has no variables or all of them are already in the new format, the method will return false.

Parameters
$option : Option

The option to check.

Tags
Return values
mixed

process_new_variable()

Process a variable from an older formula to a new variable format.

private static process_new_variable(Option $var_option, array<string|int, mixed> $tokens) : array<string|int, mixed>
Parameters
$var_option : Option

The option object the variable is referring to.

$tokens : array<string|int, mixed>

The exploded variable name.

Tags
Return values
array<string|int, mixed>

The new variable array.

Search results