Smalyshev has uploaded a new change for review. https://gerrit.wikimedia.org/r/227372
Change subject: T105427: create nearly-blank RC entry for suppressed events ...................................................................... T105427: create nearly-blank RC entry for suppressed events The entry will contain only page ID that was changed but no other information. Change-Id: I9422c2dc1ac5631a6b8b8791b3e15604b50647b8 --- M includes/changes/RecentChange.php M includes/logging/LogEntry.php 2 files changed, 33 insertions(+), 22 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/72/227372/1 diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 77bf5df..b884b3c 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -681,7 +681,7 @@ * @param string $actionCommentIRC * @return RecentChange */ - public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, + public static function newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '' ) { global $wgRequest; diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 8427adb..1562902 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -575,40 +575,54 @@ /** * Get a RecentChanges object for the log entry * @param int $newId + * @param bool $isRestricted Is this a restricted change? * @return RecentChange * @since 1.23 */ - public function getRecentChange( $newId = 0 ) { + public function getRecentChange( $newId = 0, $isRestricted = false ) { $formatter = LogFormatter::newFromEntry( $this ); $context = RequestContext::newExtraneousContext( $this->getTarget() ); $formatter->setContext( $context ); - $logpage = SpecialPage::getTitleFor( 'Log', $this->getType() ); - $user = $this->getPerformer(); - $ip = ""; - if ( $user->isAnon() ) { - /* - * "MediaWiki default" and friends may have - * no IP address in their name - */ - if ( IP::isIPAddress( $user->getName() ) ) { - $ip = $user->getName(); + + if ( !$isRestricted ) { + $user = $this->getPerformer(); + $ip = ""; + if ( $user->isAnon() ) { + /* + * "MediaWiki default" and friends may have + * no IP address in their name + */ + if ( IP::isIPAddress( $user->getName() ) ) { + $ip = $user->getName(); + } } + } else { + // Restricted changes only have page ID in RC but other information is hidden + $row = array( + 'page_id' => $this->getTarget()->getArticleID(), + 'page_namespace' => $this->getTarget()->getNamespace(), + 'page_title' => '' + ); + $nullpage = Title::newFromRow( (object)$row ); + $user = new User(); + $user->setName( '0.0.0.0' ); + $ip = '0.0.0.0'; } return RecentChange::newLogEntry( $this->getTimestamp(), - $logpage, + $isRestricted ? $nullpage : $logpage, $user, - $formatter->getPlainActionText(), + $isRestricted ? '' : $formatter->getPlainActionText(), $ip, $this->getType(), $this->getSubtype(), - $this->getTarget(), - $this->getComment(), - LogEntryBase::makeParamBlob( $this->getParameters() ), + $isRestricted ? $nullpage : $this->getTarget(), + $isRestricted ? '' : $this->getComment(), + $isRestricted ? '' : LogEntryBase::makeParamBlob( $this->getParameters() ), $newId, - $formatter->getIRCActionComment() // Used for IRC feeds + $isRestricted ? '' : $formatter->getIRCActionComment() // Used for IRC feeds ); } @@ -619,11 +633,8 @@ */ public function publish( $newId, $to = 'rcandudp' ) { $log = new LogPage( $this->getType() ); - if ( $log->isRestricted() ) { - return; - } - $rc = $this->getRecentChange( $newId ); + $rc = $this->getRecentChange( $newId, $log->isRestricted() ); if ( $to === 'rc' || $to === 'rcandudp' ) { $rc->save( 'pleasedontudp' ); -- To view, visit https://gerrit.wikimedia.org/r/227372 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9422c2dc1ac5631a6b8b8791b3e15604b50647b8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Smalyshev <smalys...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits