On Feb 6, 2008 7:22 PM, Dave Cohen <<a href="mailto:drupal@dave-cohen.com">drupal@dave-cohen.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have a client who's concerned with the content and appearance of pages when<br>Drupal is unable to connect to the database. I agree with their concerns.<br>Take for example, the "unable to select database" page. This shows the<br>
database host, database name, and database username used by the site. It<br>also shows the Drupal logo instead of the customer's logo. None of these are<br>things that the public should see, even in the case of a fatal error such as<br>
not connecting to the database. (Although I recognize these messages are<br>appropriate when a user is an administrator installing Drupal or<br>troubleshooting, so I don't suggest changing them by default.)<br><br>On <a href="http://Drupal.org" target="_blank">Drupal.org</a>, there are variety of posts about how to override<br>
theme_maintenance_page(). The clean approaches do not work when the database<br>cannot be reached (because the site's default theme is unknown, you can't<br>override theme_maintenance_page the normal way).<br><br>
I'm thinking of following the example used by custom_url_rewrite. For those<br>who don't know, the custom_url_rewrite() function can be defined in<br>settings.php and if found, path.inc will make use of it. In my case,<br>
theme.inc's theme_maintenance_page would have code like:<br><br>if (function_exists('custom_maintenance_page')) {<br> $output = custom_maintenance_page($content, $messages, $partial);<br>}<br>else {<br> // Current theme_maintenance_page goes here...<br>
}<br>return $output;<br><br>My questions for this list are: is this a reasonable approach </blockquote><div><br>Yes.<br><br>This way, it can be all PHP based, without the need to access<br>the database.<br><br>And when the site is in offline mode, we need to exempt certain roles<br>
from this custom maint page, so the admin can be working on the<br>site, upgrading it or whatever.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
and would a patch to this effect make it into core?</blockquote><div><br>I think so.<br></div></div>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com">2bits.com</a>, Inc.<br><a href="http://2bits.com">http://2bits.com</a><br>
Drupal optimization, development, customization and consulting.