Switch to a working theme via the database after deleting a theme leads to WSOD
Key words and phrases
command line cli sql rescue restore theme bashTags
Description
OK, maybe there are other situations where this can come up but in this case my esteemed colleague deleted the only enabled theme. This resulted in a White Screen Of Death (WSOD). A database fix was about as fast and more what was wanted (the deletion was intentional, just not the WSOD) than rolling back to a version with that theme (called mydeadtheme here to protect the innocent).
From the command line on your test server or local development environment:
mysql -u root -pMySEcretPass
If your username and password is correct (it doesn't have to be root; in fact you can use the MySQL username and password in your settings.php or db.php file) you will be greeted with the mysql prompt, mysql>.
SHOW DATABASES;
USE drupal_mydatabasename;
SELECT name, status FROM system WHERE type='theme';
UPDATE system SET status=1 WHERE name='garland';
UPDATE system SET status=0 WHERE name='mydeadtheme';
TRUNCATE cache;
TRUNCATE cache_page;That was it. You have your site back. Not sure everything was necessary. And everything after the first command was at the mysql> prompt of course.
Then you can EXIT; to return to your shell.
