* lang the interwiki prefix, automatically set in save()
* oldSize text size before the change
* newSize text size after the change
+ * pageStatus status of the page: created, deleted, moved, restored, changed
*
* temporary: not stored in the database
* notificationtimestamp
*/
public static function newFromConds( $conds, $fname = __METHOD__ ) {
$dbr = wfGetDB( DB_SLAVE );
- $row = $dbr->selectRow( 'recentchanges', '*', $conds, $fname );
+ $row = $dbr->selectRow( 'recentchanges', self::selectFields(), $conds, $fname );
if ( $row !== false ) {
return self::newFromRow( $row );
} else {
}
}
+ /**
+ * Return the list of recentchanges fields that should be selected to create
+ * a new recentchanges object.
+ * @return array
+ */
+ public static function selectFields() {
+ return array(
+ 'rc_id',
+ 'rc_timestamp',
+ 'rc_cur_time',
+ 'rc_user',
+ 'rc_user_text',
+ 'rc_namespace',
+ 'rc_title',
+ 'rc_comment',
+ 'rc_minor',
+ 'rc_bot',
+ 'rc_new',
+ 'rc_cur_id',
+ 'rc_this_oldid',
+ 'rc_last_oldid',
+ 'rc_type',
+ 'rc_patrolled',
+ 'rc_ip',
+ 'rc_old_len',
+ 'rc_new_len',
+ 'rc_deleted',
+ 'rc_logid',
+ 'rc_log_type',
+ 'rc_log_action',
+ 'rc_params',
+ );
+ }
+
# Accessors
/**
$this->mAttribs['rc_timestamp'],
$this->mAttribs['rc_comment'],
$this->mAttribs['rc_minor'],
- $this->mAttribs['rc_last_oldid'] );
+ $this->mAttribs['rc_last_oldid'],
+ $this->mExtra['pageStatus'] );
}
}
}
'lastTimestamp' => $lastTimestamp,
'oldSize' => $oldSize,
'newSize' => $newSize,
+ 'pageStatus' => 'changed'
);
$rc->save();
return $rc;
'prefixedDBkey' => $title->getPrefixedDBkey(),
'lastTimestamp' => 0,
'oldSize' => 0,
- 'newSize' => $size
+ 'newSize' => $size,
+ 'pageStatus' => 'created'
);
$rc->save();
return $rc;
$type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '' ) {
global $wgRequest;
+ ## Get pageStatus for email notification
+ switch ( $type . '-' . $action ) {
+ case 'delete-delete':
+ $pageStatus = 'deleted';
+ break;
+ case 'move-move':
+ case 'move-move_redir':
+ $pageStatus = 'moved';
+ break;
+ case 'delete-restore':
+ $pageStatus = 'restored';
+ break;
+ case 'upload-upload':
+ $pageStatus = 'created';
+ break;
+ case 'upload-overwrite':
+ default:
+ $pageStatus = 'changed';
+ break;
+ }
+
$rc = new RecentChange;
$rc->mTitle = $target;
$rc->mPerformer = $user;
'prefixedDBkey' => $title->getPrefixedDBkey(),
'lastTimestamp' => 0,
'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage
+ 'pageStatus' => $pageStatus,
'actionCommentIRC' => $actionCommentIRC
);
return $rc;