Move data for GA to free
[MAILPOET-2397]
This commit is contained in:
committed by
Jack Kitterhing
parent
780f7a30c0
commit
787cd8373a
@@ -176,6 +176,7 @@ class Populator {
|
||||
$this->detectReferral();
|
||||
$this->updateFormsSuccessMessages();
|
||||
$this->initWooCommerceTransactionalEmails();
|
||||
$this->moveGoogleAnalyticsFromPremium();
|
||||
}
|
||||
|
||||
private function createMailPoetPage() {
|
||||
@@ -692,6 +693,37 @@ class Populator {
|
||||
$this->settings->set(Worker::SETTINGS_KEY, $settings);
|
||||
}
|
||||
|
||||
private function moveGoogleAnalyticsFromPremium() {
|
||||
global $wpdb;
|
||||
if (version_compare($this->settings->get('db_version', '3.38.2'), '3.38.1', '>')) {
|
||||
return;
|
||||
}
|
||||
$premium_table_name = $wpdb->prefix . 'mailpoet_premium_newsletter_extra_data';
|
||||
$premium_table_exists = (int)$wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT COUNT(1) FROM information_schema.tables WHERE table_schema=%s AND table_name=%s;",
|
||||
$wpdb->dbname,
|
||||
$premium_table_name
|
||||
)
|
||||
);
|
||||
if ($premium_table_exists) {
|
||||
$query = "
|
||||
UPDATE
|
||||
`%s` as n
|
||||
JOIN %s as ped ON n.id=ped.newsletter_id
|
||||
SET n.ga_campaign = ped.ga_campaign
|
||||
";
|
||||
$wpdb->query(
|
||||
sprintf(
|
||||
$query,
|
||||
Newsletter::$_table,
|
||||
$premium_table_name
|
||||
)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private function detectReferral() {
|
||||
$this->referralDetector->detect();
|
||||
}
|
||||
|
Reference in New Issue
Block a user