From 713194efda257fe7d4c6e9de6333006f17a1a855 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Thu, 25 Aug 2005 14:50:23 +0000 Subject: [PATCH] * Fix putting sticky entry on the last page in postgreSQL setups. Thanks to Nate Johnston for working this out! (garvinhicking) --- docs/NEWS | 3 +++ .../serendipity_event_entryproperties.php | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/NEWS b/docs/NEWS index b037be8..26138b7 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 0.9 () ------------------------------------------------------------------------ + * Fix putting sticky entry on the last page in postgreSQL setups. + Thanks to Nate Johnston for working this out! (garvinhicking) + * Make "/archive" view also recognize selected category. Sidebar archive and calendar plugins also pay strict attention to which category is selected. Helps "semi-multiple" blogs based on categories diff --git a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php index 9456eb5..2d35663 100644 --- a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php +++ b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php @@ -536,7 +536,16 @@ class serendipity_event_entryproperties extends serendipity_event $eventData['addkey'] .= $cond; } - $cond = 'orderkey DESC'; + if ($serendipity['dbType'] == 'postgres') { + // PostgreSQL is a bit weird here. Empty columns with NULL or "" content for + // orderkey would get sorted on top when using DESC, and only after those + // the "true" content would be inserted. Thus we order ASC in postgreSQL, + // and silently wonder. Thanks to Nate Johnston for working this out! + $cond = 'orderkey ASC'; + } else { + $cond = 'orderkey DESC'; + } + if (empty($eventData['orderby'])) { $eventData['orderby'] = $cond; } else { -- 2.39.5