3 * Utility class for creating and accessing recent change entries.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 * Utility class for creating new RC entries
27 * rc_id id of the row in the recentchanges table
28 * rc_timestamp time the entry was made
29 * rc_namespace namespace #
30 * rc_title non-prefixed db key
31 * rc_type is new entry, used to determine whether updating is necessary
32 * rc_source string representation of change source
34 * rc_cur_id page_id of associated page entry
35 * rc_user user id who made the entry
36 * rc_user_text user name who made the entry
37 * rc_comment edit summary
38 * rc_this_oldid rev_id associated with this entry (or zero)
39 * rc_last_oldid rev_id associated with the entry before this one (or zero)
40 * rc_bot is bot, hidden
41 * rc_ip IP address of the user in dotted quad notation
42 * rc_new obsolete, use rc_type==RC_NEW
43 * rc_patrolled boolean whether or not someone has marked this edit as patrolled
44 * rc_old_len integer byte length of the text before the edit
45 * rc_new_len the same after the edit
46 * rc_deleted partial deletion
47 * rc_logid the log_id value for this log entry (or zero)
48 * rc_log_type the log type (or null)
49 * rc_log_action the log action (or null)
50 * rc_params log params
53 * prefixedDBkey prefixed db key, used by external app via msg queue
54 * lastTimestamp timestamp of previous entry, used in WHERE clause during update
55 * oldSize text size before the change
56 * newSize text size after the change
57 * pageStatus status of the page: created, deleted, moved, restored, changed
59 * temporary: not stored in the database
60 * notificationtimestamp
61 * numberofWatchingusers
64 // Constants for the rc_source field. Extensions may also have
65 // their own source constants.
66 const SRC_EDIT
= 'mw.edit';
67 const SRC_NEW
= 'mw.new';
68 const SRC_LOG
= 'mw.log';
69 const SRC_EXTERNAL
= 'mw.external'; // obsolete
70 const SRC_CATEGORIZE
= 'mw.categorize';
72 public $mAttribs = array();
73 public $mExtra = array();
78 public $mTitle = false;
83 private $mPerformer = false;
85 public $numberofWatchingusers = 0; # Dummy to prevent error message in SpecialRecentChangesLinked
86 public $notificationtimestamp;
89 * @var int Line number of recent change. Default -1.
94 * @var array Array of change types
96 private static $changeTypes = array(
100 'external' => RC_EXTERNAL
,
101 'categorize' => RC_CATEGORIZE
,
108 * @return RecentChange
110 public static function newFromRow( $row ) {
111 $rc = new RecentChange
;
112 $rc->loadFromRow( $row );
118 * Parsing text to RC_* constants
120 * @param string|array $type
121 * @throws MWException
122 * @return int|array RC_TYPE
124 public static function parseToRCType( $type ) {
125 if ( is_array( $type ) ) {
127 foreach ( $type as $t ) {
128 $retval[] = RecentChange
::parseToRCType( $t );
134 if ( !array_key_exists( $type, self
::$changeTypes ) ) {
135 throw new MWException( "Unknown type '$type'" );
137 return self
::$changeTypes[$type];
141 * Parsing RC_* constants to human-readable test
144 * @return string $type
146 public static function parseFromRCType( $rcType ) {
147 return array_search( $rcType, self
::$changeTypes, true ) ?
: "$rcType";
151 * Get an array of all change types
157 public static function getChangeTypes() {
158 return array_keys( self
::$changeTypes );
162 * Obtain the recent change with a given rc_id value
164 * @param int $rcid The rc_id value to retrieve
165 * @return RecentChange|null
167 public static function newFromId( $rcid ) {
168 return self
::newFromConds( array( 'rc_id' => $rcid ), __METHOD__
);
172 * Find the first recent change matching some specific conditions
174 * @param array $conds Array of conditions
175 * @param mixed $fname Override the method name in profiling/logs
176 * @param int $dbType DB_* constant
178 * @return RecentChange|null
180 public static function newFromConds(
185 $db = wfGetDB( $dbType );
186 $row = $db->selectRow( 'recentchanges', self
::selectFields(), $conds, $fname );
187 if ( $row !== false ) {
188 return self
::newFromRow( $row );
195 * Return the list of recentchanges fields that should be selected to create
196 * a new recentchanges object.
199 public static function selectFields() {
231 * @param array $attribs
233 public function setAttribs( $attribs ) {
234 $this->mAttribs
= $attribs;
238 * @param array $extra
240 public function setExtra( $extra ) {
241 $this->mExtra
= $extra;
247 public function &getTitle() {
248 if ( $this->mTitle
=== false ) {
249 $this->mTitle
= Title
::makeTitle( $this->mAttribs
['rc_namespace'], $this->mAttribs
['rc_title'] );
252 return $this->mTitle
;
256 * Get the User object of the person who performed this change.
260 public function getPerformer() {
261 if ( $this->mPerformer
=== false ) {
262 if ( $this->mAttribs
['rc_user'] ) {
263 $this->mPerformer
= User
::newFromId( $this->mAttribs
['rc_user'] );
265 $this->mPerformer
= User
::newFromName( $this->mAttribs
['rc_user_text'], false );
269 return $this->mPerformer
;
273 * Writes the data in this object to the database
276 public function save( $noudp = false ) {
277 global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
279 $dbw = wfGetDB( DB_MASTER
);
280 if ( !is_array( $this->mExtra
) ) {
281 $this->mExtra
= array();
284 if ( !$wgPutIPinRC ) {
285 $this->mAttribs
['rc_ip'] = '';
288 # If our database is strict about IP addresses, use NULL instead of an empty string
289 if ( $dbw->strictIPs() && $this->mAttribs
['rc_ip'] == '' ) {
290 unset( $this->mAttribs
['rc_ip'] );
293 # Trim spaces on user supplied text
294 $this->mAttribs
['rc_comment'] = trim( $this->mAttribs
['rc_comment'] );
296 # Make sure summary is truncated (whole multibyte characters)
297 $this->mAttribs
['rc_comment'] = $wgContLang->truncate( $this->mAttribs
['rc_comment'], 255 );
299 # Fixup database timestamps
300 $this->mAttribs
['rc_timestamp'] = $dbw->timestamp( $this->mAttribs
['rc_timestamp'] );
301 $this->mAttribs
['rc_id'] = $dbw->nextSequenceValue( 'recentchanges_rc_id_seq' );
303 # # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
304 if ( $dbw->cascadingDeletes() && $this->mAttribs
['rc_cur_id'] == 0 ) {
305 unset( $this->mAttribs
['rc_cur_id'] );
309 $dbw->insert( 'recentchanges', $this->mAttribs
, __METHOD__
);
312 $this->mAttribs
['rc_id'] = $dbw->insertId();
315 Hooks
::run( 'RecentChange_save', array( &$this ) );
317 # Notify external application via UDP
319 $this->notifyRCFeeds();
322 # E-mail notifications
323 if ( $wgUseEnotif ||
$wgShowUpdatedMarker ) {
324 $editor = $this->getPerformer();
325 $title = $this->getTitle();
327 // Never send an RC notification email about categorization changes
328 if ( $this->mAttribs
['rc_type'] != RC_CATEGORIZE
) {
329 if ( Hooks
::run( 'AbortEmailNotification', array( $editor, $title, $this ) ) ) {
330 # @todo FIXME: This would be better as an extension hook
331 $enotif = new EmailNotification();
332 $enotif->notifyOnPageChange(
335 $this->mAttribs
['rc_timestamp'],
336 $this->mAttribs
['rc_comment'],
337 $this->mAttribs
['rc_minor'],
338 $this->mAttribs
['rc_last_oldid'],
339 $this->mExtra
['pageStatus']
345 // Update the cached list of active users
346 if ( $this->mAttribs
['rc_user'] > 0 ) {
347 JobQueueGroup
::singleton()->lazyPush( RecentChangesUpdateJob
::newCacheUpdateJob() );
352 * Notify all the feeds about the change.
353 * @param array $feeds Optional feeds to send to, defaults to $wgRCFeeds
355 public function notifyRCFeeds( array $feeds = null ) {
357 if ( $feeds === null ) {
361 $performer = $this->getPerformer();
363 foreach ( $feeds as $feed ) {
365 'omit_bots' => false,
366 'omit_anon' => false,
367 'omit_user' => false,
368 'omit_minor' => false,
369 'omit_patrolled' => false,
373 ( $feed['omit_bots'] && $this->mAttribs
['rc_bot'] ) ||
374 ( $feed['omit_anon'] && $performer->isAnon() ) ||
375 ( $feed['omit_user'] && !$performer->isAnon() ) ||
376 ( $feed['omit_minor'] && $this->mAttribs
['rc_minor'] ) ||
377 ( $feed['omit_patrolled'] && $this->mAttribs
['rc_patrolled'] ) ||
378 $this->mAttribs
['rc_type'] == RC_EXTERNAL
383 $engine = self
::getEngine( $feed['uri'] );
385 if ( isset( $this->mExtra
['actionCommentIRC'] ) ) {
386 $actionComment = $this->mExtra
['actionCommentIRC'];
388 $actionComment = null;
391 /** @var $formatter RCFeedFormatter */
392 $formatter = is_object( $feed['formatter'] ) ?
$feed['formatter'] : new $feed['formatter']();
393 $line = $formatter->getLine( $feed, $this, $actionComment );
396 // If a feed formatter returns null, this will otherwise cause an
397 // error in at least RedisPubSubFeedEngine.
398 // Not sure where/how this should best be handled.
402 $engine->send( $feed, $line );
407 * Gets the stream engine object for a given URI from $wgRCEngines
409 * @param string $uri URI to get the engine object for
410 * @throws MWException
411 * @return RCFeedEngine The engine object
413 public static function getEngine( $uri ) {
416 $scheme = parse_url( $uri, PHP_URL_SCHEME
);
418 throw new MWException( __FUNCTION__
. ": Invalid stream logger URI: '$uri'" );
421 if ( !isset( $wgRCEngines[$scheme] ) ) {
422 throw new MWException( __FUNCTION__
. ": Unknown stream logger URI scheme: $scheme" );
425 return new $wgRCEngines[$scheme];
429 * Mark a given change as patrolled
431 * @param RecentChange|int $change RecentChange or corresponding rc_id
432 * @param bool $auto For automatic patrol
433 * @return array See doMarkPatrolled(), or null if $change is not an existing rc_id
435 public static function markPatrolled( $change, $auto = false ) {
438 $change = $change instanceof RecentChange
440 : RecentChange
::newFromId( $change );
442 if ( !$change instanceof RecentChange
) {
446 return $change->doMarkPatrolled( $wgUser, $auto );
450 * Mark this RecentChange as patrolled
452 * NOTE: Can also return 'rcpatroldisabled', 'hookaborted' and
453 * 'markedaspatrollederror-noautopatrol' as errors
454 * @param User $user User object doing the action
455 * @param bool $auto For automatic patrol
456 * @return array Array of permissions errors, see Title::getUserPermissionsErrors()
458 public function doMarkPatrolled( User
$user, $auto = false ) {
459 global $wgUseRCPatrol, $wgUseNPPatrol;
461 // If recentchanges patrol is disabled, only new pages
463 if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol ||
$this->getAttribute( 'rc_type' ) != RC_NEW
) ) {
464 $errors[] = array( 'rcpatroldisabled' );
466 // Automatic patrol needs "autopatrol", ordinary patrol needs "patrol"
467 $right = $auto ?
'autopatrol' : 'patrol';
468 $errors = array_merge( $errors, $this->getTitle()->getUserPermissionsErrors( $right, $user ) );
469 if ( !Hooks
::run( 'MarkPatrolled',
470 array( $this->getAttribute( 'rc_id' ), &$user, false, $auto ) )
472 $errors[] = array( 'hookaborted' );
474 // Users without the 'autopatrol' right can't patrol their
476 if ( $user->getName() === $this->getAttribute( 'rc_user_text' )
477 && !$user->isAllowed( 'autopatrol' )
479 $errors[] = array( 'markedaspatrollederror-noautopatrol' );
484 // If the change was patrolled already, do nothing
485 if ( $this->getAttribute( 'rc_patrolled' ) ) {
488 // Actually set the 'patrolled' flag in RC
489 $this->reallyMarkPatrolled();
490 // Log this patrol event
491 PatrolLog
::record( $this, $auto, $user );
493 'MarkPatrolledComplete',
494 array( $this->getAttribute( 'rc_id' ), &$user, false, $auto )
501 * Mark this RecentChange patrolled, without error checking
502 * @return int Number of affected rows
504 public function reallyMarkPatrolled() {
505 $dbw = wfGetDB( DB_MASTER
);
512 'rc_id' => $this->getAttribute( 'rc_id' )
516 // Invalidate the page cache after the page has been patrolled
517 // to make sure that the Patrol link isn't visible any longer!
518 $this->getTitle()->invalidateCache();
520 return $dbw->affectedRows();
524 * Makes an entry in the database corresponding to an edit
526 * @param string $timestamp
527 * @param Title $title
530 * @param string $comment
532 * @param string $lastTimestamp
535 * @param int $oldSize
536 * @param int $newSize
539 * @return RecentChange
541 public static function notifyEdit(
542 $timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp,
543 $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0
545 $rc = new RecentChange
;
546 $rc->mTitle
= $title;
547 $rc->mPerformer
= $user;
548 $rc->mAttribs
= array(
549 'rc_timestamp' => $timestamp,
550 'rc_namespace' => $title->getNamespace(),
551 'rc_title' => $title->getDBkey(),
552 'rc_type' => RC_EDIT
,
553 'rc_source' => self
::SRC_EDIT
,
554 'rc_minor' => $minor ?
1 : 0,
555 'rc_cur_id' => $title->getArticleID(),
556 'rc_user' => $user->getId(),
557 'rc_user_text' => $user->getName(),
558 'rc_comment' => $comment,
559 'rc_this_oldid' => $newId,
560 'rc_last_oldid' => $oldId,
561 'rc_bot' => $bot ?
1 : 0,
562 'rc_ip' => self
::checkIPAddress( $ip ),
563 'rc_patrolled' => intval( $patrol ),
564 'rc_new' => 0, # obsolete
565 'rc_old_len' => $oldSize,
566 'rc_new_len' => $newSize,
569 'rc_log_type' => null,
570 'rc_log_action' => '',
575 'prefixedDBkey' => $title->getPrefixedDBkey(),
576 'lastTimestamp' => $lastTimestamp,
577 'oldSize' => $oldSize,
578 'newSize' => $newSize,
579 'pageStatus' => 'changed'
582 DeferredUpdates
::addCallableUpdate( function() use ( $rc ) {
584 if ( $rc->mAttribs
['rc_patrolled'] ) {
585 PatrolLog
::record( $rc, true, $rc->getPerformer() );
593 * Makes an entry in the database corresponding to page creation
594 * Note: the title object must be loaded with the new id using resetArticleID()
596 * @param string $timestamp
597 * @param Title $title
600 * @param string $comment
606 * @return RecentChange
608 public static function notifyNew(
609 $timestamp, &$title, $minor, &$user, $comment, $bot,
610 $ip = '', $size = 0, $newId = 0, $patrol = 0
612 $rc = new RecentChange
;
613 $rc->mTitle
= $title;
614 $rc->mPerformer
= $user;
615 $rc->mAttribs
= array(
616 'rc_timestamp' => $timestamp,
617 'rc_namespace' => $title->getNamespace(),
618 'rc_title' => $title->getDBkey(),
620 'rc_source' => self
::SRC_NEW
,
621 'rc_minor' => $minor ?
1 : 0,
622 'rc_cur_id' => $title->getArticleID(),
623 'rc_user' => $user->getId(),
624 'rc_user_text' => $user->getName(),
625 'rc_comment' => $comment,
626 'rc_this_oldid' => $newId,
627 'rc_last_oldid' => 0,
628 'rc_bot' => $bot ?
1 : 0,
629 'rc_ip' => self
::checkIPAddress( $ip ),
630 'rc_patrolled' => intval( $patrol ),
631 'rc_new' => 1, # obsolete
633 'rc_new_len' => $size,
636 'rc_log_type' => null,
637 'rc_log_action' => '',
642 'prefixedDBkey' => $title->getPrefixedDBkey(),
643 'lastTimestamp' => 0,
646 'pageStatus' => 'created'
649 DeferredUpdates
::addCallableUpdate( function() use ( $rc ) {
651 if ( $rc->mAttribs
['rc_patrolled'] ) {
652 PatrolLog
::record( $rc, true, $rc->getPerformer() );
660 * @param string $timestamp
661 * @param Title $title
663 * @param string $actionComment
665 * @param string $type
666 * @param string $action
667 * @param Title $target
668 * @param string $logComment
669 * @param string $params
671 * @param string $actionCommentIRC
674 public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type,
675 $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = ''
677 global $wgLogRestrictions;
679 # Don't add private logs to RC!
680 if ( isset( $wgLogRestrictions[$type] ) && $wgLogRestrictions[$type] != '*' ) {
683 $rc = self
::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action,
684 $target, $logComment, $params, $newId, $actionCommentIRC );
691 * @param string $timestamp
692 * @param Title $title
694 * @param string $actionComment
696 * @param string $type
697 * @param string $action
698 * @param Title $target
699 * @param string $logComment
700 * @param string $params
702 * @param string $actionCommentIRC
703 * @return RecentChange
705 public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip,
706 $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '' ) {
709 # # Get pageStatus for email notification
710 switch ( $type . '-' . $action ) {
711 case 'delete-delete':
712 $pageStatus = 'deleted';
715 case 'move-move_redir':
716 $pageStatus = 'moved';
718 case 'delete-restore':
719 $pageStatus = 'restored';
721 case 'upload-upload':
722 $pageStatus = 'created';
724 case 'upload-overwrite':
726 $pageStatus = 'changed';
730 $rc = new RecentChange
;
731 $rc->mTitle
= $target;
732 $rc->mPerformer
= $user;
733 $rc->mAttribs
= array(
734 'rc_timestamp' => $timestamp,
735 'rc_namespace' => $target->getNamespace(),
736 'rc_title' => $target->getDBkey(),
738 'rc_source' => self
::SRC_LOG
,
740 'rc_cur_id' => $target->getArticleID(),
741 'rc_user' => $user->getId(),
742 'rc_user_text' => $user->getName(),
743 'rc_comment' => $logComment,
744 'rc_this_oldid' => 0,
745 'rc_last_oldid' => 0,
746 'rc_bot' => $user->isAllowed( 'bot' ) ?
$wgRequest->getBool( 'bot', true ) : 0,
747 'rc_ip' => self
::checkIPAddress( $ip ),
749 'rc_new' => 0, # obsolete
750 'rc_old_len' => null,
751 'rc_new_len' => null,
753 'rc_logid' => $newId,
754 'rc_log_type' => $type,
755 'rc_log_action' => $action,
756 'rc_params' => $params
760 'prefixedDBkey' => $title->getPrefixedDBkey(),
761 'lastTimestamp' => 0,
762 'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage
763 'pageStatus' => $pageStatus,
764 'actionCommentIRC' => $actionCommentIRC
771 * Constructs a RecentChange object for the given categorization
772 * This does not call save() on the object and thus does not write to the db
776 * @param string $timestamp Timestamp of the recent change to occur
777 * @param Title $categoryTitle Title of the category a page is being added to or removed from
778 * @param User $user User object of the user that made the change
779 * @param string $comment Change summary
780 * @param Title $pageTitle Title of the page that is being added or removed
781 * @param int $oldRevId Parent revision ID of this change
782 * @param int $newRevId Revision ID of this change
783 * @param string $lastTimestamp Parent revision timestamp of this change
784 * @param bool $bot true, if the change was made by a bot
785 * @param string $ip IP address of the user, if the change was made anonymously
786 * @param int $deleted Indicates whether the change has been deleted
788 * @return RecentChange
790 public static function newForCategorization(
792 Title
$categoryTitle,
803 $rc = new RecentChange
;
804 $rc->mTitle
= $categoryTitle;
805 $rc->mPerformer
= $user;
806 $rc->mAttribs
= array(
807 'rc_timestamp' => $timestamp,
808 'rc_namespace' => $categoryTitle->getNamespace(),
809 'rc_title' => $categoryTitle->getDBkey(),
810 'rc_type' => RC_CATEGORIZE
,
811 'rc_source' => self
::SRC_CATEGORIZE
,
813 'rc_cur_id' => $pageTitle->getArticleID(),
814 'rc_user' => $user ?
$user->getId() : 0,
815 'rc_user_text' => $user ?
$user->getName() : '',
816 'rc_comment' => $comment,
817 'rc_this_oldid' => $newRevId,
818 'rc_last_oldid' => $oldRevId,
819 'rc_bot' => $bot ?
1 : 0,
820 'rc_ip' => self
::checkIPAddress( $ip ),
821 'rc_patrolled' => 1, // Always patrolled, just like log entries
822 'rc_new' => 0, # obsolete
825 'rc_deleted' => $deleted,
827 'rc_log_type' => null,
828 'rc_log_action' => '',
833 'prefixedDBkey' => $categoryTitle->getPrefixedDBkey(),
834 'lastTimestamp' => $lastTimestamp,
837 'pageStatus' => 'changed'
844 * Initialises the members of this object from a mysql row object
848 public function loadFromRow( $row ) {
849 $this->mAttribs
= get_object_vars( $row );
850 $this->mAttribs
['rc_timestamp'] = wfTimestamp( TS_MW
, $this->mAttribs
['rc_timestamp'] );
851 $this->mAttribs
['rc_deleted'] = $row->rc_deleted
; // MUST be set
855 * Get an attribute value
857 * @param string $name Attribute name
860 public function getAttribute( $name ) {
861 return isset( $this->mAttribs
[$name] ) ?
$this->mAttribs
[$name] : null;
867 public function getAttributes() {
868 return $this->mAttribs
;
872 * Gets the end part of the diff URL associated with this object
873 * Blank if no diff link should be displayed
874 * @param bool $forceCur
877 public function diffLinkTrail( $forceCur ) {
878 if ( $this->mAttribs
['rc_type'] == RC_EDIT
) {
879 $trail = "curid=" . (int)( $this->mAttribs
['rc_cur_id'] ) .
880 "&oldid=" . (int)( $this->mAttribs
['rc_last_oldid'] );
884 $trail .= '&diff=' . (int)( $this->mAttribs
['rc_this_oldid'] );
894 * Returns the change size (HTML).
895 * The lengths can be given optionally.
900 public function getCharacterDifference( $old = 0, $new = 0 ) {
902 $old = $this->mAttribs
['rc_old_len'];
905 $new = $this->mAttribs
['rc_new_len'];
907 if ( $old === null ||
$new === null ) {
911 return ChangesList
::showCharacterDifference( $old, $new );
914 private static function checkIPAddress( $ip ) {
917 if ( !IP
::isIPAddress( $ip ) ) {
918 throw new MWException( "Attempt to write \"" . $ip .
919 "\" as an IP address into recent changes" );
922 $ip = $wgRequest->getIP();
932 * Check whether the given timestamp is new enough to have a RC row with a given tolerance
933 * as the recentchanges table might not be cleared out regularly (so older entries might exist)
934 * or rows which will be deleted soon shouldn't be included.
936 * @param mixed $timestamp MWTimestamp compatible timestamp
937 * @param int $tolerance Tolerance in seconds
940 public static function isInRCLifespan( $timestamp, $tolerance = 0 ) {
943 return wfTimestamp( TS_UNIX
, $timestamp ) > time() - $tolerance - $wgRCMaxAge;
947 * Parses and returns the rc_params attribute
953 public function parseParams() {
954 $rcParams = $this->getAttribute( 'rc_params' );
956 MediaWiki\
suppressWarnings();
957 $unserializedParams = unserialize( $rcParams );
958 MediaWiki\restoreWarnings
();
960 return $unserializedParams;