+ /**
+ * Do a LinkBatch query to minimise database load when generating all these links
+ * @param $result
+ */
+ function preprocessResults( $result ){
+ wfProfileIn( __METHOD__ );
+ # Do a link batch query
+ $lb = new LinkBatch;
+ $lb->setCaller( __METHOD__ );
+
+ $userids = array();
+
+ foreach ( $result as $row ) {
+ $userids[] = $row->ipb_by;
+
+ # Usernames and titles are in fact related by a simple substitution of space -> underscore
+ # The last few lines of Title::secureAndSplit() tell the story.
+ $name = str_replace( ' ', '_', $row->ipb_address );
+ $lb->add( NS_USER, $name );
+ $lb->add( NS_USER_TALK, $name );
+ }
+
+ $ua = UserArray::newFromIDs( $userids );
+ foreach( $ua as $user ){
+ $name = str_replace( ' ', '_', $user->getName() );
+ $lb->add( NS_USER, $name );
+ $lb->add( NS_USER_TALK, $name );
+ }
+
+ $lb->execute();
+ wfProfileOut( __METHOD__ );
+ }
+}
+
+/**
+ * Items per page dropdown. Essentially a crap workaround for bug 32603.
+ *
+ * @todo Do not release 1.19 with this.
+ */
+class HTMLBlockedUsersItemSelect extends HTMLSelectField {
+ /**
+ * Basically don't do any validation. If it's a number that's fine. Also,
+ * add it to the list if it's not there already
+ *
+ * @param $value
+ * @param $alldata
+ * @return bool
+ */
+ function validate( $value, $alldata ) {
+ if ( $value == '' ) {
+ return true;
+ }
+
+ // Let folks pick an explicit limit not from our list, as long as it's a real numbr.
+ if ( !in_array( $value, $this->mParams['options'] ) && $value == intval( $value ) && $value > 0 ) {
+ // This adds the explicitly requested limit value to the drop-down,
+ // then makes sure it's sorted correctly so when we output the list
+ // later, the custom option doesn't just show up last.
+ $this->mParams['options'][ $this->mParent->getLanguage()->formatNum( $value ) ] = intval($value);
+ asort( $this->mParams['options'] );
+ }
+
+ return true;