On Feb 6, 2008 7:22 PM, Dave Cohen &lt;<a href="mailto:drupal@dave-cohen.com">drupal@dave-cohen.com</a>&gt; 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&#39;s concerned with the content and appearance of pages when<br>Drupal is unable to connect to the database. &nbsp;I agree with their concerns.<br>Take for example, the &quot;unable to select database&quot; page. &nbsp;This shows the<br>
database host, database name, and database username used by the site. &nbsp;It<br>also shows the Drupal logo instead of the customer&#39;s logo. &nbsp;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. &nbsp;(Although I recognize these messages are<br>appropriate when a user is an administrator installing Drupal or<br>troubleshooting, so I don&#39;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(). &nbsp;The clean approaches do not work when the database<br>cannot be reached (because the site&#39;s default theme is unknown, you can&#39;t<br>override theme_maintenance_page the normal way).<br><br>
I&#39;m thinking of following the example used by custom_url_rewrite. &nbsp;For those<br>who don&#39;t know, the custom_url_rewrite() function can be defined in<br>settings.php and if found, path.inc will make use of it. &nbsp;In my case,<br>
theme.inc&#39;s theme_maintenance_page would have code like:<br><br>if (function_exists(&#39;custom_maintenance_page&#39;)) {<br> &nbsp;$output = custom_maintenance_page($content, $messages, $partial);<br>}<br>else {<br> &nbsp;// 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>&nbsp;<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.