Skip to content

Commit

Permalink
Merge pull request #11 from Leuchtfeuer/Prefix
Browse files Browse the repository at this point in the history
Another Prefix Fix
  • Loading branch information
oltmanns-leuchtfeuer authored May 12, 2023
2 parents d093ce8 + a692451 commit 2024f5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Service/EventLogCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class EventLogCleanup
private array $queries = [
self::CAMPAIGN_LEAD_EVENTS => self::PREFIX.'campaign_lead_event_log WHERE ('.self::PREFIX.'campaign_lead_event_log.id NOT IN (SELECT maxId FROM (SELECT MAX(clel2.id) as maxId FROM '.self::PREFIX.'campaign_lead_event_log clel2 GROUP BY lead_id, campaign_id) as maxIds) AND '.self::PREFIX.'campaign_lead_event_log.date_triggered < DATE_SUB(NOW(),INTERVAL :daysOld DAY))',
self::LEAD_EVENTS => self::PREFIX.'lead_event_log WHERE date_added < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
self::EMAIL_STATS => self::PREFIX.'email_stats LEFT JOIN emails ON '.self::PREFIX.'email_stats.email_id = emails.id WHERE is_published = 0 OR '.self::PREFIX.'email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
self::EMAIL_STATS => self::PREFIX.'email_stats LEFT JOIN '.self::PREFIX.'emails ON '.self::PREFIX.'email_stats.email_id = '.self::PREFIX.'emails.id WHERE is_published = 0 OR '.self::PREFIX.'email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
self::EMAIL_STATS_TOKENS => self::PREFIX.'email_stats SET tokens = NULL WHERE date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY) AND tokens IS NOT NULL',
self::EMAIL_STATS_DEVICES => self::PREFIX.'email_stats_devices LEFT JOIN '.self::PREFIX.'email_stats ON '.self::PREFIX.'email_stats.id = '.self::PREFIX.'email_stats_devices.stat_id WHERE '.self::PREFIX.'email_stats.id IS NULL OR '.self::PREFIX.'email_stats.date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
];
Expand Down
12 changes: 6 additions & 6 deletions Tests/Service/EventLogCleanupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function runProvider(): Generator
[':daysOld' => \PDO::PARAM_INT],
],
[
'SELECT * FROM prefix_table_email_stats LEFT JOIN emails ON prefix_table_email_stats.email_id = emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
'SELECT * FROM prefix_table_email_stats LEFT JOIN prefix_table_emails ON prefix_table_email_stats.email_id = prefix_table_emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
[':daysOld' => $daysOld],
[':daysOld' => \PDO::PARAM_INT],
],
Expand Down Expand Up @@ -127,7 +127,7 @@ public function runProvider(): Generator
[':daysOld' => \PDO::PARAM_INT],
],
[
'SELECT * FROM prefix_table_email_stats LEFT JOIN emails ON prefix_table_email_stats.email_id = emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
'SELECT * FROM prefix_table_email_stats LEFT JOIN prefix_table_emails ON prefix_table_email_stats.email_id = prefix_table_emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
[':daysOld' => $daysOld],
[':daysOld' => \PDO::PARAM_INT],
],
Expand Down Expand Up @@ -163,7 +163,7 @@ public function runProvider(): Generator
[':daysOld' => \PDO::PARAM_INT],
],
[
'SELECT * FROM prefix_table_email_stats LEFT JOIN emails ON prefix_table_email_stats.email_id = emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
'SELECT * FROM prefix_table_email_stats LEFT JOIN prefix_table_emails ON prefix_table_email_stats.email_id = prefix_table_emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
[':daysOld' => $daysOld],
[':daysOld' => \PDO::PARAM_INT],
],
Expand Down Expand Up @@ -225,7 +225,7 @@ public function runProvider(): Generator
[':daysOld' => \PDO::PARAM_INT],
],
[
'DELETE prefix_table_email_stats FROM prefix_table_email_stats LEFT JOIN emails ON prefix_table_email_stats.email_id = emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
'DELETE prefix_table_email_stats FROM prefix_table_email_stats LEFT JOIN prefix_table_emails ON prefix_table_email_stats.email_id = prefix_table_emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
[':daysOld' => $daysOld],
[':daysOld' => \PDO::PARAM_INT],
],
Expand Down Expand Up @@ -272,7 +272,7 @@ public function runProvider(): Generator
[':daysOld' => \PDO::PARAM_INT],
],
[
'DELETE prefix_table_email_stats FROM prefix_table_email_stats LEFT JOIN emails ON prefix_table_email_stats.email_id = emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
'DELETE prefix_table_email_stats FROM prefix_table_email_stats LEFT JOIN prefix_table_emails ON prefix_table_email_stats.email_id = prefix_table_emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
[':daysOld' => $daysOld],
[':daysOld' => \PDO::PARAM_INT],
],
Expand Down Expand Up @@ -308,7 +308,7 @@ public function runProvider(): Generator
[':daysOld' => \PDO::PARAM_INT],
],
[
'DELETE prefix_table_email_stats FROM prefix_table_email_stats LEFT JOIN emails ON prefix_table_email_stats.email_id = emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
'DELETE prefix_table_email_stats FROM prefix_table_email_stats LEFT JOIN prefix_table_emails ON prefix_table_email_stats.email_id = prefix_table_emails.id WHERE is_published = 0 OR prefix_table_email_stats.email_id IS NULL AND date_sent < DATE_SUB(NOW(),INTERVAL :daysOld DAY)',
[':daysOld' => $daysOld],
[':daysOld' => \PDO::PARAM_INT],
],
Expand Down

0 comments on commit 2024f5f

Please sign in to comment.