X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpurgeParserCache.php;h=716be3aab2b7fcc577687e928b56a016ee5ce8c9;hb=3d95da4952619f9f773298c4461ccfc646fb18a9;hp=e00a55d29ec18416687a4e2800b1bd03d5ce6f0a;hpb=e968a1f431ad058dcb14adb2757bde5664b99a79;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/purgeParserCache.php b/maintenance/purgeParserCache.php index e00a55d29e..716be3aab2 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" );