User login

Switch to a working theme via the database after deleting a theme leads to WSOD

Searched words: 
command line cli sql rescue restore theme bash

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.

Resolution

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.