Move maintenance scripts to a separate namespace

Depends-On: Iaf3c218abd5578d604a89634c38d9156bb19a0d2
Change-Id: Ifcc2bff9e400fde564179fe6b96496ceae6b8623
This commit is contained in:
Daimona Eaytoy 2021-01-02 14:49:41 +01:00
parent 00fe8a36be
commit d2fa65673c
9 changed files with 44 additions and 17 deletions

View file

@ -140,6 +140,7 @@
"AbuseFilterAliases": "AbuseFilter.alias.php"
},
"AutoloadNamespaces": {
"MediaWiki\\Extension\\AbuseFilter\\Maintenance\\": "maintenance/",
"MediaWiki\\Extension\\AbuseFilter\\Api\\": "includes/Api/",
"MediaWiki\\Extension\\AbuseFilter\\VariableGenerator\\": "includes/VariableGenerator/",
"MediaWiki\\Extension\\AbuseFilter\\Hooks\\": "includes/Hooks/",
@ -184,11 +185,7 @@
"MediaWiki\\Extension\\AbuseFilter\\AbuseLogger": "includes/AbuseLogger.php",
"MediaWiki\\Extension\\AbuseFilter\\AbuseLoggerFactory": "includes/AbuseLoggerFactory.php",
"MediaWiki\\Extension\\AbuseFilter\\FilterRunner": "includes/FilterRunner.php",
"MediaWiki\\Extension\\AbuseFilter\\FilterRunnerFactory": "includes/FilterRunnerFactory.php",
"NormalizeThrottleParameters": "maintenance/normalizeThrottleParameters.php",
"FixOldLogEntries": "maintenance/fixOldLogEntries.php",
"UpdateVarDumps": "maintenance/updateVarDumps.php",
"MigrateAflFilter": "maintenance/migrateAflFilter.php"
"MediaWiki\\Extension\\AbuseFilter\\FilterRunnerFactory": "includes/FilterRunnerFactory.php"
},
"TestAutoloadClasses": {
"AbuseFilterConsequencesTest": "tests/phpunit/AbuseFilterConsequencesTest.php",

View file

@ -3,12 +3,12 @@
namespace MediaWiki\Extension\AbuseFilter\Hooks\Handlers;
use DatabaseUpdater;
use FixOldLogEntries;
use MediaWiki\Extension\AbuseFilter\Maintenance\FixOldLogEntries;
use MediaWiki\Extension\AbuseFilter\Maintenance\MigrateAflFilter;
use MediaWiki\Extension\AbuseFilter\Maintenance\NormalizeThrottleParameters;
use MediaWiki\Extension\AbuseFilter\Maintenance\UpdateVarDumps;
use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
use MigrateAflFilter;
use MWException;
use NormalizeThrottleParameters;
use UpdateVarDumps;
use User;
class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook {

View file

@ -1,5 +1,7 @@
<?php
namespace MediaWiki\Extension\AbuseFilter\Maintenance;
if ( getenv( 'MW_INSTALL_PATH' ) ) {
$IP = getenv( 'MW_INSTALL_PATH' );
} else {
@ -7,8 +9,11 @@ if ( getenv( 'MW_INSTALL_PATH' ) ) {
}
require_once "$IP/maintenance/Maintenance.php";
use LoggedUpdateMaintenance;
use ManualLogEntry;
use MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseFilter;
use MediaWiki\MediaWikiServices;
use User;
/**
* Adds rows missing per T54919
@ -29,7 +34,7 @@ class AddMissingLoggingEntries extends LoggedUpdateMaintenance {
* @inheritDoc
*/
public function getUpdateKey() {
return __CLASS__;
return 'AddMissingLoggingEntries';
}
/**

View file

@ -1,11 +1,16 @@
<?php
namespace MediaWiki\Extension\AbuseFilter\Maintenance;
use LoggedUpdateMaintenance;
if ( getenv( 'MW_INSTALL_PATH' ) ) {
$IP = getenv( 'MW_INSTALL_PATH' );
} else {
$IP = __DIR__ . '/../../..';
}
require_once "$IP/maintenance/Maintenance.php";
/**
* Fix old log entries with log_type = 'abusefilter' where log_params are imploded with '\n'
* instead of "\n" (using single quotes), which causes a broken display.
@ -41,7 +46,7 @@ class FixOldLogEntries extends LoggedUpdateMaintenance {
* @inheritDoc
*/
public function getUpdateKey() {
return __CLASS__;
return 'FixOldLogEntries';
}
/**
@ -284,5 +289,5 @@ class FixOldLogEntries extends LoggedUpdateMaintenance {
}
}
$maintClass = 'FixOldLogEntries';
$maintClass = FixOldLogEntries::class;
require_once RUN_MAINTENANCE_IF_MAIN;

View file

@ -1,5 +1,8 @@
<?php
namespace MediaWiki\Extension\AbuseFilter\Maintenance;
use LoggedUpdateMaintenance;
use MediaWiki\Extension\AbuseFilter\GlobalNameUtils;
use MediaWiki\MediaWikiServices;
@ -29,7 +32,7 @@ class MigrateAflFilter extends LoggedUpdateMaintenance {
* @inheritDoc
*/
public function getUpdateKey() {
return __CLASS__;
return 'MigrateAflFilter';
}
/**
@ -133,5 +136,5 @@ class MigrateAflFilter extends LoggedUpdateMaintenance {
}
}
$maintClass = 'MigrateAflFilter';
$maintClass = MigrateAflFilter::class;
require_once RUN_MAINTENANCE_IF_MAIN;

View file

@ -19,6 +19,9 @@
* @ingroup Maintenance
*/
namespace MediaWiki\Extension\AbuseFilter\Maintenance;
use LoggedUpdateMaintenance;
use MediaWiki\Extension\AbuseFilter\AbuseFilterServices;
if ( getenv( 'MW_INSTALL_PATH' ) ) {
@ -47,7 +50,7 @@ class NormalizeThrottleParameters extends LoggedUpdateMaintenance {
* @return string
*/
public function getUpdateKey() {
return __CLASS__;
return 'NormalizeThrottleParameters';
}
/** @var \Wikimedia\Rdbms\Database The master database */

View file

@ -1,5 +1,7 @@
<?php
namespace MediaWiki\Extension\AbuseFilter\Maintenance;
if ( getenv( 'MW_INSTALL_PATH' ) ) {
$IP = getenv( 'MW_INSTALL_PATH' );
} else {
@ -7,6 +9,7 @@ if ( getenv( 'MW_INSTALL_PATH' ) ) {
}
require_once "$IP/maintenance/Maintenance.php";
use Maintenance;
use MediaWiki\MediaWikiServices;
class PurgeOldLogIPData extends Maintenance {

View file

@ -1,5 +1,9 @@
<?php
namespace MediaWiki\Extension\AbuseFilter\Maintenance;
use Maintenance;
if ( getenv( 'MW_INSTALL_PATH' ) ) {
$IP = getenv( 'MW_INSTALL_PATH' );
} else {

View file

@ -1,10 +1,17 @@
<?php
namespace MediaWiki\Extension\AbuseFilter\Maintenance;
use ExternalStoreAccess;
use FormatJson;
use LoggedUpdateMaintenance;
use MediaWiki\Extension\AbuseFilter\AbuseFilterServices;
use MediaWiki\Extension\AbuseFilter\KeywordsManager;
use MediaWiki\Extension\AbuseFilter\Variables\VariableHolder;
use MediaWiki\Extension\AbuseFilter\Variables\VariablesBlobStore;
use MediaWiki\MediaWikiServices;
use Title;
use UnexpectedValueException;
use Wikimedia\AtEase\AtEase;
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IResultWrapper;
@ -74,7 +81,7 @@ class UpdateVarDumps extends LoggedUpdateMaintenance {
* @inheritDoc
*/
public function getUpdateKey() {
return __CLASS__;
return 'UpdateVarDumps';
}
/**
@ -718,5 +725,5 @@ class UpdateVarDumps extends LoggedUpdateMaintenance {
}
}
$maintClass = 'UpdateVarDumps';
$maintClass = UpdateVarDumps::class;
require_once RUN_MAINTENANCE_IF_MAIN;