Make WooCommerce core play nice with Codeception (#11845)
If is_blog_installed() is false then skip some installation steps that are performed on the 'init' action and which require the database to be available
This commit is contained in:
parent
49a574e704
commit
a3e371e0d7
|
@ -167,6 +167,11 @@ class WC_Cache_Helper {
|
|||
* Prevent caching on dynamic pages.
|
||||
*/
|
||||
public static function prevent_caching() {
|
||||
|
||||
if ( ! is_blog_installed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( false === ( $wc_page_uris = get_transient( 'woocommerce_cache_excluded_uris' ) ) ) {
|
||||
$wc_page_uris = array_filter( array_merge( self::get_page_uris( 'cart' ), self::get_page_uris( 'checkout' ), self::get_page_uris( 'myaccount' ) ) );
|
||||
set_transient( 'woocommerce_cache_excluded_uris', $wc_page_uris );
|
||||
|
|
|
@ -137,6 +137,10 @@ class WC_Install {
|
|||
public static function install() {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! is_blog_installed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! defined( 'WC_INSTALLING' ) ) {
|
||||
define( 'WC_INSTALLING', true );
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ class WC_Post_types {
|
|||
* Register core taxonomies.
|
||||
*/
|
||||
public static function register_taxonomies() {
|
||||
|
||||
if ( ! is_blog_installed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( taxonomy_exists( 'product_type' ) ) {
|
||||
return;
|
||||
}
|
||||
|
@ -226,6 +231,11 @@ class WC_Post_types {
|
|||
* Register core post types.
|
||||
*/
|
||||
public static function register_post_types() {
|
||||
|
||||
if ( ! is_blog_installed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( post_type_exists( 'product' ) ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -476,6 +476,11 @@ final class WooCommerce {
|
|||
* @since 2.2
|
||||
*/
|
||||
private function load_webhooks() {
|
||||
|
||||
if ( ! is_blog_installed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( false === ( $webhooks = get_transient( 'woocommerce_webhook_ids' ) ) ) {
|
||||
$webhooks = get_posts( array(
|
||||
'fields' => 'ids',
|
||||
|
|
Loading…
Reference in New Issue