When I follow the directions for "Theming the maintenance page" (http://drupal.org/node/195435) and set $conf['maintenance_theme'] = 'zen'; in my settings.php, then set my site 'offline' through the maintenance admin page, everything works fine.

But when I turn my database off to simulate DB failure (as suggested in the doc), I get a bunch of SQL warnings, like this:
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /x/x/x/includes/database.mysql.inc on line 321

I can't tell for sure, but is Zen creating these? Or is it something else I did? I haven't hacked anything.

BTW, if I set $conf['maintenance_theme'] = 'minnelli'; in settings.php, no SQL warnings appear.

Files: 
CommentFileSizeAuthor
#2 zen-6.x-1.0-hook_theme_fix.patch728 bytestayzlor

Comments

tayzlor’s picture

I'm seeing this behaviour too, definitely a problem with Zen.
As a test, i copied maintenance.tpl.php into bluemarine and no php warnings showed up at the top of the maintenance page with that theme.

tayzlor’s picture

Title:Using Zen for Override Maintenance Theme» hook_theme implementation causes Zen to not work when you override Maintenance Theme
Version:6.x-1.0-beta2» 6.x-1.x-dev
Category:support» bug
Status:Active» Needs review
StatusFileSize
new728 bytes

in the hook_theme() function for zen, theme is trying to query the database, resulting in php warnings on the maintenance page when the database is down.
provided patch to check if db is active or maintenance page is up.

thanks
graham.

JohnAlbin’s picture

Sweet! I love patches. I'll review this weekend if no others get to it first. :-)

yoroy’s picture

Gentle bump :-)

JohnAlbin’s picture

mr.baileys’s picture

Marked #317409: not considering possible missing database connection: drupal_get_path('theme', 'zen') as a duplicate of this one since this one contains a patch.

JohnAlbin’s picture

Title:hook_theme implementation causes Zen to not work when you override Maintenance Theme» hook_theme implementation breaks maintenance page when database is down
Status:Needs review» Fixed

The patch in #2 doesn't work. With it, I get a multiple warnings when rebuilding the theme registry.

I've committed a simpler patch.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.