Skip to content

Commit

Permalink
v1.12.4 fixes collation mismatch error during date comparison for log…
Browse files Browse the repository at this point in the history
…s deletion
  • Loading branch information
Patrick Graham committed May 11, 2020
1 parent 370e9aa commit 7a63478
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ This plugin detects HTML by checking the headers sent by other WordPress plugins
[Can I use the Postmark for WordPress plugin with Divi contact forms?](https://postmarkapp.com/support/article/1128-can-i-use-the-postmark-for-wordpress-plugin-with-divi-contact-forms)

## Changelog
### v1.12.4
* Fixes potential collation mismatch errors from date comparisons during old sending logs deletion.

### v1.12.3
* Uses count() for check of logs query result count.

Expand Down
8 changes: 4 additions & 4 deletions postmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Postmark (Official)
* Plugin URI: https://postmarkapp.com/
* Description: Overrides wp_mail to send emails through Postmark
* Version: 1.12.3
* Version: 1.12.4
* Author: Andrew Yates & Matt Gibbs
*/

Expand Down Expand Up @@ -31,7 +31,7 @@ class Postmark_Mail {
*/
public function __construct() {
if ( ! defined( 'POSTMARK_VERSION' ) ) {
define( 'POSTMARK_VERSION', '1.12.3' );
define( 'POSTMARK_VERSION', '1.12.4' );
}

if ( ! defined( 'POSTMARK_DIR' ) ) {
Expand Down Expand Up @@ -374,7 +374,7 @@ function pm_clear_old_logs() {
$wpdb->prepare(
"SELECT COUNT(*)
FROM $table_name
WHERE %s < DATE_SUB(NOW(), INTERVAL %d DAY)
WHERE BINARY(%s) < BINARY(DATE_SUB(NOW(), INTERVAL %d DAY))
LIMIT 500",
'log_entry_date',
7
Expand All @@ -387,7 +387,7 @@ function pm_clear_old_logs() {
$wpdb->query(
$wpdb->prepare(
"DELETE FROM $table_name
WHERE %s < DATE_SUB(NOW(), INTERVAL %d DAY)
WHERE BINARY(%s) < BINARY(DATE_SUB(NOW(), INTERVAL %d DAY))
LIMIT %d",
'log_entry_date',
7,
Expand Down
9 changes: 6 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ And save the changes to the file.
1. Postmark WP Plugin Settings screen.

== Changelog ==
= v 1.12.3 =
= v1.12.4 =
* Fixes potential collation mismatch errors from date comparisons during old sending logs deletion.

= v1.12.3 =
* Uses count() for check of logs query result count.

= v 1.12.2 =
= v1.12.2 =
* Corrects SQL for deletion of log entries older than 7 days.

= v 1.12.1 =
= v1.12.1 =
* Checks if stream_name is set in settings before determining which stream to use.

= v1.12 =
Expand Down

0 comments on commit 7a63478

Please sign in to comment.