User "Catrope" changed the status of MediaWiki.r87381. Old Status: new New Status: fixme
User "Catrope" also posted a comment on MediaWiki.r87381. Full URL: https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/87381#c16569 Commit summary: Now actually determing only the top and bottom 50 rated pages Comment: <pre> + if ( count( $averages ) > 50 ) { + $highest_and_lowest_page_ids = array_merge( $highest_and_lowest_page_ids, array_slice( $averages, -50, 50, true )); + } </pre> Don't use <code>array_merge()</code> , use the plus operator in this case. If there are between 51 and 99 elements in <code>$averages</code>, the left and right side will overlap, and <code>array_merge()</code> will shift the (integral!) keys to avoid key collisions, while the plus operator just lets the left(?) side win. <pre> + if ( !in_array( $page_id, array_keys( $highest_and_lowest_page_ids ))) { </pre> That's a really elaborate way of saying <code>!isset( $highest_and_lowest_page_ids[$page_id] )</code> ;) _______________________________________________ MediaWiki-CodeReview mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
