X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=maintenance%2FpurgeParserCache.php;h=dcd6d13deb2a61086c6382ff89ad30e74cb4816e;hb=923d8868430e670db8c47c6f994608fbe915041d;hp=e00a55d29ec18416687a4e2800b1bd03d5ce6f0a;hpb=dae4c94d893057345f62a3d498fb85c0a54de5a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/purgeParserCache.php b/maintenance/purgeParserCache.php index e00a55d29e..dcd6d13deb 100644 --- a/maintenance/purgeParserCache.php +++ b/maintenance/purgeParserCache.php @@ -24,6 +24,8 @@ require __DIR__ . '/Maintenance.php'; +use MediaWiki\MediaWikiServices; + /** * Maintenance script to remove old objects from the parser cache. * @@ -58,7 +60,7 @@ class PurgeParserCache extends Maintenance { } elseif ( $inputAge !== null ) { $date = wfTimestamp( TS_MW, time() + $wgParserCacheExpireTime - intval( $inputAge ) ); } else { - $this->error( "Must specify either --expiredate or --age", 1 ); + $this->fatalError( "Must specify either --expiredate or --age" ); return; } $this->usleep = 1e3 * $this->getOption( 'msleep', 0 ); @@ -67,10 +69,10 @@ class PurgeParserCache extends Maintenance { $this->output( "Deleting objects expiring before " . $english->timeanddate( $date ) . "\n" ); - $pc = wfGetParserCacheStorage(); + $pc = MediaWikiServices::getInstance()->getParserCache()->getCacheStorage(); $success = $pc->deleteObjectsExpiringBefore( $date, [ $this, 'showProgressAndWait' ] ); if ( !$success ) { - $this->error( "\nCannot purge this kind of parser cache.", 1 ); + $this->fatalError( "\nCannot purge this kind of parser cache." ); } $this->showProgressAndWait( 100 ); $this->output( "\nDone\n" ); @@ -91,5 +93,5 @@ class PurgeParserCache extends Maintenance { } } -$maintClass = 'PurgeParserCache'; +$maintClass = PurgeParserCache::class; require_once RUN_MAINTENANCE_IF_MAIN;