mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-23 21:53:40 +00:00
Merge "Namespace extension"
This commit is contained in:
commit
feb57fd022
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
},
|
||||
"APIModules": {
|
||||
"titleblacklist": "ApiQueryTitleBlacklist"
|
||||
"titleblacklist": "MediaWiki\\Extension\\TitleBlacklist\\Api\\ApiQueryTitleBlacklist"
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"TitleBlacklist": [
|
||||
|
@ -52,14 +52,8 @@
|
|||
"i18n/api"
|
||||
]
|
||||
},
|
||||
"AutoloadClasses": {
|
||||
"TitleBlacklist": "includes/TitleBlacklist.php",
|
||||
"TitleBlacklistEntry": "includes/TitleBlacklistEntry.php",
|
||||
"TitleBlacklistHooks": "includes/TitleBlacklistHooks.php",
|
||||
"TitleBlacklistAuthenticationRequest": "includes/TitleBlacklistAuthenticationRequest.php",
|
||||
"TitleBlacklistPreAuthenticationProvider": "includes/TitleBlacklistPreAuthenticationProvider.php",
|
||||
"Scribunto_LuaTitleBlacklistLibrary": "includes/Scribunto_LuaTitleBlacklistLibrary.php",
|
||||
"ApiQueryTitleBlacklist": "includes/api/ApiQueryTitleBlacklist.php"
|
||||
"AutoloadNamespaces": {
|
||||
"MediaWiki\\Extension\\TitleBlacklist\\": "includes/"
|
||||
},
|
||||
"ResourceModules": {
|
||||
"mediawiki.api.titleblacklist": {
|
||||
|
@ -97,11 +91,11 @@
|
|||
"MovePageCheckPermissions": "TitleBlacklistHookHandler",
|
||||
"EditFilter": "TitleBlacklistHookHandler",
|
||||
"PageSaveComplete": "TitleBlacklistHookHandler",
|
||||
"ScribuntoExternalLibraries": "TitleBlacklistHooks::onScribuntoExternalLibraries"
|
||||
"ScribuntoExternalLibraries": "MediaWiki\\Extension\\TitleBlacklist\\Hooks::onScribuntoExternalLibraries"
|
||||
},
|
||||
"HookHandlers": {
|
||||
"TitleBlacklistHookHandler": {
|
||||
"class": "TitleBlacklistHooks"
|
||||
"class": "MediaWiki\\Extension\\TitleBlacklist\\Hooks"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
@ -128,7 +122,7 @@
|
|||
"AuthManagerAutoConfig": {
|
||||
"preauth": {
|
||||
"TitleBlacklistPreAuthenticationProvider": {
|
||||
"class": "TitleBlacklistPreAuthenticationProvider"
|
||||
"class": "MediaWiki\\Extension\\TitleBlacklist\\TitleBlacklistPreAuthenticationProvider"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist\Api;
|
||||
|
||||
use ApiBase;
|
||||
use MediaWiki\Extension\TitleBlacklist\TitleBlacklist;
|
||||
use MediaWiki\Extension\TitleBlacklist\TitleBlacklistEntry;
|
||||
use Title;
|
||||
use Wikimedia\ParamValidator\ParamValidator;
|
||||
|
||||
/**
|
|
@ -6,21 +6,40 @@
|
|||
* @license GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist;
|
||||
|
||||
use ApiMessage;
|
||||
use ApiResult;
|
||||
use EditPage;
|
||||
use Html;
|
||||
use ManualLogEntry;
|
||||
use MediaWiki\Hook\EditFilterHook;
|
||||
use MediaWiki\Hook\MovePageCheckPermissionsHook;
|
||||
use MediaWiki\Hook\TitleGetEditNoticesHook;
|
||||
use MediaWiki\Permissions\Hook\GetUserPermissionsErrorsExpensiveHook;
|
||||
use MediaWiki\Revision\RevisionRecord;
|
||||
use MediaWiki\Storage\EditResult;
|
||||
use MediaWiki\Storage\Hook\PageSaveCompleteHook;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use MessageSpecifier;
|
||||
use RequestContext;
|
||||
use Status;
|
||||
use StatusValue;
|
||||
use Title;
|
||||
use User;
|
||||
use WikiPage;
|
||||
|
||||
/**
|
||||
* Hooks for the TitleBlacklist class
|
||||
*
|
||||
* @ingroup Extensions
|
||||
*/
|
||||
class TitleBlacklistHooks implements
|
||||
\MediaWiki\Hook\EditFilterHook,
|
||||
\MediaWiki\Hook\TitleGetEditNoticesHook,
|
||||
\MediaWiki\Hook\MovePageCheckPermissionsHook,
|
||||
\MediaWiki\Permissions\Hook\GetUserPermissionsErrorsExpensiveHook,
|
||||
\MediaWiki\Storage\Hook\PageSaveCompleteHook
|
||||
class Hooks implements
|
||||
EditFilterHook,
|
||||
TitleGetEditNoticesHook,
|
||||
MovePageCheckPermissionsHook,
|
||||
GetUserPermissionsErrorsExpensiveHook,
|
||||
PageSaveCompleteHook
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -269,7 +288,7 @@ class TitleBlacklistHooks implements
|
|||
*/
|
||||
public static function onScribuntoExternalLibraries( $engine, array &$extraLibraries ) {
|
||||
if ( $engine == 'lua' ) {
|
||||
$extraLibraries['mw.ext.TitleBlacklist'] = 'Scribunto_LuaTitleBlacklistLibrary';
|
||||
$extraLibraries['mw.ext.TitleBlacklist'] = Scribunto_LuaTitleBlacklistLibrary::class;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist;
|
||||
|
||||
use Scribunto_LuaLibraryBase;
|
||||
|
||||
class Scribunto_LuaTitleBlacklistLibrary extends Scribunto_LuaLibraryBase {
|
||||
public function register() {
|
||||
$lib = [
|
||||
|
|
|
@ -7,7 +7,14 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MWException;
|
||||
use ObjectCache;
|
||||
use TextContent;
|
||||
use Title;
|
||||
use User;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist;
|
||||
|
||||
use MediaWiki\Auth\AuthenticationRequest;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist;
|
||||
|
||||
use CoreParserFunctions;
|
||||
use Exception;
|
||||
use ExtensionRegistry;
|
||||
use MediaWiki\Extension\AntiSpoof\AntiSpoof;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace MediaWiki\Extension\TitleBlacklist;
|
||||
|
||||
use MediaWiki\Auth\AbstractPreAuthenticationProvider;
|
||||
use MediaWiki\Auth\AuthenticationRequest;
|
||||
use MediaWiki\Auth\AuthManager;
|
||||
use RequestContext;
|
||||
use StatusValue;
|
||||
use User;
|
||||
|
||||
class TitleBlacklistPreAuthenticationProvider extends AbstractPreAuthenticationProvider {
|
||||
protected $blockAutoAccountCreation;
|
||||
|
@ -41,7 +46,7 @@ class TitleBlacklistPreAuthenticationProvider extends AbstractPreAuthenticationP
|
|||
$override = false;
|
||||
}
|
||||
|
||||
return TitleBlacklistHooks::testUserName( $user->getName(), $creator, $override, true );
|
||||
return Hooks::testUserName( $user->getName(), $creator, $override, true );
|
||||
}
|
||||
|
||||
public function testUserForCreation( $user, $autocreate, array $options = [] ) {
|
||||
|
@ -49,7 +54,7 @@ class TitleBlacklistPreAuthenticationProvider extends AbstractPreAuthenticationP
|
|||
$creator = RequestContext::getMain()->getUser();
|
||||
|
||||
if ( !$autocreate && empty( $options['creating'] ) || $this->blockAutoAccountCreation ) {
|
||||
$sv->merge( TitleBlacklistHooks::testUserName(
|
||||
$sv->merge( Hooks::testUserName(
|
||||
$user->getName(), $creator, true, (bool)$autocreate
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
* Ian Baker <ian@wikimedia.org>
|
||||
*/
|
||||
|
||||
use MediaWiki\Extension\TitleBlacklist\TitleBlacklist;
|
||||
|
||||
/**
|
||||
* @group medium
|
||||
* @covers ApiQueryTitleBlacklist
|
||||
* @covers \MediaWiki\Extension\TitleBlacklist\Api\ApiQueryTitleBlacklist
|
||||
*/
|
||||
class ApiQueryTitleBlacklistTest extends ApiTestCase {
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Auth\AuthenticationRequestTestCase;
|
||||
use MediaWiki\Extension\TitleBlacklist\TitleBlacklistAuthenticationRequest;
|
||||
|
||||
/**
|
||||
* @covers TitleBlacklistAuthenticationRequest
|
||||
* @covers \MediaWiki\Extension\TitleBlacklist\TitleBlacklistAuthenticationRequest
|
||||
*/
|
||||
class TitleBlacklistAuthenticationRequestTest extends AuthenticationRequestTestCase {
|
||||
protected function getInstance( array $args = [] ) {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Auth\AuthManager;
|
||||
use MediaWiki\Extension\TitleBlacklist\TitleBlacklistAuthenticationRequest;
|
||||
use MediaWiki\Extension\TitleBlacklist\TitleBlacklistPreAuthenticationProvider;
|
||||
use MediaWiki\Tests\Unit\Auth\AuthenticationProviderTestTrait;
|
||||
|
||||
/**
|
||||
* @group Database
|
||||
* @covers TitleBlacklistPreAuthenticationProvider
|
||||
* @covers \MediaWiki\Extension\TitleBlacklist\TitleBlacklistPreAuthenticationProvider
|
||||
*/
|
||||
class TitleBlacklistPreAuthenticationProviderTest extends MediaWikiIntegrationTestCase {
|
||||
use AuthenticationProviderTestTrait;
|
||||
|
|
Loading…
Reference in a new issue