At the moment the tool deleteBatch.php only works with page titles, with namespace.
Working with page titles is a significant obstacle for any database administrator who wants to use deleteBatch.php to cleanup a MediaWiki database. In fact, the database has no perception of namespace names, since namespace names are stored in PHP files, not in the database.
As solution, I usually fork that maintenance script to provide a --by-id flag. So I can have a similar easy workflow:
mysql wiki <<< "SELECT pageid ... WHERE ... = 'spam'" | ./deleteBatch.php --by-id
This --by-id flag (or anything similar - please propose) dramatically simplifies queries since you don't have to create super-enormous SQL if/switch-cases to match the namespace number and return the correct canonical namespace name, especially when you are looking for inter-namespace spam, and so, you are not just working on a specific namespace.
Maybe this is something that could be added upstream. And, I'm quite sure, that this may be a good first task. It's just a matter of:
- deciding a nice flag name - for instance - --by-id
- write 5-10 PHP lines