*/
var $mTitle = false;
+ /**
+ * @var User
+ */
+ private $mPerformer = false;
+
/**
* @var Title
*/
}
/**
- * @return bool|Title
+ * Get the User object of the person who performed this change.
+ *
+ * @return User
*/
- public function getMovedToTitle() {
- if( $this->mMovedToTitle === false ) {
- $this->mMovedToTitle = Title::makeTitle( $this->mAttribs['rc_moved_to_ns'],
- $this->mAttribs['rc_moved_to_title'] );
+ public function getPerformer() {
+ if ( $this->mPerformer === false ) {
+ if ( $this->mAttribs['rc_user'] ) {
+ $this->mPerformer = User::newFromID( $this->mAttribs['rc_user'] );
+ } else {
+ $this->mPerformer = User::newFromName( $this->mAttribs['rc_user_text'], false );
+ }
}
- return $this->mMovedToTitle;
+ return $this->mPerformer;
}
/**
* @param $noudp bool
*/
public function save( $noudp = false ) {
- global $wgLocalInterwiki, $wgPutIPinRC, $wgContLang;
+ global $wgLocalInterwiki, $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
$dbw = wfGetDB( DB_MASTER );
if( !is_array($this->mExtra) ) {
}
# E-mail notifications
- global $wgUseEnotif, $wgShowUpdatedMarker, $wgUser;
if( $wgUseEnotif || $wgShowUpdatedMarker ) {
- // Users
- if( $this->mAttribs['rc_user'] ) {
- $editor = ($wgUser->getId() == $this->mAttribs['rc_user']) ?
- $wgUser : User::newFromID( $this->mAttribs['rc_user'] );
- // Anons
- } else {
- $editor = ($wgUser->getName() == $this->mAttribs['rc_user_text']) ?
- $wgUser : User::newFromName( $this->mAttribs['rc_user_text'], false );
- }
- $title = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
+ $editor = $this->getPerformer();
+ $title = $this->getTitle();
if ( wfRunHooks( 'AbortEmailNotification', array($editor, $title) ) ) {
# @todo FIXME: This would be better as an extension hook
$enotif = new EmailNotification();
- $status = $enotif->notifyOnPageChange( $editor, $title,
+ $enotif->notifyOnPageChange( $editor, $title,
$this->mAttribs['rc_timestamp'],
$this->mAttribs['rc_comment'],
$this->mAttribs['rc_minor'],
public static function notifyEdit( $timestamp, &$title, $minor, &$user, $comment, $oldId,
$lastTimestamp, $bot, $ip='', $oldSize=0, $newSize=0, $newId=0, $patrol=0 ) {
$rc = new RecentChange;
+ $rc->mTitle = $title;
+ $rc->mPerformer = $user;
$rc->mAttribs = array(
'rc_timestamp' => $timestamp,
'rc_cur_time' => $timestamp,
'rc_this_oldid' => $newId,
'rc_last_oldid' => $oldId,
'rc_bot' => $bot ? 1 : 0,
- 'rc_moved_to_ns' => 0,
- 'rc_moved_to_title' => '',
'rc_ip' => self::checkIPAddress( $ip ),
'rc_patrolled' => intval($patrol),
'rc_new' => 0, # obsolete
public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot,
$ip='', $size=0, $newId=0, $patrol=0 ) {
$rc = new RecentChange;
+ $rc->mTitle = $title;
+ $rc->mPerformer = $user;
$rc->mAttribs = array(
'rc_timestamp' => $timestamp,
'rc_cur_time' => $timestamp,
'rc_this_oldid' => $newId,
'rc_last_oldid' => 0,
'rc_bot' => $bot ? 1 : 0,
- 'rc_moved_to_ns' => 0,
- 'rc_moved_to_title' => '',
'rc_ip' => self::checkIPAddress( $ip ),
'rc_patrolled' => intval($patrol),
'rc_new' => 1, # obsolete
global $wgRequest;
$rc = new RecentChange;
+ $rc->mTitle = $target;
+ $rc->mPerformer = $user;
$rc->mAttribs = array(
'rc_timestamp' => $timestamp,
'rc_cur_time' => $timestamp,
'rc_this_oldid' => 0,
'rc_last_oldid' => 0,
'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot', true ) : 0,
- 'rc_moved_to_ns' => 0,
- 'rc_moved_to_title' => '',
'rc_ip' => self::checkIPAddress( $ip ),
'rc_patrolled' => 1,
'rc_new' => 0, # obsolete
'rc_this_oldid' => $row->rev_id,
'rc_last_oldid' => isset($row->rc_last_oldid) ? $row->rc_last_oldid : 0,
'rc_bot' => 0,
- 'rc_moved_to_ns' => 0,
- 'rc_moved_to_title' => '',
'rc_ip' => '',
'rc_id' => $row->rc_id,
'rc_patrolled' => $row->rc_patrolled,
} else {
$comment = self::cleanupForIRC( $this->mAttribs['rc_comment'] );
$flag = '';
- if ( !$this->mAttribs['rc_patrolled'] && ( $wgUseRCPatrol || $this->mAttribs['rc_new'] && $wgUseNPPatrol ) ) {
+ if ( !$this->mAttribs['rc_patrolled'] && ( $wgUseRCPatrol || $this->mAttribs['rc_type'] == RC_NEW && $wgUseNPPatrol ) ) {
$flag .= '!';
}
- $flag .= ( $this->mAttribs['rc_new'] ? "N" : "" ) . ( $this->mAttribs['rc_minor'] ? "M" : "" ) . ( $this->mAttribs['rc_bot'] ? "B" : "" );
+ $flag .= ( $this->mAttribs['rc_type'] == RC_NEW ? "N" : "" ) . ( $this->mAttribs['rc_minor'] ? "M" : "" ) . ( $this->mAttribs['rc_bot'] ? "B" : "" );
}
if ( $wgRC2UDPInterwikiPrefix === true && $wgLocalInterwiki !== false ) {