aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api
diff options
context:
space:
mode:
authorTim Starling <tstarling@wikimedia.org>2025-03-21 15:12:29 +1100
committerTim Starling <tstarling@wikimedia.org>2025-03-21 16:32:35 +1100
commitf80b75371cc6f9ae8d958270ef5ee9fa30ec78c3 (patch)
tree7b4cf53dfc4feca750c4a22f25ef4e708cb064ff /includes/api
parent137ed563ac8a8360ddc7a955f6d31b49849f5b30 (diff)
downloadmediawikicore-f80b75371cc6f9ae8d958270ef5ee9fa30ec78c3.tar.gz
mediawikicore-f80b75371cc6f9ae8d958270ef5ee9fa30ec78c3.zip
block: Add autoblock filtering parameters
Add $auto parameter to DatabaseBlockStore::newFromTarget and ::newListFromTarget, to help callers filter autoblocks from result lists. Change-Id: Iad92d205517eb50ab0ce5e8caae58ee761fe19d5
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 ) {