X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcleanupUploadStash.php;h=d255348374b38efef227ac3c5188c9a3039aebb7;hb=9d7a2a625193e8e1c767629e3d01da72c3e8712d;hp=cd7a8420f9c5daeb1907b8cf40c9aa84a363920c;hpb=44947af94a2dc322e470c18f071d018bb4e1a21e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupUploadStash.php b/maintenance/cleanupUploadStash.php index cd7a8420f9..d255348374 100644 --- a/maintenance/cleanupUploadStash.php +++ b/maintenance/cleanupUploadStash.php @@ -33,7 +33,7 @@ require_once __DIR__ . '/Maintenance.php'; * * @ingroup Maintenance */ -class UploadStashCleanup extends Maintenance { +class CleanupUploadStash extends Maintenance { public function __construct() { parent::__construct(); @@ -47,7 +47,7 @@ class UploadStashCleanup extends Maintenance { $repo = RepoGroup::singleton()->getLocalRepo(); $tempRepo = $repo->getTempRepo(); - $dbr = $repo->getSlaveDB(); + $dbr = $repo->getReplicaDB(); // how far back should this look for files to delete? $cutoff = time() - $wgUploadStashMaxAge; @@ -103,7 +103,7 @@ class UploadStashCleanup extends Maintenance { foreach ( $iterator as $file ) { if ( wfTimestamp( TS_UNIX, $tempRepo->getFileTimestamp( "$dir/$file" ) ) < $cutoff ) { $batch[] = [ 'op' => 'delete', 'src' => "$dir/$file" ]; - if ( count( $batch ) >= $this->mBatchSize ) { + if ( count( $batch ) >= $this->getBatchSize() ) { $this->doOperations( $tempRepo, $batch ); $i += count( $batch ); $batch = []; @@ -122,14 +122,14 @@ class UploadStashCleanup extends Maintenance { $iterator = $tempRepo->getBackend()->getFileList( [ 'dir' => $dir, 'adviseStat' => 1 ] ); $this->output( "Deleting orphaned temp files...\n" ); if ( strpos( $dir, '/local-temp' ) === false ) { // sanity check - $this->error( "Temp repo is not using the temp container.", 1 ); // die + $this->fatalError( "Temp repo is not using the temp container." ); } $i = 0; $batch = []; // operation batch foreach ( $iterator as $file ) { if ( wfTimestamp( TS_UNIX, $tempRepo->getFileTimestamp( "$dir/$file" ) ) < $cutoff ) { $batch[] = [ 'op' => 'delete', 'src' => "$dir/$file" ]; - if ( count( $batch ) >= $this->mBatchSize ) { + if ( count( $batch ) >= $this->getBatchSize() ) { $this->doOperations( $tempRepo, $batch ); $i += count( $batch ); $batch = []; @@ -152,5 +152,5 @@ class UploadStashCleanup extends Maintenance { } } -$maintClass = "UploadStashCleanup"; +$maintClass = CleanupUploadStash::class; require_once RUN_MAINTENANCE_IF_MAIN;