4
I finally got around to really looking at this problem. Here is the solution (for others that might care):
Version 2.05
Pages Sort IncorrectlyIssue Description The RSS feeds and the "Posts by Author" pages quit working. Specifically, results were no longer sorting newest to oldest --- but just the opposite. The RSS feed fails because new items never get delivered to the RSS reader. The "Posts by Author" page fails simply because it isn't very usable to have to scroll to the very end to see the most recent posts (which one, presumably, most often wants to see).
Issue SolutionAfter much poking around in the source code we found that the GROUP BY / ORDER BY implementation changed from one version of MySQL to the next. This caused the issue when a recent Xampp upgrade was performed.
The needed fix was to eliminate the GROUP BY clause from the SQL query completely. This fix may have unintended side effects. For now, however, everything seems to be fine.
~line 654 in wp-includes/classes.php:
/* Changes made by Lankford on 2008/9/12 - see http://idportal/wiki/index.php/WordPress_for_Xoops_Customizations */
// Apply post-paging filters on where and join. Only plugins that
// manipulate paging queries should use these hooks.
$where = apply_filters('posts_where_paged', $where);
$groupby = " $wpdb->posts.ID ";
$groupby = apply_filters('posts_groupby', $groupby);
$join = apply_filters('posts_join_paged', $join);
$orderby = "post_" . $q['orderby'];
$orderby = apply_filters('posts_orderby', $orderby);
//$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 10=10" . $where . " GROUP BY " . $groupby . " ORDER BY " . $orderby . " $limits"; // Removed by Lankford on 2009/9/12
$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1" . $where . " ORDER BY " . $orderby . " $limits"; // Updated (see line above) by Lankford on 2009/9/12.
$this->request = apply_filters('posts_request', $request);
$this->posts = $wpdb->get_results($this->request);
~line 506 in wp-includes/template-functions-links.php:
if ( !isset($max_num_pages) ) {
/* Changes made by Lankford on 2008/9/12 - see http://idportal/wiki/index.php/WordPress_for_Xoops_Customizations */
//preg_match('#FROMs(.*)sGROUP BY#siU', $request, $matches); // Removed by Lankford on 2009/9/12
preg_match('#FROMs(.*)sORDER BY#siU', $request, $matches); // Altered by Lankford on 2009/9/12.
$fromwhere = $matches[1];
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
$max_num_pages = ceil($numposts / $posts_per_page);
}