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