<?php
-# Utility class for creating new RC entries
-
-define( "RC_EDIT", 0);
-define( "RC_NEW", 1);
-define( "RC_MOVE", 2);
-define( "RC_LOG", 3);
-define( "RC_MOVE_OVER_REDIRECT", 4);
-
-
-/*
-mAttributes:
- rc_id id of the row in the recentchanges table
- rc_timestamp time the entry was made
- rc_cur_time timestamp on the cur row
- rc_namespace namespace #
- rc_title non-prefixed db key
- rc_type is new entry, used to determine whether updating is necessary
- rc_minor is minor
- rc_cur_id id of associated cur entry
- rc_user user id who made the entry
- rc_user_text user name who made the entry
- rc_comment edit summary
- rc_this_oldid old_id associated with this entry (or zero)
- rc_last_oldid old_id associated with the entry before this one (or zero)
- rc_bot is bot, hidden
- rc_ip IP address of the user in dotted quad notation
- rc_new obsolete, use rc_type==RC_NEW
- rc_patrolled boolean whether or not someone has marked this edit as patrolled
-
-mExtra:
- prefixedDBkey prefixed db key, used by external app via msg queue
- lastTimestamp timestamp of previous entry, used in WHERE clause during update
- lang the interwiki prefix, automatically set in save()
-*/
-
+/**
+ *
+ * @package MediaWiki
+ */
+
+/**
+ * Various globals
+ */
+define( 'RC_EDIT', 0);
+define( 'RC_NEW', 1);
+define( 'RC_MOVE', 2);
+define( 'RC_LOG', 3);
+define( 'RC_MOVE_OVER_REDIRECT', 4);
+
+
+/**
+ * Utility class for creating new RC entries
+ * mAttributes:
+ * rc_id id of the row in the recentchanges table
+ * rc_timestamp time the entry was made
+ * rc_cur_time timestamp on the cur row
+ * rc_namespace namespace #
+ * rc_title non-prefixed db key
+ * rc_type is new entry, used to determine whether updating is necessary
+ * rc_minor is minor
+ * rc_cur_id id of associated cur entry
+ * rc_user user id who made the entry
+ * rc_user_text user name who made the entry
+ * rc_comment edit summary
+ * rc_this_oldid old_id associated with this entry (or zero)
+ * rc_last_oldid old_id associated with the entry before this one (or zero)
+ * rc_bot is bot, hidden
+ * rc_ip IP address of the user in dotted quad notation
+ * rc_new obsolete, use rc_type==RC_NEW
+ * rc_patrolled boolean whether or not someone has marked this edit as patrolled
+ *
+ * mExtra:
+ * prefixedDBkey prefixed db key, used by external app via msg queue
+ * lastTimestamp timestamp of previous entry, used in WHERE clause during update
+ * lang the interwiki prefix, automatically set in save()
+ *
+ * @todo document functions and variables
+ * @package MediaWiki
+ */
class RecentChange
{
var $mAttribs = array(), $mExtra = array();
function save()
{
global $wgUseRCQueue, $wgRCQueueID, $wgLocalInterwiki, $wgPutIPinRC;
- $fname = "RecentChange::save";
+ $fname = 'RecentChange::save';
$dbw =& wfGetDB( DB_MASTER );
if ( !is_array($this->mExtra) ) {
$this->mAttribs['rc_ip'] = '';
}
+ # Fixup database timestamps
+ $this->mAttribs['rc_timestamp']=$dbw->timestamp($this->mAttribs['rc_timestamp']);
+ $this->mAttribs['rc_cur_time']=$dbw->timestamp($this->mAttribs['rc_cur_time']);
+
# Insert new row
- $dbw->insertArray( "recentchanges", $this->mAttribs, $fname );
+ $dbw->insertArray( 'recentchanges', $this->mAttribs, $fname );
# Update old rows, if necessary
if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
), array( /* WHERE */
'rc_namespace' => $ns,
'rc_title' => $title,
- 'rc_timestamp' => $lastTime
+ 'rc_timestamp' => $dbw->timestamp($lastTime)
), $fname
);
# Marks a certain row as patrolled
function markPatrolled( $rcid )
{
- $fname = "RecentChange::markPatrolled";
+ $fname = 'RecentChange::markPatrolled';
$dbw =& wfGetDB( DB_MASTER );
/*static*/ function notifyEdit( $timestamp, &$title, $minor, &$user, $comment,
$oldId, $lastTimestamp, $bot = "default", $ip = '' )
{
- if ( $bot == "default " ) {
+ if ( $bot == 'default ' ) {
$bot = $user->isBot();
}
'rc_moved_to_ns' => 0,
'rc_moved_to_title' => '',
'rc_ip' => $ip,
+ 'rc_patrolled' => 0,
'rc_new' => 0 # obsolete
);
global $wgIP;
$ip = empty( $wgIP ) ? '' : $wgIP;
}
- if ( $bot == "default" ) {
+ if ( $bot == 'default' ) {
$bot = $user->isBot();
}
'rc_moved_to_ns' => 0,
'rc_moved_to_title' => '',
'rc_ip' => $ip,
+ 'rc_patrolled' => 0,
'rc_new' => 1 # obsolete
);
function loadFromCurRow( $row )
{
$this->mAttribs = array(
- "rc_timestamp" => $row->cur_timestamp,
- "rc_cur_time" => $row->cur_timestamp,
- "rc_user" => $row->cur_user,
- "rc_user_text" => $row->cur_user_text,
- "rc_namespace" => $row->cur_namespace,
- "rc_title" => $row->cur_title,
- "rc_comment" => $row->cur_comment,
- "rc_minor" => !!$row->cur_minor_edit,
- "rc_type" => $row->cur_is_new ? RC_NEW : RC_EDIT,
- "rc_cur_id" => $row->cur_id,
+ 'rc_timestamp' => $row->cur_timestamp,
+ 'rc_cur_time' => $row->cur_timestamp,
+ 'rc_user' => $row->cur_user,
+ 'rc_user_text' => $row->cur_user_text,
+ 'rc_namespace' => $row->cur_namespace,
+ 'rc_title' => $row->cur_title,
+ 'rc_comment' => $row->cur_comment,
+ 'rc_minor' => !!$row->cur_minor_edit,
+ 'rc_type' => $row->cur_is_new ? RC_NEW : RC_EDIT,
+ 'rc_cur_id' => $row->cur_id,
'rc_this_oldid' => 0,
'rc_last_oldid' => 0,
'rc_bot' => 0,
}
- # Gets the end part of the diff URL assoicated with this object
- # Blank if no diff link should be displayed
+ /**
+ * Gets the end part of the diff URL assoicated with this object
+ * Blank if no diff link should be displayed
+ */
function diffLinkTrail( $forceCur )
{
if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
$trail = "curid=" . (int)($this->mAttribs['rc_cur_id']) .
"&oldid=" . (int)($this->mAttribs['rc_last_oldid']);
if ( $forceCur ) {
- $trail .= "&diff=0" ;
+ $trail .= '&diff=0' ;
} else {
- $trail .= "&diff=" . (int)($this->mAttribs['rc_this_oldid']);
+ $trail .= '&diff=' . (int)($this->mAttribs['rc_this_oldid']);
}
} else {
- $trail = "";
+ $trail = '';
}
return $trail;
}