From 776484759d41373d2fd0cfd6d4d7a6a6dc9a7db9 Mon Sep 17 00:00:00 2001 From: hawk__ Date: Wed, 20 Jan 2010 22:58:55 +0000 Subject: [PATCH] Add support for DATE_SUB for Akismet 2.2.7 git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@195975 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- pg4wp/driver_pgsql.php | 2 ++ readme.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 9189a6a..d427940 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -257,6 +257,8 @@ // The following handles a new "INTERVAL" call in Akismet 2.2.7 $sql = str_replace('INTERVAL 15 DAY', "'15 days'::interval", $sql); + $pattern = '/DATE_SUB[ ]*\(([^,]+),([^\)]+)\)/'; + $sql = preg_replace( $pattern, '($1::timestamp - $2)', $sql); // Field names with CAPITALS need special handling if( false !== strpos($sql, 'ID')) diff --git a/readme.txt b/readme.txt index 7775b70..50a15a7 100644 --- a/readme.txt +++ b/readme.txt @@ -53,6 +53,7 @@ There is no screenshot for this plugin * Moved parts required only when installing/upgrading from driver_pgsql.php to a separate file The file is loaded only when needed so that memory footprint should be a bit smaller * Added UNIX_TIMESTAMP support +* Added DATE_SUB support for Akismet 2.2.7 * Added DAYOFMONTH support (Thanks to Pete Deffendol for noticing the problem) * Upgrading from WP 2.8.6 to WP 2.9.1 works with a minor error Upgrading should remove an index on table "wp_options" that may not exist, throwing an error