X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flogging%2FLogEntry.php;h=21864eefbfc4cb08b8abaab995c243614d46cc1d;hp=20d0217baa7e8ffcd8b44f8df0c0c1d2a246817b;hb=e758226c91935a1df2b6fd3ed1f18922d8bfb45b;hpb=aeba9bac37eab0afb4dcb3784e508d6565cbed42 diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 20d0217baa..21864eefbf 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -705,39 +705,39 @@ class ManualLogEntry extends LogEntryBase { * * @param int $newId Id of the log entry. * @param string $to One of: rcandudp (default), rc, udp - * @return RecentChange|null */ public function publish( $newId, $to = 'rcandudp' ) { - $log = new LogPage( $this->getType() ); - if ( $log->isRestricted() ) { - return null; - } - - $rc = $this->getRecentChange( $newId ); - - if ( $to === 'rc' || $to === 'rcandudp' ) { - $rc->save( 'pleasedontudp' ); - } - - if ( $to === 'udp' || $to === 'rcandudp' ) { - $rc->notifyRCFeeds(); - } - - // Log the autopatrol if the log entry is patrollable - if ( $this->getIsPatrollable() && - $rc->getAttribute( 'rc_patrolled' ) === 1 ) { - PatrolLog::record( $rc, true, $this->getPerformer() ); - } - - // Add change tags to the log entry and (if applicable) the associated revision - $tags = $this->getTags(); - if ( !is_null( $tags ) ) { - $rcId = $rc->getAttribute( 'rc_id' ); - $revId = $this->getAssociatedRevId(); // Use null if $revId is 0 - ChangeTags::addTags( $tags, $rcId, $revId > 0 ? $revId : null, $newId ); - } - - return $rc; + DeferredUpdates::addCallableUpdate( + function () use ( $newId, $to ) { + $log = new LogPage( $this->getType() ); + if ( !$log->isRestricted() ) { + $rc = $this->getRecentChange( $newId ); + + if ( $to === 'rc' || $to === 'rcandudp' ) { + // save RC, passing tags so they are applied there + $tags = $this->getTags(); + if ( is_null( $tags ) ) { + $tags = []; + } + $rc->addTags( $tags ); + $rc->save( 'pleasedontudp' ); + } + + if ( $to === 'udp' || $to === 'rcandudp' ) { + $rc->notifyRCFeeds(); + } + + // Log the autopatrol if the log entry is patrollable + if ( $this->getIsPatrollable() && + $rc->getAttribute( 'rc_patrolled' ) === 1 + ) { + PatrolLog::record( $rc, true, $this->getPerformer() ); + } + } + }, + DeferredUpdates::POSTSEND, + wfGetDB( DB_MASTER ) + ); } public function getType() {