mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 09:43:30 +00:00
maintenance: Use standard doMaintenance boilerplate
Consistent with core, most WMF extensions, and boilerplate as documented in extensions/README and elsewhere; as per T316722. Change-Id: I02cfcb2bd3debf877d1cbf8654dff4a98dd354ad
This commit is contained in:
parent
f9d8b7afd5
commit
86d47438d3
|
@ -5,27 +5,11 @@ namespace MediaWiki\Extension\DiscussionTools\Maintenance;
|
|||
use ForeignResourceManager;
|
||||
use Maintenance;
|
||||
|
||||
// Security: Disable all stream wrappers and reenable individually as needed
|
||||
foreach ( stream_get_wrappers() as $wrapper ) {
|
||||
stream_wrapper_unregister( $wrapper );
|
||||
$IP = getenv( 'MW_INSTALL_PATH' );
|
||||
if ( $IP === false ) {
|
||||
$IP = __DIR__ . '/../../..';
|
||||
}
|
||||
// Needed by the Guzzle library for some reason
|
||||
stream_wrapper_restore( 'php' );
|
||||
// Needed by ForeignResourceManager to unpack TAR files
|
||||
stream_wrapper_restore( 'phar' );
|
||||
|
||||
stream_wrapper_restore( 'file' );
|
||||
$basePath = getenv( 'MW_INSTALL_PATH' );
|
||||
if ( $basePath ) {
|
||||
if ( !is_dir( $basePath )
|
||||
|| strpos( $basePath, '~' ) !== false
|
||||
) {
|
||||
die( "Bad MediaWiki install path: $basePath\n" );
|
||||
}
|
||||
} else {
|
||||
$basePath = __DIR__ . '/../../..';
|
||||
}
|
||||
require_once "$basePath/maintenance/Maintenance.php";
|
||||
require_once "$IP/maintenance/Maintenance.php";
|
||||
|
||||
class ManageForeignResources extends Maintenance {
|
||||
|
||||
|
@ -44,11 +28,4 @@ class ManageForeignResources extends Maintenance {
|
|||
}
|
||||
|
||||
$maintClass = ManageForeignResources::class;
|
||||
|
||||
$doMaintenancePath = RUN_MAINTENANCE_IF_MAIN;
|
||||
if ( !( file_exists( $doMaintenancePath ) &&
|
||||
realpath( $doMaintenancePath ) === realpath( "$basePath/maintenance/doMaintenance.php" ) ) ) {
|
||||
die( "Bad maintenance script location: $basePath\n" );
|
||||
}
|
||||
|
||||
require_once RUN_MAINTENANCE_IF_MAIN;
|
||||
|
|
|
@ -12,26 +12,14 @@ use TableCleanup;
|
|||
use Throwable;
|
||||
use Title;
|
||||
|
||||
// Security: Disable all stream wrappers and reenable individually as needed
|
||||
foreach ( stream_get_wrappers() as $wrapper ) {
|
||||
stream_wrapper_unregister( $wrapper );
|
||||
$IP = getenv( 'MW_INSTALL_PATH' );
|
||||
if ( $IP === false ) {
|
||||
$IP = __DIR__ . '/../../..';
|
||||
}
|
||||
|
||||
stream_wrapper_restore( 'file' );
|
||||
$basePath = getenv( 'MW_INSTALL_PATH' );
|
||||
if ( $basePath ) {
|
||||
if ( !is_dir( $basePath )
|
||||
|| strpos( $basePath, '~' ) !== false
|
||||
) {
|
||||
die( "Bad MediaWiki install path: $basePath\n" );
|
||||
}
|
||||
} else {
|
||||
$basePath = __DIR__ . '/../../..';
|
||||
}
|
||||
require_once "$basePath/maintenance/Maintenance.php";
|
||||
require_once "$IP/maintenance/Maintenance.php";
|
||||
// Autoloader isn't set up yet until we do `require_once RUN_MAINTENANCE_IF_MAIN`…
|
||||
// but our class needs to exist at that point D:
|
||||
require_once "$basePath/maintenance/TableCleanup.php";
|
||||
require_once "$IP/maintenance/TableCleanup.php";
|
||||
|
||||
class PersistRevisionThreadItems extends TableCleanup {
|
||||
|
||||
|
|
Loading…
Reference in a new issue