MediaWiki  1.23.3
RecentChange Class Reference

Utility class for creating new RC entries. More...

Inheritance diagram for RecentChange:
Collaboration diagram for RecentChange:

Public Member Functions

 diffLinkTrail ( $forceCur)
 Gets the end part of the diff URL associated with this object Blank if no diff link should be displayed. More...
 
 doMarkPatrolled (User $user, $auto=false)
 Mark this RecentChange as patrolled. More...
 
 getAttribute ( $name)
 Get an attribute value. More...
 
 getAttributes ()
 
 getCharacterDifference ( $old=0, $new=0)
 Returns the change size (HTML). More...
 
 getPerformer ()
 Get the User object of the person who performed this change. More...
 
getTitle ()
 
 loadFromCurRow ( $row)
 Makes a pseudo-RC entry from a cur row. More...
 
 loadFromRow ( $row)
 Initialises the members of this object from a mysql row object. More...
 
 notifyRC2UDP ()
 
 notifyRCFeeds ()
 Notify all the feeds about the change. More...
 
 reallyMarkPatrolled ()
 Mark this RecentChange patrolled, without error checking. More...
 
 save ( $noudp=false)
 Writes the data in this object to the database. More...
 
 setAttribs ( $attribs)
 
 setExtra ( $extra)
 

Static Public Member Functions

static cleanupForIRC ( $text)
 
static getEngine ( $uri)
 Gets the stream engine object for a given URI from $wgRCEngines. More...
 
static isInRCLifespan ( $timestamp, $tolerance=0)
 Check whether the given timestamp is new enough to have a RC row with a given tolerance as the recentchanges table might not be cleared out regularly (so older entries might exist) or rows which will be deleted soon shouldn't be included. More...
 
static markPatrolled ( $change, $auto=false)
 Mark a given change as patrolled. More...
 
static newFromConds ( $conds, $fname=__METHOD__, $options=array())
 Find the first recent change matching some specific conditions. More...
 
static newFromCurRow ( $row)
 No uses left in Gerrit on 2013-11-19. More...
 
static newFromId ( $rcid)
 Obtain the recent change with a given rc_id value. More...
 
static newFromRow ( $row)
 
