From 0815fc6a8fe54b22399e941f888252e4aaba8c27 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Thu, 12 Jul 2018 19:46:13 +0200 Subject: [PATCH] Update LogPage to ManualLogEntry We still had three entries of "LogPage", which is legacy and has some problems (I7bb0e92b2906a2511fc4290bdc76fc39ec4617fe). This patch updates two of them to ManualLogEntry. The last one is handled separately in Ic23e724997e4748c8d0da8138aa73d31b17b7064. Change-Id: I2a4f18ea6baebdc114078c57d8937ce4ca2aace5 --- includes/AbuseFilter.php | 20 ++++++++++---------- includes/Views/AbuseFilterViewRevert.php | 14 ++++++++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/includes/AbuseFilter.php b/includes/AbuseFilter.php index b182c5373..38559895a 100644 --- a/includes/AbuseFilter.php +++ b/includes/AbuseFilter.php @@ -1596,21 +1596,21 @@ class AbuseFilter { break; } - $log = new LogPage( 'rights' ); - - $log->addEntry( 'rights', - $wgUser->getUserPage(), + $logEntry = new ManualLogEntry( 'rights', 'rights' ); + $logEntry->setPerformer( self::getFilterUser() ); + $logEntry->setTarget( $wgUser->getUserPage() ); + $logEntry->setComment( wfMessage( 'abusefilter-degroupreason', $rule_desc, $rule_number - )->inContentLanguage()->text(), - [ - implode( ', ', $groups ), - '' - ], - self::getFilterUser() + )->inContentLanguage()->text() ); + $logEntry->setParameters( [ + '4::oldgroups' => $groups, + '5::newgroups' => [] + ] ); + $logEntry->publish( $logEntry->insert() ); } break; diff --git a/includes/Views/AbuseFilterViewRevert.php b/includes/Views/AbuseFilterViewRevert.php index ab48d6966..1b5261fd3 100644 --- a/includes/Views/AbuseFilterViewRevert.php +++ b/includes/Views/AbuseFilterViewRevert.php @@ -297,15 +297,21 @@ class AbuseFilterViewRevert extends AbuseFilterView { $dbw->insert( 'user_groups', $rows, __METHOD__, [ 'IGNORE' ] ); $user->invalidateCache(); - $log = new LogPage( 'rights' ); - $log->addEntry( 'rights', $user->getUserPage(), + $logEntry = new ManualLogEntry( 'rights', 'rights' ); + $logEntry->setTarget( $user->getUserPage() ); + $logEntry->setPerformer( $this->getUser() ); + $logEntry->setComment( $this->msg( 'abusefilter-revert-reason', $this->mPage->mFilter, $this->mReason - )->inContentLanguage()->text(), - [ implode( ',', $currentGroups ), implode( ',', $newGroups ) ] + )->inContentLanguage()->text() ); + $logEntry->setParameters( [ + '4::oldgroups' => $currentGroups, + '5::newgroups' => $newGroups + ] ); + $logEntry->publish( $logEntry->insert() ); return true; }