jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/329202 )

Change subject: Don't mess around with $wgHooks by using CustomEditor hook
......................................................................


Don't mess around with $wgHooks by using CustomEditor hook

The AlternateEdit hook would cause recursion, so it needed to be unset
by messing with $wgHooks.

Instead of doing that, just use the earlier CustomEditor hook that would
only get called once.

Change-Id: Ib1c08a2df3e43db429797647f314af8dbfe58f03
---
M TwoColConflict.hooks.php
M extension.json
2 files changed, 5 insertions(+), 9 deletions(-)

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



diff --git a/TwoColConflict.hooks.php b/TwoColConflict.hooks.php
index 3034a0c..a4d718b 100644
--- a/TwoColConflict.hooks.php
+++ b/TwoColConflict.hooks.php
@@ -12,8 +12,7 @@
 
 class TwoColConflictHooks {
 
-       public static function onAlternateEdit( EditPage $editPage ) {
-               global $wgHooks;
+       public static function onCustomEditor( Article $article, User $user ) {
                $config = MediaWikiServices::getInstance()->getMainConfig();
 
                /**
@@ -23,15 +22,12 @@
                if (
                        $config->get( 'TwoColConflictBetaFeature' ) &&
                        class_exists( BetaFeatures::class ) &&
-                       !BetaFeatures::isFeatureEnabled( 
$editPage->getContext()->getUser(), 'twocolconflict' )
+                       !BetaFeatures::isFeatureEnabled( $user, 
'twocolconflict' )
                ) {
                        return true;
                }
 
-               $key = array_search( 'TwoColConflictHooks::onAlternateEdit', 
$wgHooks );
-               unset( $wgHooks[ 'AlternateEdit' ][ $key ] );
-
-               $twoColConflictPage = new TwoColConflictPage( 
$editPage->mArticle );
+               $twoColConflictPage = new TwoColConflictPage( $article );
                $twoColConflictPage->edit();
 
                return false;
diff --git a/extension.json b/extension.json
index 4f23592..7651819 100644
--- a/extension.json
+++ b/extension.json
@@ -21,8 +21,8 @@
                "GetBetaFeaturePreferences": [
                        "TwoColConflictHooks::getBetaFeaturePreferences"
                ],
-               "AlternateEdit": [
-                       "TwoColConflictHooks::onAlternateEdit"
+               "CustomEditor": [
+                       "TwoColConflictHooks::onCustomEditor"
                ]
        },
        "MessagesDirs": {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1c08a2df3e43db429797647f314af8dbfe58f03
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwoColConflict
Gerrit-Branch: master
Gerrit-Owner: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: WMDE-Fisch <christoph.jau...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to