* Obtain the recent change with a given rc_id value
*
* @param int $rcid The rc_id value to retrieve
- * @return RecentChange
+ * @return RecentChange|null
*/
public static function newFromId( $rcid ) {
return self::newFromConds( array( 'rc_id' => $rcid ), __METHOD__ );
* @param array $conds Array of conditions
* @param mixed $fname Override the method name in profiling/logs
* @param array $options Query options
- * @return RecentChange
+ * @return RecentChange|null
*/
public static function newFromConds( $conds, $fname = __METHOD__, $options = array() ) {
$dbr = wfGetDB( DB_SLAVE );
$this->mExtra['pageStatus'] );
}
}
+
+ // Update the cached list of active users
+ if ( $this->mAttribs['rc_user'] > 0 ) {
+ JobQueueGroup::singleton()->lazyPush( RecentChangesUpdateJob::newCacheUpdateJob() );
+ }
}
/**
* @param int $patrol
* @return RecentChange
*/
- public static function notifyEdit( $timestamp, &$title, $minor, &$user, $comment, $oldId,
- $lastTimestamp, $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0 ) {
+ 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;
'newSize' => $newSize,
'pageStatus' => 'changed'
);
- $rc->save();
+
+ DeferredUpdates::addCallableUpdate( function() use ( $rc ) {
+ $rc->save();
+ if ( $rc->mAttribs['rc_patrolled'] ) {
+ PatrolLog::record( $rc, true, $rc->getPerformer() );
+ }
+ } );
return $rc;
}
* @param int $patrol
* @return RecentChange
*/
- public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot,
- $ip = '', $size = 0, $newId = 0, $patrol = 0 ) {
+ 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;
'newSize' => $size,
'pageStatus' => 'created'
);
- $rc->save();
+
+ DeferredUpdates::addCallableUpdate( function() use ( $rc ) {
+ $rc->save();
+ if ( $rc->mAttribs['rc_patrolled'] ) {
+ PatrolLog::record( $rc, true, $rc->getPerformer() );
+ }
+ } );
return $rc;
}
return wfTimestamp( TS_UNIX, $timestamp ) > time() - $tolerance - $wgRCMaxAge;
}
+
+ /**
+ * Parses and returns the rc_params attribute
+ *
+ * @since 1.26
+ *
+ * @return array|null
+ */
+ public function parseParams() {
+ $rcParams = $this->getAttribute( 'rc_params' );
+
+ MediaWiki\suppressWarnings();
+ $unserializedParams = unserialize( $rcParams );
+ MediaWiki\restoreWarnings();
+
+ return $unserializedParams;
+ }
}