X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=maintenance%2Fstorage%2FtrackBlobs.php;h=fbcc5bc2ef86ed9d19f6a802c1c121eb2147482b;hb=4b8c7b7cd059b94203cb3911a01dc0a9b8a4b7bc;hp=0f25fb94973674b2a2625722c35fd925942d2369;hpb=526ed39e6499a32a597e1b28e96ada2d2d2e8c1a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/storage/trackBlobs.php b/maintenance/storage/trackBlobs.php index 0f25fb9497..fbcc5bc2ef 100644 --- a/maintenance/storage/trackBlobs.php +++ b/maintenance/storage/trackBlobs.php @@ -300,6 +300,7 @@ class TrackBlobs { // Traverse the orphan list $insertBatch = array(); $id = 0; + $numOrphans = 0; while ( true ) { $id = gmp_scan1( $orphans, $id ); if ( $id == -1 ) { @@ -309,12 +310,18 @@ class TrackBlobs { 'bo_cluster' => $cluster, 'bo_blob_id' => $id ); + if ( count( $insertBatch ) > $this->batchSize ) { + $dbw->insert( 'blob_orphans', $insertBatch, __METHOD__ ); + $insertBatch = array(); + } + ++$id; + ++$numOrphans; } - - // Insert the batch - echo "Found " . count( $insertBatch ) . " orphan(s) in $cluster\n"; - $dbw->insert( 'blob_orphans', $insertBatch, __METHOD__ ); + if ( $insertBatch ) { + $dbw->insert( 'blob_orphans', $insertBatch, __METHOD__ ); + } + echo "Found $numOrphans orphan(s) in $cluster\n"; } } }