jenkins-bot has submitted this change and it was merged.

Change subject: Avoid wgUser in AbuseFilterHooks edit handlers
......................................................................


Avoid wgUser in AbuseFilterHooks edit handlers

Also a minor comment fix.
(Partly a follow up to Id998172)

Change-Id: Ie6a8f1e17afbf39a0aae7519fa7872504907223f
---
M AbuseFilter.hooks.php
1 file changed, 7 insertions(+), 10 deletions(-)

Approvals:
  Yuvipanda: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/AbuseFilter.hooks.php b/AbuseFilter.hooks.php
index 2e06ae1..5606adc 100644
--- a/AbuseFilter.hooks.php
+++ b/AbuseFilter.hooks.php
@@ -15,13 +15,11 @@
         *
         * @param EditPage $editPage
         * @param string $text New text of the article (has yet to be saved)
-        * @param array &$resultArr Data in this array will be added to the API 
result
+        * @param array &$result Data in this array will be added to the API 
result
         *
         * @return bool
         */
        public static function onAPIEditBeforeSave( $editPage, $text, &$result 
) {
-               global $wgUser;
-
                $context = $editPage->mArticle->getContext();
 
                $status = Status::newGood();
@@ -31,7 +29,7 @@
                // poor man's PST, see bug 20310
                $text = str_replace( "\r\n", "\n", $text );
 
-               $continue = self::filterEdit( $context, null, $text, $status, 
$summary, $wgUser, $minoredit );
+               $continue = self::filterEdit( $context, null, $text, $status, 
$summary, $minoredit );
 
                if ( !$status->isOK() ) {
                        $msg = $status->getErrorsArray();
@@ -68,8 +66,6 @@
         * @return bool
         */
        public static function onEditFilterMerged( $editor, $text, &$error, 
$summary ) {
-               global $wgUser;
-
                $context = $editor->mArticle->getContext();
 
                $status = Status::newGood();
@@ -78,7 +74,7 @@
                // poor man's PST, see bug 20310
                $text = str_replace( "\r\n", "\n", $text );
 
-               $continue = self::filterEdit( $context, null, $text, $status, 
$summary, $wgUser, $minoredit );
+               $continue = self::filterEdit( $context, null, $text, $status, 
$summary, $minoredit );
 
                if ( !$status->isOK() ) {
                        $error = $status->getWikiText();
@@ -104,7 +100,7 @@
 
                $text = AbuseFilter::contentToString( $content, Revision::RAW );
 
-               $continue = self::filterEdit( $context, $content, $text, 
$status, $summary, $user, $minoredit );
+               $continue = self::filterEdit( $context, $content, $text, 
$status, $summary, $minoredit );
                return $continue;
        }
 
@@ -117,13 +113,12 @@
         * @param string $text new page content (subject of filtering)
         * @param Status $status  Error message to return
         * @param string $summary Edit summary for page
-        * @param User $user the user performing the edit
         * @param bool $minoredit whether this is a minor edit according to the 
user.
         *
         * @return bool
         */
        public static function filterEdit( IContextSource $context, $content, 
$text,
-                               Status $status, $summary, User $user, 
$minoredit ) {
+                               Status $status, $summary, $minoredit ) {
                // Load vars
                $vars = new AbuseFilterVariableHolder();
 
@@ -138,6 +133,8 @@
                self::$successful_action_vars = false;
                self::$last_edit_page = false;
 
+               $user = $context->getUser();
+
                // Check for null edits.
                $oldtext = '';
                $oldcontent = null;

-- 
To view, visit https://gerrit.wikimedia.org/r/72563
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie6a8f1e17afbf39a0aae7519fa7872504907223f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to