removed double retrieving of plugin data

This commit is contained in:
Daniel Hüsken 2024-11-20 15:29:26 +01:00
parent f2ff105a0d
commit e018dcff7c
No known key found for this signature in database
GPG key ID: 9F732DA37FA709E8

View file

@ -91,18 +91,9 @@ define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' );
function () { function () {
init(); init();
if ( ! function_exists( 'get_plugin_data' ) ) { $current_plugin_version = (string) PPCP::container()->get( 'ppcp.plugin' )->getVersion();
/**
* Skip check for WP files.
*
* @psalm-suppress MissingFile
*/
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugin_data = get_plugin_data( __DIR__ . '/woocommerce-paypal-payments.php', false );
$plugin_version = $plugin_data['Version'] ?? null;
$installed_plugin_version = get_option( 'woocommerce-ppcp-version' ); $installed_plugin_version = get_option( 'woocommerce-ppcp-version' );
if ( $installed_plugin_version !== $plugin_version ) { if ( $installed_plugin_version !== $current_plugin_version ) {
/** /**
* The hook fired when the plugin is installed or updated. * The hook fired when the plugin is installed or updated.
*/ */
@ -114,7 +105,7 @@ define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' );
*/ */
do_action( 'woocommerce_paypal_payments_gateway_migrate_on_update' ); do_action( 'woocommerce_paypal_payments_gateway_migrate_on_update' );
} }
update_option( 'woocommerce-ppcp-version', $plugin_version ); update_option( 'woocommerce-ppcp-version', $current_plugin_version );
} }
}, },
-1 -1