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

Change subject: Re-instate "Remove pre-authmanager code"
......................................................................


Re-instate "Remove pre-authmanager code"

This reverts commit ecf9bc4424595d2d8e038c57fe8402a2bc20e7f7.

Fixes copy paste fail from Id686d75e0a6b475a79f7f715791d867dc6fb400c,
should've been preauth, not primary

Change-Id: I8c5456af1ca3bf89c4fd1791b113ac3a16350989
---
M TitleBlacklist.hooks.php
M extension.json
2 files changed, 7 insertions(+), 110 deletions(-)

Approvals:
  EddieGP: Looks good to me, but someone else must approve
  Zfilipin: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/TitleBlacklist.hooks.php b/TitleBlacklist.hooks.php
index fa8c1a8..f24ee94 100644
--- a/TitleBlacklist.hooks.php
+++ b/TitleBlacklist.hooks.php
@@ -6,33 +6,12 @@
  * @license GNU General Public License 2.0 or later
  */
 
-use MediaWiki\Auth\AuthManager;
-
 /**
  * Hooks for the TitleBlacklist class
  *
  * @ingroup Extensions
  */
 class TitleBlacklistHooks {
-
-       /**
-        * Called right after configuration variables have been set.
-        */
-       public static function onRegistration() {
-               global $wgDisableAuthManager, $wgAuthManagerAutoConfig;
-
-               if ( class_exists( AuthManager::class ) && 
!$wgDisableAuthManager ) {
-                       
$wgAuthManagerAutoConfig['preauth'][TitleBlacklistPreAuthenticationProvider::class]
 =
-                               [ 'class' => 
TitleBlacklistPreAuthenticationProvider::class ];
-               } else {
-                       Hooks::register( 'AbortNewAccount', 
'TitleBlacklistHooks::abortNewAccount' );
-                       Hooks::register( 'AbortAutoAccount', 
'TitleBlacklistHooks::abortAutoAccount' );
-                       Hooks::register( 'UserCreateForm', 
'TitleBlacklistHooks::addOverrideCheckbox' );
-                       Hooks::register( 'APIGetAllowedParams', 
'TitleBlacklistHooks::onAPIGetAllowedParams' );
-                       Hooks::register( 'AddNewAccountApiForm',
-                               'TitleBlacklistHooks::onAddNewAccountApiForm' );
-               }
-       }
 
        /**
         * getUserPermissionsErrorsExpensive hook
@@ -217,40 +196,6 @@
        }
 
        /**
-        * AbortNewAccount hook
-        *
-        * @param User $user
-        * @param string &$message
-        * @param Status &$status
-        * @return bool
-        */
-       public static function abortNewAccount( $user, &$message, &$status ) {
-               global $wgUser, $wgRequest;
-               $override = $wgRequest->getCheck( 'wpIgnoreTitleBlacklist' );
-               $sv = self::testUserName( $user->getName(), $wgUser, $override, 
true );
-               if ( !$sv->isGood() ) {
-                       $status = Status::wrap( $sv );
-                       $message = $status->getMessage()->parse();
-               }
-               return $sv->isGood();
-       }
-
-       /**
-        * AbortAutoAccount hook
-        *
-        * @param User $user
-        * @param string &$message
-        * @return bool
-        */
-       public static function abortAutoAccount( $user, &$message ) {
-               global $wgTitleBlacklistBlockAutoAccountCreation;
-               if ( $wgTitleBlacklistBlockAutoAccountCreation ) {
-                       return self::abortNewAccount( $user, $message );
-               }
-               return true;
-       }
-
-       /**
         * EditFilter hook
         *
         * @param EditPage $editor
@@ -305,60 +250,6 @@
                if ( $title->getNamespace() == NS_MEDIAWIKI && 
$title->getDBkey() == 'Titleblacklist' ) {
                        TitleBlacklist::singleton()->invalidate();
                }
-               return true;
-       }
-
-       /**
-        * UserCreateForm hook based on the one from AntiSpoof extension
-        * @param UsercreateTemplate &$template
-        * @return true
-        */
-       public static function addOverrideCheckbox( &$template ) {
-               global $wgRequest, $wgUser;
-
-               if ( TitleBlacklist::userCanOverride( $wgUser, 'new-account' ) 
) {
-                       $template->addInputItem( 'wpIgnoreTitleBlacklist',
-                               $wgRequest->getCheck( 'wpIgnoreTitleBlacklist' 
),
-                               'checkbox', 'titleblacklist-override' );
-               }
-               return true;
-       }
-
-       /**
-        * @param ApiBase &$module
-        * @param array &$params
-        * @return bool
-        */
-       public static function onAPIGetAllowedParams( ApiBase &$module, array 
&$params ) {
-               if ( $module instanceof ApiCreateAccount ) {
-                       $params['ignoretitleblacklist'] = [
-                               ApiBase::PARAM_TYPE => 'boolean',
-                               ApiBase::PARAM_DFLT => false
-                       ];
-               }
-
-               return true;
-       }
-
-       /**
-        * Pass API parameter on to the login form when using
-        * API account creation.
-        *
-        * @param ApiBase $apiModule
-        * @param LoginForm $loginForm
-        * @return bool Always true
-        */
-       public static function onAddNewAccountApiForm( ApiBase $apiModule, 
LoginForm $loginForm ) {
-               global $wgRequest;
-               $main = $apiModule->getMain();
-
-               if ( $main->getVal( 'ignoretitleblacklist' ) !== null ) {
-                       $wgRequest->setVal( 'wpIgnoreTitleBlacklist', '1' );
-
-                       // Suppress "unrecognized parameter" warning:
-                       $main->getVal( 'wpIgnoreTitleBlacklist' );
-               }
-
                return true;
        }
 
diff --git a/extension.json b/extension.json
index c770dba..5319a26 100644
--- a/extension.json
+++ b/extension.json
@@ -67,7 +67,6 @@
                "localBasePath": "modules",
                "remoteExtPath": "TitleBlacklist/modules"
        },
-       "callback": "TitleBlacklistHooks::onRegistration",
        "Hooks": {
                "getUserPermissionsErrorsExpensive": [
                        "TitleBlacklistHooks::userCan"
@@ -99,5 +98,12 @@
                },
                "TitleBlacklistBlockAutoAccountCreation": true
        },
+       "AuthManagerAutoConfig": {
+               "preauth": {
+                       "TitleBlacklistPreAuthenticationProvider": {
+                               "class": 
"TitleBlacklistPreAuthenticationProvider"
+                       }
+               }
+       },
        "manifest_version": 1
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8c5456af1ca3bf89c4fd1791b113ac3a16350989
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/TitleBlacklist
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: EddieGP <wikimedia....@eddie-sh.de>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Zfilipin <zfili...@wikimedia.org>
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