aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api')
-rw-r--r--includes/api/ApiBlock.php10
1 files changed, 2 insertions, 8 deletions
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php
index 22417b4c2c9f..d7f3342b5b4c 100644
--- a/includes/api/ApiBlock.php
+++ b/includes/api/ApiBlock.php
@@ -138,14 +138,8 @@ class ApiBlock extends ApiBase {
if ( $params['newblock'] ) {
$status = $this->insertBlock( $target, $params );
} else {
- // Get non-auto blocks
- // TODO: factor out to DatabaseBlockStore
- $blocks = [];
- foreach ( $this->blockStore->newListFromTarget( $target ) as $block ) {
- if ( $block->getType() !== AbstractBlock::TYPE_AUTO ) {
- $blocks[] = $block;
- }
- }
+ $blocks = $this->blockStore->newListFromTarget(
+ $target, null, false, DatabaseBlockStore::AUTO_NONE );
if ( count( $blocks ) === 0 ) {
$status = $this->insertBlock( $target, $params );
} elseif ( count( $blocks ) === 1 ) {