move updates to init hook because working with settings will get translation notice

This commit is contained in:
Daniel Hüsken 2024-11-27 13:12:46 +01:00
parent cb0fdfa461
commit 0e72db52fe
No known key found for this signature in database
GPG key ID: 9F732DA37FA709E8

View file

@ -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(