Fix campaign ID in subscription confirmation event, and prevent caching during statistics generation

master
Sven Slootweg 11 years ago
parent efd22ef894
commit 68ac9f42f3

@ -168,14 +168,14 @@ class Campaign extends CPHPDatabaseRecordClass
/* Update past-month subscription count */ /* Update past-month subscription count */
if($result = $database->CachedQuery("SELECT COUNT(*) FROM log_entries WHERE `CampaignId` = :CampaignId AND `Type` = :Type AND `Date` > DATE_SUB(NOW(), INTERVAL 1 MONTH)", if($result = $database->CachedQuery("SELECT COUNT(*) FROM log_entries WHERE `CampaignId` = :CampaignId AND `Type` = :Type AND `Date` > DATE_SUB(NOW(), INTERVAL 1 MONTH)",
array(":CampaignId" => $this->sId, ":Type" => LogEntry::SUBSCRIPTION_CONFIRMED))) array(":CampaignId" => $this->sId, ":Type" => LogEntry::SUBSCRIPTION_CONFIRMED), 0))
{ {
$this->uPastMonthSubscriptions = $result->data[0]["COUNT(*)"]; $this->uPastMonthSubscriptions = $result->data[0]["COUNT(*)"];
} }
/* Update past-month unsubscription count */ /* Update past-month unsubscription count */
if($result = $database->CachedQuery("SELECT COUNT(*) FROM log_entries WHERE `CampaignId` = :CampaignId AND `Type` = :Type AND `Date` > DATE_SUB(NOW(), INTERVAL 1 MONTH)", if($result = $database->CachedQuery("SELECT COUNT(*) FROM log_entries WHERE `CampaignId` = :CampaignId AND `Type` = :Type AND `Date` > DATE_SUB(NOW(), INTERVAL 1 MONTH)",
array(":CampaignId" => $this->sId, ":Type" => LogEntry::UNSUBSCRIPTION))) array(":CampaignId" => $this->sId, ":Type" => LogEntry::UNSUBSCRIPTION), 0))
{ {
$this->uPastMonthUnsubscriptions = $result->data[0]["COUNT(*)"]; $this->uPastMonthUnsubscriptions = $result->data[0]["COUNT(*)"];
} }

@ -24,7 +24,7 @@ try
$sLogEntry->uType = LogEntry::SUBSCRIPTION_CONFIRMED; $sLogEntry->uType = LogEntry::SUBSCRIPTION_CONFIRMED;
$sLogEntry->uIp = $_SERVER['REMOTE_ADDR']; $sLogEntry->uIp = $_SERVER['REMOTE_ADDR'];
$sLogEntry->uData = json_encode(array("email" => $router->uParameters[1])); $sLogEntry->uData = json_encode(array("email" => $router->uParameters[1]));
$sLogEntry->uCampaignId = $sCampaign->sId; $sLogEntry->uCampaignId = $sSubscription->sCampaignId;
$sLogEntry->uDate = time(); $sLogEntry->uDate = time();
$sLogEntry->uSessionId = session_id(); $sLogEntry->uSessionId = session_id();
$sLogEntry->InsertIntoDatabase(); $sLogEntry->InsertIntoDatabase();

Loading…
Cancel
Save