I came up with something a little safer and easier for those who just want
to delete old revisions from one namespace:
https://www.mediawiki.org/
wiki/User:KryptoKronic/deleteOldRevisions.php
The output looks like this:
$ php deleteOldRevisions.php --delete 4
Delete old revisions
Limiting to namespaces 4
Limiting to page IDs 4,2
Limiting to page titles Project:Bar,Project:Foo
Searching for active revisions...done.
Searching for inactive revisions...done.
3 old revisions found.
Abort with control-c in the next five seconds (skip this countdown with
--quick) ... 0
Deleting...done.
Searching for active text records in revisions table...done.
Searching for active text records in archive table...done.
Searching for inactive text records...done.
3 inactive items found.
Deleting...done.