X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FpruneFileCache.php;h=74298cb9ee2f3129c468b767083749030839098b;hb=11ee7f78da9776db26098642a151a288f98bea14;hp=455e9c07c935cc0265d9a81d17fd9a8e00e42db6;hpb=27f8aa732e55f0655255152fa22655fa07424c2d;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/pruneFileCache.php b/maintenance/pruneFileCache.php index 455e9c07c9..74298cb9ee 100644 --- a/maintenance/pruneFileCache.php +++ b/maintenance/pruneFileCache.php @@ -34,7 +34,7 @@ class PruneFileCache extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Build file cache for content pages"; + $this->addDescription( 'Build file cache for content pages' ); $this->addOption( 'agedays', 'How many days old files must be in order to delete', true, true ); $this->addOption( 'subdir', 'Prune one $wgFileCacheDirectory subdirectory name', false, true ); } @@ -43,25 +43,25 @@ class PruneFileCache extends Maintenance { global $wgUseFileCache, $wgFileCacheDirectory; if ( !$wgUseFileCache ) { - $this->error( "Nothing to do -- \$wgUseFileCache is disabled.", true ); + $this->fatalError( "Nothing to do -- \$wgUseFileCache is disabled." ); } $age = $this->getOption( 'agedays' ); if ( !ctype_digit( $age ) ) { - $this->error( "Non-integer 'age' parameter given.", true ); + $this->fatalError( "Non-integer 'age' parameter given." ); } // Delete items with a TS older than this $this->minSurviveTimestamp = time() - ( 86400 * $age ); $dir = $wgFileCacheDirectory; if ( !is_dir( $dir ) ) { - $this->error( "Nothing to do -- \$wgFileCacheDirectory directory not found.", true ); + $this->fatalError( "Nothing to do -- \$wgFileCacheDirectory directory not found." ); } $subDir = $this->getOption( 'subdir' ); if ( $subDir !== null ) { if ( !is_dir( "$dir/$subDir" ) ) { - $this->error( "The specified subdirectory `$subDir` does not exist.", true ); + $this->fatalError( "The specified subdirectory `$subDir` does not exist." ); } $this->output( "Pruning `$dir/$subDir` directory...\n" ); $this->prune_directory( "$dir/$subDir", 'report' ); @@ -107,5 +107,5 @@ class PruneFileCache extends Maintenance { } } -$maintClass = "PruneFileCache"; +$maintClass = PruneFileCache::class; require_once RUN_MAINTENANCE_IF_MAIN;