X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpruneFileCache.php;h=04319b33bc8c227da8f2de8ee3aa049879712892;hb=e6e932d9df9fcd2369822852c1453de2fc3d93be;hp=8e6978d5626eadb50f5b2ee431040669782c17de;hpb=bdfe02223205923d923923dd420ba0dd863cd0fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/pruneFileCache.php b/maintenance/pruneFileCache.php index 8e6978d562..04319b33bc 100644 --- a/maintenance/pruneFileCache.php +++ b/maintenance/pruneFileCache.php @@ -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' ); @@ -81,7 +81,7 @@ class PruneFileCache extends Maintenance { protected function prune_directory( $dir, $report = false ) { $tsNow = time(); $dirHandle = opendir( $dir ); - while ( false !== ( $file = readdir( $dirHandle ) ) ) { + while ( ( $file = readdir( $dirHandle ) ) !== false ) { // Skip ".", "..", and also any dirs or files like ".svn" or ".htaccess" if ( $file[0] != "." ) { $path = $dir . '/' . $file; // absolute @@ -107,5 +107,5 @@ class PruneFileCache extends Maintenance { } } -$maintClass = "PruneFileCache"; +$maintClass = PruneFileCache::class; require_once RUN_MAINTENANCE_IF_MAIN;