mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
move updates to init hook because working with settings will get translation notice
This commit is contained in:
parent
cb0fdfa461
commit
0e72db52fe
1 changed files with 21 additions and 16 deletions
|
@ -90,23 +90,28 @@ define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' );
|
||||||
'plugins_loaded',
|
'plugins_loaded',
|
||||||
function () {
|
function () {
|
||||||
init();
|
init();
|
||||||
|
add_action(
|
||||||
|
'init',
|
||||||
|
function () {
|
||||||
|
$current_plugin_version = (string) PPCP::container()->get( 'ppcp.plugin' )->getVersion();
|
||||||
|
$installed_plugin_version = get_option( 'woocommerce-ppcp-version' );
|
||||||
|
if ( $installed_plugin_version !== $current_plugin_version ) {
|
||||||
|
/**
|
||||||
|
* The hook fired when the plugin is installed or updated.
|
||||||
|
*/
|
||||||
|
do_action( 'woocommerce_paypal_payments_gateway_migrate', $installed_plugin_version );
|
||||||
|
|
||||||
$current_plugin_version = (string) PPCP::container()->get( 'ppcp.plugin' )->getVersion();
|
if ( $installed_plugin_version ) {
|
||||||
$installed_plugin_version = get_option( 'woocommerce-ppcp-version' );
|
/**
|
||||||
if ( $installed_plugin_version !== $current_plugin_version ) {
|
* The hook fired when the plugin is updated.
|
||||||
/**
|
*/
|
||||||
* The hook fired when the plugin is installed or updated.
|
do_action( 'woocommerce_paypal_payments_gateway_migrate_on_update' );
|
||||||
*/
|
}
|
||||||
do_action( 'woocommerce_paypal_payments_gateway_migrate', $installed_plugin_version );
|
update_option( 'woocommerce-ppcp-version', $current_plugin_version );
|
||||||
|
}
|
||||||
if ( $installed_plugin_version ) {
|
},
|
||||||
/**
|
-1
|
||||||
* The hook fired when the plugin is updated.
|
);
|
||||||
*/
|
|
||||||
do_action( 'woocommerce_paypal_payments_gateway_migrate_on_update' );
|
|
||||||
}
|
|
||||||
update_option( 'woocommerce-ppcp-version', $current_plugin_version );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
register_activation_hook(
|
register_activation_hook(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue