Merge "Rewrite pref cleanup script"
[lhc/web/wiklou.git] / maintenance / cleanupUploadStash.php
index 95bbe3d..61cd9c2 100644 (file)
@@ -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 = UploadStashCleanup::class;
 require_once RUN_MAINTENANCE_IF_MAIN;