Disable image regen if photon is being used.

This commit is contained in:
Mike Jolley 2018-02-14 11:38:18 +00:00
parent 1961076bf7
commit 66e65cf7bf
3 changed files with 11 additions and 2 deletions

View File

@ -182,6 +182,11 @@ class WC_REST_System_Status_Tools_Controller extends WC_REST_Controller {
)
);
// Jetpack does the image resizing heavy lifting so you don't have to.
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) {
unset( $tools['regenerate_thumbnails'] );
}
return apply_filters( 'woocommerce_debug_tools', $tools );
}

View File

@ -325,4 +325,4 @@ class WC_Regenerate_Images {
}
}
add_action( 'init', array( 'WC_Regenerate_Images', 'init' ) );
WC_Regenerate_Images::init();

View File

@ -325,7 +325,6 @@ final class WooCommerce {
include_once WC_ABSPATH . 'includes/class-wc-discounts.php';
include_once WC_ABSPATH . 'includes/class-wc-cart-totals.php';
include_once WC_ABSPATH . 'includes/customizer/class-wc-shop-customizer.php';
include_once WC_ABSPATH . 'includes/class-wc-regenerate-images.php';
/**
* Data stores - used to store and retrieve CRUD object data from the database.
@ -482,6 +481,11 @@ final class WooCommerce {
$this->load_webhooks();
// Unless Jetpack Photon is running, let's include our regenerate thumbnails class.
if ( ! class_exists( 'Jetpack' ) || ! Jetpack::is_module_active( 'photon' ) ) {
include_once WC_ABSPATH . 'includes/class-wc-regenerate-images.php';
}
// Init action.
do_action( 'woocommerce_init' );
}