From e018dcff7cf42ef6e23e794628589fbc534f7cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=BCsken?= Date: Wed, 20 Nov 2024 15:29:26 +0100 Subject: [PATCH] removed double retrieving of plugin data --- woocommerce-paypal-payments.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/woocommerce-paypal-payments.php b/woocommerce-paypal-payments.php index bc078e410..0bf25b47a 100644 --- a/woocommerce-paypal-payments.php +++ b/woocommerce-paypal-payments.php @@ -91,18 +91,9 @@ define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' ); function () { init(); - if ( ! function_exists( 'get_plugin_data' ) ) { - /** - * 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; + $current_plugin_version = (string) PPCP::container()->get( 'ppcp.plugin' )->getVersion(); $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. */ @@ -114,7 +105,7 @@ define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' ); */ 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