* @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;
}
if ( !( $flags & EDIT_SUPPRESS_RC ) ) {
// Mark as patrolled if the user can do so
$patrolled = $wgUseRCPatrol && !count(
- $this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) );
-
+ $this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) );
// Add RC row to the DB
- $rc = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $user, $summary,
+ RecentChange::notifyEdit(
+ $now, $this->mTitle, $isminor, $user, $summary,
$oldid, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
$revisionId, $patrolled
);
-
- // Log auto-patrolled edits
- if ( $patrolled ) {
- PatrolLog::record( $rc, true, $user );
- }
}
$user->incEditCount();
$patrolled = ( $wgUseRCPatrol || $wgUseNPPatrol ) && !count(
$this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) );
// Add RC row to the DB
- $rc = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $user, $summary, $bot,
- '', $newsize, $revisionId, $patrolled );
-
- // Log auto-patrolled edits
- if ( $patrolled ) {
- PatrolLog::record( $rc, true, $user );
- }
+ RecentChange::notifyNew(
+ $now, $this->mTitle, $isminor, $user, $summary, $bot,
+ '', $newsize, $revisionId, $patrolled
+ );
}
$user->incEditCount();