pruneUnusedLinkTargetRows: Avoid deletion if there is nothing to delete
Otherwise it fatals when it tries to select with empty array. Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field lt_id Follow up to I59fd88368e8 Change-Id: Ifc989b6527777a73bda9922006ea7cea2c4c0331
This commit is contained in:
parent
55be741486
commit
a9256d73fc
1 changed files with 8 additions and 0 deletions
|
|
@ -58,6 +58,10 @@ class PruneUnusedLinkTargetRows extends Maintenance {
|
|||
] );
|
||||
}
|
||||
$ltIdsToDelete = $queryBuilder->caller( __METHOD__ )->fetchFieldValues();
|
||||
if ( !$ltIdsToDelete ) {
|
||||
$ltCounter += $this->getBatchSize();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Run against primary as well with a faster query plan, just to be safe.
|
||||
// Also having a bit of time in between helps in cases of immediate removal and insertion of use.
|
||||
|
|
@ -74,6 +78,10 @@ class PruneUnusedLinkTargetRows extends Maintenance {
|
|||
] );
|
||||
}
|
||||
$ltIdsToDelete = $queryBuilder->caller( __METHOD__ )->fetchFieldValues();
|
||||
if ( !$ltIdsToDelete ) {
|
||||
$ltCounter += $this->getBatchSize();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !$this->getOption( 'dry' ) ) {
|
||||
$dbw->delete( 'linktarget', $ltIdsToDelete, __METHOD__ );
|
||||
|
|
|
|||
Loading…
Reference in a new issue