Merge pull request #512 from woocommerce/fix-get-plugin-data

Require plugin.php if no get_plugin_data
This commit is contained in:
Emili Castells 2022-02-23 16:38:14 +01:00 committed by GitHub
commit 6b86e45287
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -63,6 +63,9 @@ trait PaymentsStatusHandlingTrait {
switch ( $status->name() ) {
case CaptureStatus::COMPLETED:
$wc_order->payment_complete();
/**
* Fired when PayPal order is captured.
*/
do_action( 'woocommerce_paypal_payments_order_captured', $wc_order, $capture );
break;
// It is checked in the capture endpoint already, but there are other ways to capture,

View file

@ -56,6 +56,16 @@ class FilePathPluginFactory implements FilePathPluginFactoryInterface {
);
}
if ( ! function_exists( 'get_plugin_data' ) ) {
/**
* Skip check for WP files and constants.
*
* @psalm-suppress UnresolvableInclude
* @psalm-suppress UndefinedConstant
*/
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugin_data = get_plugin_data( $filePath );
if ( empty( $plugin_data ) ) {
throw new UnexpectedValueException(