Closed (fixed)
Project:
Ban
Version:
1.1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2026 at 08:11 UTC
Updated:
6 Aug 2026 at 11:30 UTC
Jump to comment: Most recent
Drupal 12 just got its own built-in CLI tool dr, maybe we can add support for that in Ban?
Ban could be the first Drupal contrib module with dr support, isn't that something to strive for?
Run dr and not see Ban commands listed.
Expand the Ban module to support the new dr CLI tool, so that the "Ban Drush Commands" from the project page also work with dr.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anybodyIMHO dr and drush should simply be able to use the same commands instead of implementing that twice. Does such a plan exist?
Comment #3
ressaI agree, the less overlap in the code the better, and I asked for help from @moshe weitzman in the Github issue.
Comment #6
mstrelan commentedGenerated the code with the help of an LLM.
Cspell doesn't like the word "unbans". We could ignore it, or perhaps it might prefer "un-bans".
The phpstan job is failing in the next minor job. We can fix that but it would start failing in the default job.
There is duplication with the drush command, but I don't know the best way forward.
Comment #7
mstrelan commentedTurns out we can reuse the same commands in drush by providing a drush.services.yml file. I've done this and tested both dr and drush are working.
Comment #8
anybody@mstrelan thanks! But it needs different files?
We can't simply reuse the existing https://git.drupalcode.org/project/ban/-/blob/1.1.x/src/Drush/Commands/B... ?
Comment #9
mstrelan commentedThis replaces that. Drush is on the way out eventually, we don't want to have a Drush namespace.
Comment #10
anybodyAh sorry now I got it!
IMHO let's add the "unban" term, I think it's clear and compact.
Comment #11
mstrelan commentedFWIW I just found this guide - https://www.drupal.org/docs/develop/drupal-apis/command-line-interface-c...
It suggests a different approach, but I think if this is working ok it is simpler. I'm probably out of time to work on this one now though, so if anyone else wants to get it over the line that would be great.
Comment #12
anybodyI'm totally fine with your implementation and in my eyes it's good enough. Still very good to know about the suggestion from the link!
Comment #13
ressaFantastic, thank you so much @mstrelan and @anybody, it works perfectly! I can ban an IP with
dr ban:ban 1.3.4.5, list banned IP's withdr ban:list, remove all IP's withdr ban:flush, as well as unban. I have tested both with Drush and dr and both work perfectly.PS. Perhaps we can add a note on the project page that only Ban 1.1 supports Drush commands, or release version 1.1 as stable soon? Currently you get Ban 1.0 with
composer require drupal/ban, without Drush support.Comment #14
anybody@mstrelan I'd be fine merging this and tagging a 1.1.0 release or do you see any blocker left?
#3582176: Add a performance test would be nice for confirmation regarding 1.0.0 -> 1.0.0 performance impacts, but I don't think it's a blocker?
Comment #15
anybodyI added the commands on the module page.
Comment #16
mstrelan commentedGo ahead!
Comment #17
anybodyThanks!
Comment #19
anybodySorry busy day, won't make it today to ship 1.1.0
Comment #20
anybody1.1.0 released! 🎉
Comment #21
ressaFantastic, thank you both for solving this so fast!
PS. The project page commands look not quite right ... maybe this could work better?
Comment #22
anybodyThanks @ressa sorry I fixed that - did that in a hurry. Fine now?
Comment #23
ressaThat looks much better, and great idea with a compact version, thanks @anybody!
There is a detail, though: Some aliases do not exist for
dr...Maybe just exclude aliases on the project page, since they are not crucial?
Ban Drush (
drush) & Drupal CLI (dr) Commands(Drupal CLI support from >= 1.1.0 #3606943: Add dr support in Ban)
Comment #24
anybodyThanks @ressa good points!!
Comment #25
ressaAwesome, it looks very nice now, thanks!