https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113247
Revision: 113247
Author: emsmith
Date: 2012-03-07 16:52:54 +0000 (Wed, 07 Mar 2012)
Log Message:
-----------
bug 34090 - db issue, remove one of the sorts from the query, use the ids array
to manage the order (since they're already sorted properly) - NO idea what kind
of side effects this might cause but I haven't run into issues with it yet
Modified Paths:
--------------
trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
Modified:
trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
===================================================================
--- trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
2012-03-07 16:47:46 UTC (rev 113246)
+++ trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
2012-03-07 16:52:54 UTC (rev 113247)
@@ -83,7 +83,6 @@
$dbr = wfGetDB( DB_SLAVE );
$ids = array();
$rows = array();
- $rv = array();
$direction = strtolower( $sortOrder ) == 'asc' ? 'ASC'
: 'DESC';
$continueDirection = ( $direction == 'ASC' ? '>' : '<' );
@@ -179,7 +178,7 @@
);
foreach ( $id_query as $id ) {
- $ids[] = $id->af_id;
+ $ids[$id->af_id] = $id->af_id;
// Get the continue values from the last counted item.
if( count( $ids ) == $limit ) {
$this->continue = $id->$sortField;
@@ -247,16 +246,21 @@
)
);
+ // our $ids array is the correct order for every id that we're
doing
+ // so we want to graft the extra data here into the id value
+
foreach ( $rows as $row ) {
- if ( !array_key_exists( $row->af_id, $rv ) ) {
- $rv[$row->af_id] = array();
- $rv[$row->af_id][0] = $row;
- $rv[$row->af_id][0]->user_name =
$row->user_name ? $row->user_name : $row->af_user_ip;
+ if ( !array_key_exists( $row->af_id, $ids ) ) {
+ continue; // something has gone dreadfully
wrong actually
+ } elseif ( !is_array( $ids[$row->af_id] )) {
+ $ids[$row->af_id] = array();
+ $ids[$row->af_id][0] = $row;
+ $ids[$row->af_id][0]->user_name =
$row->user_name ? $row->user_name : $row->af_user_ip;
}
- $rv[$row->af_id][$row->afi_name] = $row;
+ $ids[$row->af_id][$row->afi_name] = $row;
}
- return $rv;
+ return $ids;
}
private function getFilterCriteria( $filter, $filterValue = null ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs