From 65b683b42bf91bc545b0e998d971d609278e5d6d Mon Sep 17 00:00:00 2001 From: hawk__ Date: Sun, 7 Mar 2010 22:52:38 +0000 Subject: [PATCH] Improved date functions handling git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@214733 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- pg4wp/db.php | 2 +- pg4wp/driver_pgsql.php | 3 +++ readme.txt | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pg4wp/db.php b/pg4wp/db.php index f191d82..471b334 100644 --- a/pg4wp/db.php +++ b/pg4wp/db.php @@ -21,7 +21,7 @@ define( 'PG4WP_ROOT', dirname( __FILE__).'/plugins/pg4wp'); define( 'PG4WP_DEBUG', false); // If you just want to log queries that generate errors, leave PG4WP_DEBUG to "false" // and set this to true -define( 'PG4WP_LOG_ERRORS', false); +define( 'PG4WP_LOG_ERRORS', true); // Logs are put in the pg4wp directory define( 'PG4WP_LOG', PG4WP_ROOT.'/logs/'); diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index e8898e1..0b3d36b 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -141,7 +141,10 @@ ); $sql = str_replace( 'ORDER BY post_date DESC', 'ORDER BY YEAR(post_date) DESC, MONTH(post_date) DESC', $sql); + $sql = str_replace( 'ORDER BY post_date ASC', 'ORDER BY YEAR(post_date) ASC, MONTH(post_date) ASC', $sql); $sql = str_replace( array_keys($date_funcs), array_values($date_funcs), $sql); + $curryear = date( 'Y'); + $sql = str_replace( 'FROM \''.$curryear, 'FROM TIMESTAMP \''.$curryear, $sql); // MySQL 'IF' conversion $pattern = '/IF[ ]*\(([^,]+),([^,]+),([^\)]+)\)/'; diff --git a/readme.txt b/readme.txt index 11f7760..57598d7 100644 --- a/readme.txt +++ b/readme.txt @@ -50,6 +50,7 @@ There is no screenshot for this plugin == Changelog == +* Improved dates functions handling * PG4WP now appears in WordPress control panel and can be enabled/disabled but this has no real effect * Added a correct plugin header into db.php to have correct informations shown in WordPress plugin Directory