static newLogEntry ( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
 
static notifyEdit ( $timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp, $bot, $ip='', $oldSize=0, $newSize=0, $newId=0, $patrol=0)
 Makes an entry in the database corresponding to an edit. More...
 
static notifyLog ( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
 
static notifyNew ( $timestamp, &$title, $minor, &$user, $comment, $bot, $ip='', $size=0, $newId=0, $patrol=0)
 Makes an entry in the database corresponding to page creation Note: the title object must be loaded with the new id using resetArticleID() More...
 
static purgeExpiredChanges ()
 Purge expired changes from the recentchanges table. More...
 
static selectFields ()
 Return the list of recentchanges fields that should be selected to create a new recentchanges object. More...
 
static sendToUDP ( $line, $address='', $prefix='', $port='')
 Send some text to UDP. More...
 

Public Attributes

int $counter = -1
 Line number of recent change. More...
 
 $mAttribs = array()
 
 $mExtra = array()
 
Title $mTitle = false
 
 $notificationtimestamp
 
 $numberofWatchingusers = 0
 
const SRC_EDIT = 'mw.edit'
 
const SRC_EXTERNAL = 'mw.external'
 
const SRC_LOG = 'mw.log'
 
const SRC_NEW = 'mw.new'
 

Static Private Member Functions

static checkIPAddress ( $ip)
 

Private Attributes

User $mPerformer = false
 

Detailed Description

Utility class for creating new RC entries.

mAttribs: rc_id id of the row in the recentchanges table rc_timestamp time the entry was made rc_namespace namespace # rc_title non-prefixed db key rc_type is new entry, used to determine whether updating is necessary rc_source string representation of change source rc_minor is minor rc_cur_id page_id of associated page 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 rev_id associated with this entry (or zero) rc_last_oldid rev_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 rc_old_len integer byte length of the text before the edit rc_new_len the same after the edit rc_deleted partial deletion rc_logid the log_id value for this log entry (or zero) rc_log_type the log type (or null) rc_log_action the log action (or null) rc_params log params

mExtra: prefixedDBkey prefixed db key, used by external app via msg queue lastTimestamp timestamp of previous entry, used in WHERE clause during update 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 numberofWatchingusers

Definition at line 63 of file RecentChange.php.

Member Function Documentation

◆ checkIPAddress()

static RecentChange::checkIPAddress (   $ip)
staticprivate

Definition at line 851 of file RecentChange.php.

References global, and IP\isIPAddress().

Referenced by newLogEntry(), notifyEdit(), and notifyNew().

◆ cleanupForIRC()

static RecentChange::cleanupForIRC (   $text)
static

◆ diffLinkTrail()

RecentChange::diffLinkTrail (   $forceCur)

Gets the end part of the diff URL associated with this object Blank if no diff link should be displayed.

Parameters
$forceCur
Returns
string

Definition at line 791 of file RecentChange.php.

References RC_EDIT.

◆ doMarkPatrolled()

RecentChange::doMarkPatrolled ( User  $user,
  $auto = false 
)

Mark this RecentChange as patrolled.

NOTE: Can also return 'rcpatroldisabled', 'hookaborted' and 'markedaspatrollederror-noautopatrol' as errors

Parameters
$userUser object doing the action
$autoBoolean: for automatic patrol
Returns
array of permissions errors, see Title::getUserPermissionsErrors()

Definition at line 430 of file RecentChange.php.

References $right, $user, array(), getAttribute(), getTitle(), global, User\isAllowed(), RC_NEW, reallyMarkPatrolled(), PatrolLog\record(), and wfRunHooks().

◆ getAttribute()

RecentChange::getAttribute (   $name)

Get an attribute value.

Parameters
string$nameAttribute name
Returns
mixed

Definition at line 774 of file RecentChange.php.

References $name.

Referenced by doMarkPatrolled(), and reallyMarkPatrolled().

◆ getAttributes()

RecentChange::getAttributes ( )
Returns
array

Definition at line 781 of file RecentChange.php.

References $mAttribs.

Referenced by IRCColourfulRCFeedFormatter\getLine(), and MachineReadableRCFeedFormatter\getLine().

◆ getCharacterDifference()

RecentChange::getCharacterDifference (   $old = 0,
  $new = 0 
)

Returns the change size (HTML).

The lengths can be given optionally.

Parameters
$oldint
$newint
Returns
string

Definition at line 814 of file RecentChange.php.

References ChangesList\showCharacterDifference().

◆ getEngine()

static RecentChange::getEngine (   $uri)
static

Gets the stream engine object for a given URI from $wgRCEngines.

Parameters
string$uriURI to get the engine object for
Exceptions
MWException
Returns
RCFeedEngine The engine object

Definition at line 376 of file RecentChange.php.

References global.

Referenced by notifyRCFeeds().

◆ getPerformer()

RecentChange::getPerformer ( )

Get the User object of the person who performed this change.

Returns
User

Definition at line 213 of file RecentChange.php.

References $mPerformer, and User\newFromName().

Referenced by notifyRCFeeds(), and save().

◆ getTitle()

◆ isInRCLifespan()

static RecentChange::isInRCLifespan (   $timestamp,
  $tolerance = 0 
)
static

Check whether the given timestamp is new enough to have a RC row with a given tolerance as the recentchanges table might not be cleared out regularly (so older entries might exist) or rows which will be deleted soon shouldn't be included.

Parameters
$timestampmixed MWTimestamp compatible timestamp
$toleranceinteger Tolerance in seconds
Returns
bool

Definition at line 877 of file RecentChange.php.

References $timestamp, global, TS_UNIX, and wfTimestamp().

Referenced by DifferenceEngine\markPatrolledLink(), and Article\showPatrolFooter().

◆ loadFromCurRow()

RecentChange::loadFromCurRow (   $row)

Makes a pseudo-RC entry from a cur row.

Deprecated:
in 1.22
Parameters
$row

Definition at line 738 of file RecentChange.php.

References array(), RC_EDIT, RC_NEW, TS_MW, wfDeprecated(), and wfTimestamp().

Referenced by newFromCurRow().

◆ loadFromRow()

RecentChange::loadFromRow (   $row)

Initialises the members of this object from a mysql row object.

Parameters
$row

Definition at line 726 of file RecentChange.php.

References TS_MW, and wfTimestamp().

Referenced by newFromRow().

◆ markPatrolled()

static RecentChange::markPatrolled (   $change,
  $auto = false 
)
static

Mark a given change as patrolled.

Parameters
$changeMixed: RecentChange or corresponding rc_id
$autoBoolean: for automatic patrol
Returns
Array See doMarkPatrolled(), or null if $change is not an existing rc_id

Definition at line 407 of file RecentChange.php.

References $wgUser, global, and newFromId().

◆ newFromConds()

static RecentChange::newFromConds (   $conds,
  $fname = __METHOD__,
  $options = array() 
)
static

Find the first recent change matching some specific conditions.

Parameters
array$condsof conditions
$fnameMixed: override the method name in profiling/logs
$optionsArray Query options
Returns
RecentChange

Definition at line 136 of file RecentChange.php.

References $dbr, $fname, $options, DB_SLAVE, newFromRow(), and wfGetDB().

Referenced by Revision\getRecentChange(), DifferenceEngine\markPatrolledLink(), newFromId(), and Article\showPatrolFooter().

◆ newFromCurRow()

static RecentChange::newFromCurRow (   $row)
static

No uses left in Gerrit on 2013-11-19.

Deprecated:
in 1.22
Parameters
$row
Returns
RecentChange

Definition at line 108 of file RecentChange.php.

References loadFromCurRow(), and wfDeprecated().

◆ newFromId()

static RecentChange::newFromId (   $rcid)
static

Obtain the recent change with a given rc_id value.

Parameters
int$rcidrc_id value to retrieve
Returns
RecentChange

Definition at line 124 of file RecentChange.php.

References array(), and newFromConds().

Referenced by markPatrolled(), MarkpatrolledAction\onView(), and PatrolLog\record().

◆ newFromRow()

static RecentChange::newFromRow (   $row)
static

◆ newLogEntry()

static RecentChange::newLogEntry (   $timestamp,
$title,
$user,
  $actionComment,
  $ip,
  $type,
  $action,
  $target,
  $logComment,
  $params,
  $newId = 0,
  $actionCommentIRC = '' 
)
static
Parameters
$timestamp
$titleTitle
$userUser
$actionComment
$ipstring
$type
$action
$targetTitle
$logComment
$params
$newIdint
$actionCommentIRCstring
Returns
RecentChange

Definition at line 656 of file RecentChange.php.

References $params, $timestamp, $title, $type, $user, array(), checkIPAddress(), global, RC_LOG, and SRC_LOG.

Referenced by ManualLogEntry\getRecentChange(), notifyLog(), and LogPage\saveContent().

◆ notifyEdit()

static RecentChange::notifyEdit (   $timestamp,
$title,
  $minor,
$user,
  $comment,
  $oldId,
  $lastTimestamp,
  $bot,
  $ip = '',
  $oldSize = 0,
  $newSize = 0,
  $newId = 0,
  $patrol = 0 
)
static

Makes an entry in the database corresponding to an edit.

Parameters
$timestamp
$titleTitle
$minor
$userUser
$comment
$oldId
$lastTimestamp
$bot
$ipstring
$oldSizeint
$newSizeint
$newIdint
$patrolint
Returns
RecentChange

Definition at line 508 of file RecentChange.php.

References $comment, $timestamp, $title, $user, array(), checkIPAddress(), RC_EDIT, and SRC_EDIT.

Referenced by WikiPage\doEditContent().

◆ notifyLog()

static RecentChange::notifyLog (   $timestamp,
$title,
$user,
  $actionComment,
  $ip,
  $type,
  $action,
  $target,
  $logComment,
  $params,
  $newId = 0,
  $actionCommentIRC = '' 
)
static
Parameters
$timestamp
$title
$user
$actionComment
$ipstring
$type
$action
$target
$logComment
$params
$newIdint
$actionCommentIRCstring
Returns
bool

Definition at line 625 of file RecentChange.php.

References $params, $timestamp, $title, $type, $user, global, and newLogEntry().

Referenced by LogPage\saveContent().

◆ notifyNew()

static RecentChange::notifyNew (   $timestamp,
$title,
  $minor,
$user,
  $comment,
  $bot,
  $ip = '',
  $size = 0,
  $newId = 0,
  $patrol = 0 
)
static

Makes an entry in the database corresponding to page creation Note: the title object must be loaded with the new id using resetArticleID()

Parameters
$timestamp
$titleTitle
$minor
$userUser
$comment
$bot
$ipstring
$sizeint
$newIdint
$patrolint
Returns
RecentChange

Definition at line 567 of file RecentChange.php.

References $comment, $size, $timestamp, $title, $user, array(), checkIPAddress(), RC_NEW, and SRC_NEW.

Referenced by WikiPage\doEditContent().

◆ notifyRC2UDP()

RecentChange::notifyRC2UDP ( )
Deprecated:
since 1.22, use notifyRCFeeds instead.

Definition at line 296 of file RecentChange.php.

References notifyRCFeeds(), and wfDeprecated().

◆ notifyRCFeeds()

RecentChange::notifyRCFeeds ( )

Notify all the feeds about the change.

Definition at line 328 of file RecentChange.php.

References $line, array(), as, getEngine(), getPerformer(), global, and RC_EXTERNAL.

Referenced by notifyRC2UDP(), and save().

◆ purgeExpiredChanges()

static RecentChange::purgeExpiredChanges ( )
static

Purge expired changes from the recentchanges table.

Since
1.22

Definition at line 832 of file RecentChange.php.

References array(), DB_MASTER, global, wfGetDB(), and wfReadOnly().

Referenced by WikiPage\doEditUpdates().

◆ reallyMarkPatrolled()

RecentChange::reallyMarkPatrolled ( )

Mark this RecentChange patrolled, without error checking.

Returns
Integer: number of affected rows

Definition at line 471 of file RecentChange.php.

References array(), DB_MASTER, getAttribute(), getTitle(), and wfGetDB().

Referenced by doMarkPatrolled().

◆ save()

RecentChange::save (   $noudp = false)

Writes the data in this object to the database.

Parameters
$noudpbool

Definition at line 229 of file RecentChange.php.

References $editor, $title, $wgContLang, $wgUseEnotif, array(), DB_MASTER, getPerformer(), getTitle(), global, notifyRCFeeds(), wfGetDB(), and wfRunHooks().

◆ selectFields()

static RecentChange::selectFields ( )
static

Return the list of recentchanges fields that should be selected to create a new recentchanges object.

Returns
array

Definition at line 151 of file RecentChange.php.

References array().

Referenced by SpecialRecentChangesLinked\doMainQuery(), SpecialWatchlist\doMainQuery(), SpecialRecentChanges\doMainQuery(), and ChangesListSpecialPage\doMainQuery().

◆ sendToUDP()

static RecentChange::sendToUDP (   $line,
  $address = '',
  $prefix = '',
  $port = '' 
)
static

Send some text to UDP.

Deprecated:
since 1.22

Definition at line 305 of file RecentChange.php.

References $line, array(), global, and wfDeprecated().

◆ setAttribs()

RecentChange::setAttribs (   $attribs)
Parameters
$attribsarray

Definition at line 185 of file RecentChange.php.

References $attribs.

◆ setExtra()

RecentChange::setExtra (   $extra)
Parameters
$extraarray

Definition at line 192 of file RecentChange.php.

Member Data Documentation

◆ $counter

int RecentChange::$counter = -1

Line number of recent change.

Default -1.

Definition at line 87 of file RecentChange.php.

◆ $mAttribs

RecentChange::$mAttribs = array()

Definition at line 71 of file RecentChange.php.

Referenced by getAttributes().

◆ $mExtra

RecentChange::$mExtra = array()

Definition at line 72 of file RecentChange.php.

◆ $mPerformer

User RecentChange::$mPerformer = false
private

Definition at line 80 of file RecentChange.php.

Referenced by getPerformer().

◆ $mTitle

Title RecentChange::$mTitle = false

Definition at line 76 of file RecentChange.php.

Referenced by getTitle().

◆ $notificationtimestamp

RecentChange::$notificationtimestamp

Definition at line 83 of file RecentChange.php.

◆ $numberofWatchingusers

RecentChange::$numberofWatchingusers = 0

Definition at line 82 of file RecentChange.php.

◆ SRC_EDIT

◆ SRC_EXTERNAL

const RecentChange::SRC_EXTERNAL = 'mw.external'

Definition at line 69 of file RecentChange.php.

Referenced by PopulateRecentChangesSource\buildUpdateCondition().

◆ SRC_LOG

const RecentChange::SRC_LOG = 'mw.log'

◆ SRC_NEW


The documentation for this class was generated from the following file: