Cenarium has uploaded a new change for review. https://gerrit.wikimedia.org/r/218267
Change subject: Add user param to recentchange_save hook ...................................................................... Add user param to recentchange_save hook So that extensions don't need to retrieve the user from the recent change, which is inefficient. Change-Id: Ib64c1aa1030e6935c0191d0b189f5f6314878391 --- M docs/hooks.txt M includes/changes/RecentChange.php 2 files changed, 7 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/67/218267/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index 8710bdb..aaa2dde 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2427,6 +2427,7 @@ 'RecentChange_save': Called at the end of RecentChange::save(). $recentChange: RecentChange object +$user: User saving the recent change (not always provided) 'RedirectSpecialArticleRedirectParams': Lets you alter the set of parameter names such as "oldid" that are preserved when using redirecting special pages diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index e6189a6..a0823ca 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -269,8 +269,9 @@ /** * Writes the data in this object to the database * @param bool $noudp + * @param User $user user performing the change (optional) */ - public function save( $noudp = false ) { + public function save( $noudp = false, User $user = null ) { global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang; $dbw = wfGetDB( DB_MASTER ); @@ -309,7 +310,7 @@ $this->mAttribs['rc_id'] = $dbw->insertId(); # Notify extensions - Hooks::run( 'RecentChange_save', array( &$this ) ); + Hooks::run( 'RecentChange_save', array( &$this, $user ) ); # Notify external application via UDP if ( !$noudp ) { @@ -562,7 +563,7 @@ ); DeferredUpdates::addCallableUpdate( function() use ( $rc, $autoTags, $user ) { - $rc->save(); + $rc->save( false, $user ); // Apply autotags if any if ( count( $autoTags ) ) { ChangeTags::addTags( $autoTags, $rc->mAttribs['rc_id'], @@ -637,7 +638,7 @@ ); DeferredUpdates::addCallableUpdate( function() use ( $rc, $autoTags, $user ) { - $rc->save(); + $rc->save( false, $user ); // Apply autotags if any if ( count( $autoTags ) ) { ChangeTags::addTags( $autoTags, $rc->mAttribs['rc_id'], @@ -678,7 +679,7 @@ } $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId, $actionCommentIRC ); - $rc->save(); + $rc->save( false, $user ); return true; } -- To view, visit https://gerrit.wikimedia.org/r/218267 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib64c1aa1030e6935c0191d0b189f5f6314878391 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Cenarium <cenarium.sy...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits