146 } |
146 } |
147 if ( !empty($where_bits['action']) ) |
147 if ( !empty($where_bits['action']) ) |
148 { |
148 { |
149 $where_extra .= "\n AND ( (" . implode(") OR (", $where_bits['action']) . ") )"; |
149 $where_extra .= "\n AND ( (" . implode(") OR (", $where_bits['action']) . ") )"; |
150 } |
150 } |
151 $limit = ( $page_size > 0 ) ? "\n LIMIT $offset, $page_size" : ''; |
151 if ( ENANO_DBLAYER == 'PGSQL' ) |
|
152 $limit = ( $page_size > 0 ) ? "\n LIMIT $page_size OFFSET $offset" : ''; |
|
153 else |
|
154 $limit = ( $page_size > 0 ) ? "\n LIMIT $offset, $page_size" : ''; |
152 $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'; |
155 $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'; |
153 $sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs\n" |
156 $sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs AS l\n" |
154 . " WHERE log_type = 'page' AND is_draft != 1$where_extra\n" |
157 . " WHERE log_type = 'page' AND is_draft != 1$where_extra\n" |
|
158 . " GROUP BY log_id, action, page_id, namespace, page_text, author, time_id, edit_summary, minor_edit" |
155 . " ORDER BY log_id DESC $limit;"; |
159 . " ORDER BY log_id DESC $limit;"; |
156 |
160 |
157 return $sql; |
161 return $sql; |
158 } |
162 } |
159 |
163 |