Index: trunk/extensions/Contributors/Contributors.page.php |
— | — | @@ -147,7 +147,13 @@ |
148 | 148 | $dbr =& wfGetDB( DB_SLAVE ); |
149 | 149 | $rev = $dbr->tableName( 'revision' ); |
150 | 150 | $aid = $this->target->getArticleId(); |
151 | | - $res = $dbr->query( "SELECT COUNT(*) AS count, rev_user, rev_user_text FROM {$rev} WHERE rev_page = {$aid} GROUP BY rev_user_text ORDER BY count DESC", __METHOD__ ); |
| 151 | + $sql = "SELECT COUNT(*) AS count, rev_user, rev_user_text FROM {$rev} WHERE rev_page = {$aid}"; |
| 152 | + $groupby = "GROUP BY rev_user_text"; |
| 153 | + if( !$dbr->implicitGroupby() ) |
| 154 | + $groupby .= ",rev_user"; |
| 155 | + $orderby = "ORDER BY count DESC"; |
| 156 | + $sql .= " $groupby $orderby"; |
| 157 | + $res = $dbr->query( $sql, __METHOD__ ); |
152 | 158 | if( $res && $dbr->numRows( $res ) > 0 ) { |
153 | 159 | while( $row = $dbr->fetchObject( $res ) ) |
154 | 160 | $contributors[ $row->rev_user_text ] = array( $row->rev_user, $row->count ); |