Move WooCommerce detection to a helper [MAILPOET-1723]

This commit is contained in:
wxa
2019-01-30 14:33:28 +03:00
committed by M. Shull
parent 36ccb65753
commit 35ac4a40da
4 changed files with 22 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ use MailPoet\Models\Subscriber;
use MailPoet\Settings\Pages;
use MailPoet\Settings\SettingsController;
use MailPoet\Subscribers\NewSubscriberNotificationMailer;
use MailPoet\WooCommerce\Helper as WooCommerceHelper;
class Reporter {
/** @var SettingsController */
@@ -26,7 +27,8 @@ class Reporter {
$checker = new ServicesChecker();
$bounceAddress = $this->settings->get('bounce.address');
$segments = Segment::getAnalytics();
$has_wc = class_exists('WooCommerce');
$woocommerce_helper = new WooCommerceHelper;
$has_wc = $woocommerce_helper->isWooCommerceActive();
$wc_customers_count = 0;
if($has_wc) {
$wc_customers_count = (int)Newsletter::rawQuery(