Fixed logs not working under postgresql
authorDan
Wed, 15 Apr 2009 20:05:38 -0400
changeset 918 1064e7e57eeb
parent 916 05c341ea7545
child 919 1314deadf903
Fixed logs not working under postgresql
includes/log.php
--- a/includes/log.php	Wed Apr 15 19:53:06 2009 -0400
+++ b/includes/log.php	Wed Apr 15 20:05:38 2009 -0400
@@ -148,10 +148,14 @@
     {
       $where_extra .= "\n    AND ( (" . implode(") OR (", $where_bits['action']) . ") )";
     }
-    $limit = ( $page_size > 0 ) ? "\n  LIMIT $offset, $page_size" : '';
+    if ( ENANO_DBLAYER == 'PGSQL' )
+      $limit = ( $page_size > 0 ) ? "\n  LIMIT $page_size OFFSET $offset" : '';
+    else
+      $limit = ( $page_size > 0 ) ? "\n  LIMIT $offset, $page_size" : '';
     $columns = ( $just_page_count ) ? 'COUNT(*)' : 'log_id, action, page_id, namespace, CHAR_LENGTH(page_text) AS revision_size, author, time_id, edit_summary, minor_edit';
-    $sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs\n"
+    $sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs AS l\n"
          . "  WHERE log_type = 'page' AND is_draft != 1$where_extra\n"
+         . "  GROUP BY log_id, action, page_id, namespace, page_text, author, time_id, edit_summary, minor_edit"
          . "  ORDER BY log_id DESC $limit;";
     
     return $sql;