Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just had an instance where I needed to clear out the {sessions} table for testing purposes on one of my sites, and was mildly surprised that there is no way to do this with drush.
Before I submit a patch for this, are there any common use cases for this? The only ones I can come up with are
$ drush help session-delete
Delete user sessions from the database.
Examples:
drush session-delete all Delete all sessions.
drush session-delete 64 Delete sessions for user id 64.
Aliases: sess-del
Is there anything else that would be handy?
Comment | File | Size | Author |
---|---|---|---|
#3 | session.patch | 2.05 KB | mpdonadio |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedMoving to drush extras as this only has niche value IMO
Comment #2
greg.1.anderson CreditAttribution: greg.1.anderson commentedYeah, I'd take this in drush_extras.
Comment #3
mpdonadioHere is an initial version. I think I tested all of the edge cases, but I didn't get a chance to test against D6 (I don't have a D6 instance that I can mess with at the moment).
I may update this in the future to add options for --uid , --ip, and maybe --timestamp, but the only thing I have ever wanted to do for test purposes was blow away all sessions or all sessions for a particular user.
Comment #4
tunicInteresting command, fixing status to get reviewed.