diff --git a/extension.json b/extension.json index 0f48f76d9..82581d737 100644 --- a/extension.json +++ b/extension.json @@ -115,15 +115,15 @@ "abusefilterprivatedetails": "abusefilter-privatedetails-log" }, "APIModules": { - "abusefilterchecksyntax": "ApiAbuseFilterCheckSyntax", - "abusefilterevalexpression": "ApiAbuseFilterEvalExpression", - "abusefilterunblockautopromote": "ApiAbuseFilterUnblockAutopromote", - "abusefiltercheckmatch": "ApiAbuseFilterCheckMatch", - "abuselogprivatedetails": "ApiAbuseLogPrivateDetails" + "abusefilterchecksyntax": "MediaWiki\\Extension\\AbuseFilter\\Api\\CheckSyntax", + "abusefilterevalexpression": "MediaWiki\\Extension\\AbuseFilter\\Api\\EvalExpression", + "abusefilterunblockautopromote": "MediaWiki\\Extension\\AbuseFilter\\Api\\UnblockAutopromote", + "abusefiltercheckmatch": "MediaWiki\\Extension\\AbuseFilter\\Api\\CheckMatch", + "abuselogprivatedetails": "MediaWiki\\Extension\\AbuseFilter\\Api\\AbuseLogPrivateDetails" }, "APIListModules": { - "abuselog": "ApiQueryAbuseLog", - "abusefilters": "ApiQueryAbuseFilters" + "abuselog": "MediaWiki\\Extension\\AbuseFilter\\Api\\QueryAbuseLog", + "abusefilters": "MediaWiki\\Extension\\AbuseFilter\\Api\\QueryAbuseFilters" }, "MessagesDirs": { "AbuseFilter": [ @@ -135,6 +135,7 @@ "AbuseFilterAliases": "AbuseFilter.alias.php" }, "AutoloadNamespaces": { + "MediaWiki\\Extension\\AbuseFilter\\Api\\": "includes/Api/", "MediaWiki\\Extension\\AbuseFilter\\VariableGenerator\\": "includes/VariableGenerator/", "MediaWiki\\Extension\\AbuseFilter\\Hooks\\": "includes/Hooks/", "MediaWiki\\Extension\\AbuseFilter\\LogFormatter\\": "includes/LogFormatter/", @@ -191,13 +192,6 @@ "AFPSyntaxTree": "includes/parser/AFPSyntaxTree.php", "AFPTreeParser": "includes/parser/AFPTreeParser.php", "AFPUserVisibleException": "includes/parser/AFPUserVisibleException.php", - "ApiQueryAbuseLog": "includes/api/ApiQueryAbuseLog.php", - "ApiQueryAbuseFilters": "includes/api/ApiQueryAbuseFilters.php", - "ApiAbuseFilterCheckSyntax": "includes/api/ApiAbuseFilterCheckSyntax.php", - "ApiAbuseFilterEvalExpression": "includes/api/ApiAbuseFilterEvalExpression.php", - "ApiAbuseFilterUnblockAutopromote": "includes/api/ApiAbuseFilterUnblockAutopromote.php", - "ApiAbuseFilterCheckMatch": "includes/api/ApiAbuseFilterCheckMatch.php", - "ApiAbuseLogPrivateDetails": "includes/api/ApiAbuseLogPrivateDetails.php", "NormalizeThrottleParameters": "maintenance/normalizeThrottleParameters.php", "FixOldLogEntries": "maintenance/fixOldLogEntries.php", "UpdateVarDumps": "maintenance/updateVarDumps.php" diff --git a/includes/api/ApiAbuseLogPrivateDetails.php b/includes/Api/AbuseLogPrivateDetails.php similarity index 95% rename from includes/api/ApiAbuseLogPrivateDetails.php rename to includes/Api/AbuseLogPrivateDetails.php index c63125ed5..94b07bb96 100644 --- a/includes/api/ApiAbuseLogPrivateDetails.php +++ b/includes/Api/AbuseLogPrivateDetails.php @@ -16,7 +16,11 @@ * http://www.gnu.org/copyleft/gpl.html */ +namespace MediaWiki\Extension\AbuseFilter\Api; + +use ApiBase; use MediaWiki\Extension\AbuseFilter\AbuseFilterServices; +use SpecialAbuseLog; /** * API module to allow accessing private details (the user's IP) from AbuseLog entries @@ -24,7 +28,7 @@ use MediaWiki\Extension\AbuseFilter\AbuseFilterServices; * @ingroup API * @ingroup Extensions */ -class ApiAbuseLogPrivateDetails extends ApiBase { +class AbuseLogPrivateDetails extends ApiBase { /** * @inheritDoc */ diff --git a/includes/api/ApiAbuseFilterCheckMatch.php b/includes/Api/CheckMatch.php similarity index 90% rename from includes/api/ApiAbuseFilterCheckMatch.php rename to includes/Api/CheckMatch.php index 82eaae7b8..77b955521 100644 --- a/includes/api/ApiAbuseFilterCheckMatch.php +++ b/includes/Api/CheckMatch.php @@ -1,9 +1,18 @@ newParser(); - if ( $parser->checkSyntax( $params[ 'filter' ] ) !== true ) { + if ( $parser->checkSyntax( $params['filter'] ) !== true ) { $this->dieWithError( 'apierror-abusefilter-badsyntax', 'badsyntax' ); } @@ -70,8 +79,8 @@ class ApiAbuseFilterCheckMatch extends ApiBase { } /** - * @see ApiBase::getAllowedParams * @return array + * @see ApiBase::getAllowedParams */ public function getAllowedParams() { return [ @@ -89,8 +98,8 @@ class ApiAbuseFilterCheckMatch extends ApiBase { } /** - * @see ApiBase::getExamplesMessages() * @return array + * @see ApiBase::getExamplesMessages() */ protected function getExamplesMessages() { return [ diff --git a/includes/api/ApiAbuseFilterCheckSyntax.php b/includes/Api/CheckSyntax.php similarity index 90% rename from includes/api/ApiAbuseFilterCheckSyntax.php rename to includes/Api/CheckSyntax.php index b39acc996..0b0bc05b5 100644 --- a/includes/api/ApiAbuseFilterCheckSyntax.php +++ b/includes/Api/CheckSyntax.php @@ -1,8 +1,11 @@ extractRequestParams(); - $result = AbuseFilterServices::getParserFactory()->newParser()->checkSyntax( $params[ 'filter' ] ); + $result = AbuseFilterServices::getParserFactory()->newParser()->checkSyntax( $params['filter'] ); $r = []; if ( $result === true ) { @@ -33,8 +36,8 @@ class ApiAbuseFilterCheckSyntax extends ApiBase { } /** - * @see ApiBase::getAllowedParams * @return array + * @see ApiBase::getAllowedParams */ public function getAllowedParams() { return [ @@ -45,8 +48,8 @@ class ApiAbuseFilterCheckSyntax extends ApiBase { } /** - * @see ApiBase::getExamplesMessages() * @return array + * @see ApiBase::getExamplesMessages() */ protected function getExamplesMessages() { return [ diff --git a/includes/api/ApiAbuseFilterEvalExpression.php b/includes/Api/EvalExpression.php similarity index 89% rename from includes/api/ApiAbuseFilterEvalExpression.php rename to includes/Api/EvalExpression.php index 32d931b65..87d3309aa 100644 --- a/includes/api/ApiAbuseFilterEvalExpression.php +++ b/includes/Api/EvalExpression.php @@ -1,9 +1,16 @@ newParser(); if ( $parser->checkSyntax( $expr ) !== true ) { return Status::newFatal( 'abusefilter-tools-syntax-error' ); @@ -51,8 +58,8 @@ class ApiAbuseFilterEvalExpression extends ApiBase { } /** - * @see ApiBase::getAllowedParams() * @return array + * @see ApiBase::getAllowedParams() */ public function getAllowedParams() { return [ @@ -66,8 +73,8 @@ class ApiAbuseFilterEvalExpression extends ApiBase { } /** - * @see ApiBase::getExamplesMessages() * @return array + * @see ApiBase::getExamplesMessages() */ protected function getExamplesMessages() { return [ diff --git a/includes/api/ApiQueryAbuseFilters.php b/includes/Api/QueryAbuseFilters.php similarity index 97% rename from includes/api/ApiQueryAbuseFilters.php rename to includes/Api/QueryAbuseFilters.php index fb6def9d0..09bba9f41 100644 --- a/includes/api/ApiQueryAbuseFilters.php +++ b/includes/Api/QueryAbuseFilters.php @@ -23,7 +23,13 @@ * http://www.gnu.org/copyleft/gpl.html */ +namespace MediaWiki\Extension\AbuseFilter\Api; + +use ApiBase; +use ApiQuery; +use ApiQueryBase; use MediaWiki\Extension\AbuseFilter\AbuseFilterServices; +use MWTimestamp; /** * Query module to list abuse filter details. @@ -31,7 +37,7 @@ use MediaWiki\Extension\AbuseFilter\AbuseFilterServices; * @ingroup API * @ingroup Extensions */ -class ApiQueryAbuseFilters extends ApiQueryBase { +class QueryAbuseFilters extends ApiQueryBase { /** * @param ApiQuery $query * @param string $moduleName @@ -162,8 +168,8 @@ class ApiQueryAbuseFilters extends ApiQueryBase { } /** - * @see ApiQueryBase::getAllowedParams() * @return array + * @see ApiQueryBase::getAllowedParams() */ public function getAllowedParams() { return [ @@ -219,8 +225,8 @@ class ApiQueryAbuseFilters extends ApiQueryBase { } /** - * @see ApiBase::getExamplesMessages() * @return array + * @see ApiBase::getExamplesMessages() */ protected function getExamplesMessages() { return [ diff --git a/includes/api/ApiQueryAbuseLog.php b/includes/Api/QueryAbuseLog.php similarity index 97% rename from includes/api/ApiQueryAbuseLog.php rename to includes/Api/QueryAbuseLog.php index 43bcf84db..95e3c1345 100644 --- a/includes/api/ApiQueryAbuseLog.php +++ b/includes/Api/QueryAbuseLog.php @@ -23,9 +23,19 @@ * http://www.gnu.org/copyleft/gpl.html */ +namespace MediaWiki\Extension\AbuseFilter\Api; + +use AbuseFilter; +use ApiBase; +use ApiQuery; +use ApiQueryBase; use MediaWiki\Extension\AbuseFilter\AbuseFilterServices; use MediaWiki\Extension\AbuseFilter\CentralDBNotAvailableException; use MediaWiki\MediaWikiServices; +use MWTimestamp; +use SpecialAbuseLog; +use Title; +use User; use Wikimedia\IPUtils; /** @@ -34,7 +44,7 @@ use Wikimedia\IPUtils; * @ingroup API * @ingroup Extensions */ -class ApiQueryAbuseLog extends ApiQueryBase { +class QueryAbuseLog extends ApiQueryBase { /** * @param ApiQuery $query * @param string $moduleName @@ -112,7 +122,7 @@ class ApiQueryAbuseLog extends ApiQueryBase { $this->addTables( 'abuse_filter' ); $this->addFields( 'af_public_comments' ); $this->addJoinConds( [ 'abuse_filter' => [ 'LEFT JOIN', - 'af_id=afl_filter' ] ] ); + 'af_id=afl_filter' ] ] ); } $this->addOption( 'LIMIT', $params['limit'] + 1 ); @@ -249,8 +259,8 @@ class ApiQueryAbuseLog extends ApiQueryBase { } /** - * @see ApiQueryBase::getAllowedParams() * @return array + * @see ApiQueryBase::getAllowedParams() */ public function getAllowedParams() { $params = [ @@ -317,8 +327,8 @@ class ApiQueryAbuseLog extends ApiQueryBase { } /** - * @see ApiBase::getExamplesMessages() * @return array + * @see ApiBase::getExamplesMessages() */ protected function getExamplesMessages() { return [ diff --git a/includes/api/ApiAbuseFilterUnblockAutopromote.php b/includes/Api/UnblockAutopromote.php similarity index 94% rename from includes/api/ApiAbuseFilterUnblockAutopromote.php rename to includes/Api/UnblockAutopromote.php index c13a56ec0..86ce7b42d 100644 --- a/includes/api/ApiAbuseFilterUnblockAutopromote.php +++ b/includes/Api/UnblockAutopromote.php @@ -1,8 +1,12 @@