mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-27 17:40:11 +00:00
DeleteOldFancyCaptchas: Add some simple chunking to actual delete operation
Change-Id: Ia8f7dcc170a1e9a72313d72ac22ad7e6b3c97aa8
This commit is contained in:
parent
b24721bb96
commit
5876e3bd38
|
@ -79,15 +79,22 @@ class DeleteOldFancyCaptchas extends Maintenance {
|
|||
|
||||
$this->output( "$count old fancy captchas to be deleted.\n" );
|
||||
|
||||
$ret = $backend->doQuickOperations( $filesToDelete );
|
||||
$deletedCount = 0;
|
||||
foreach ( array_chunk( $filesToDelete, 1000 ) as $chunk ) {
|
||||
$ret = $backend->doQuickOperations( $chunk );
|
||||
|
||||
if ( $ret->isOK() ) {
|
||||
$this->output( "$count old fancy captchas deleted.\n" );
|
||||
} else {
|
||||
$status = Status::wrap( $ret );
|
||||
$this->output( "Deleting old captchas errored.\n" );
|
||||
$this->output( $status->getWikiText( false, false, 'en' ) );
|
||||
if ( $ret->isOK() ) {
|
||||
$chunkCount = count( $chunk );
|
||||
$this->output( "$chunkCount...\n" );
|
||||
$deletedCount += $chunkCount;
|
||||
} else {
|
||||
$status = Status::wrap( $ret );
|
||||
$this->output( "Deleting old captchas errored.\n" );
|
||||
$this->output( $status->getWikiText( false, false, 'en' ) );
|
||||
}
|
||||
}
|
||||
|
||||
$this->output( "$deletedCount old fancy captchas deleted.\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue