$batch = new LinkBatch();
# Give some pointers to make (last) links
foreach ( $this->mResult as $row ) {
- $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_name ) );
- $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_name ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
}
$batch->execute();
$this->mResult->seek( 0 );
* Return the list of user fields that should be selected from user table
*/
public static function selectUserFields() {
- return array( 'COALESCE(user_name,rev_user_text) AS rev_user_name' );
+ return array( 'user_name' );
}
/**
$this->mTextRow = null;
}
- if ( isset( $row->rev_user_name ) ) {
- $this->mUserText = $row->rev_user_name; // current user name
- } else { // fallback to rev_user_text
- $this->mUserText = $row->rev_user_text; // de-normalized
+ // Use user_name for users and rev_user_text for IPs.
+ // Also fallback to rev_user_text if user_name not given.
+ if ( isset( $row->user_name ) ) {
+ $this->mUserText = $row->user_name; // logged-in user (ideally)
+ } else {
+ $this->mUserText = $row->rev_user_text; // IP user (ideally)
}
} elseif( is_array( $row ) ) {
// Build a new revision to be saved...
}
public function getAuthorNameField() {
- return 'rev_user_name'; // see Revision::selectUserFields()
+ return 'user_name'; // see Revision::selectUserFields()
}
public function canView() {
}
public function getAuthorNameField() {
- return 'rev_user_name'; // see Revision::selectUserFields()
+ return 'user_name'; // see Revision::selectUserFields()
}
public function canView() {
$join_cond['user'] = array( 'LEFT JOIN', 'rev_user != 0 AND user_id = rev_user' );
$queryInfo = array(
- 'tables' => $tables,
- 'fields' => array_merge( Revision::selectUserFields(), array(
- 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
- 'page_len', 'rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
- 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted',
- 'rev_len'
- ) ),
- 'conds' => $conds,
- 'options' => array( 'USE INDEX' => array('revision' => $index) ),
+ 'tables' => $tables,
+ 'fields' => array_merge(
+ Revision::selectFields(),
+ Revision::selectUserFields(),
+ array( 'page_namespace', 'page_title', 'page_is_new',
+ 'page_latest', 'page_is_redirect', 'page_len' )
+ ),
+ 'conds' => $conds,
+ 'options' => array( 'USE INDEX' => array( 'revision' => $index ) ),
'join_conds' => $join_cond
);
$batch = new LinkBatch();
# Give some pointers to make (last) links
foreach ( $this->mResult as $row ) {
- $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_name ) );
- $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_name ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
}
$batch->execute();
$this->mResult->seek( 0 );
# Give some pointers to make (last) links
$this->mForm->prevId = array();
foreach ( $this->mResult as $row ) {
- $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_name ) );
- $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_name ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
$rev_id = isset( $rev_id ) ? $rev_id : $row->rev_id;
if( $rev_id > $row->rev_id ) {