List Info

Thread: override theme_maintenance_page




override theme_maintenance_page
country flaguser name
United States
2008-02-06 18:22:12
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 and would a 
patch to this effect make it into core?

Thanks,

-Dave

Re: override theme_maintenance_page
user name
2008-02-06 18:39:20
On Feb 6, 2008 7:22 PM, Dave Cohen < drupaldave-cohen.com">drupaldave-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&quot; 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&#39;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.
Re: override theme_maintenance_page
user name
2008-02-06 18:47:01
On Feb 6, 2008 10:22 PM, Dave Cohen <drupaldave-cohen.com> wrote:
> My questions for this list are: is this a reasonable
approach and would a
> patch to this effect make it into core?
>

I believe it's already been fixed for Drupal6 - http://drupal.org/node/
141727

I guess it's up to Drumm whether or not something similar
would be
worthwhile to be added to D5 (I imagine not).

Regards,
Greg


-- 
Greg Knaddison
Denver, CO | http://knaddison.com
World Spanish Tour | http://wanderlusti
ng.org/user/greg

Re: override theme_maintenance_page
country flaguser name
United States
2008-02-07 06:45:38
Quoting Khalid Baheyeldin <kb2bits.com>:

>
>> and would a patch to this effect make it into
core?
>

http://d
rupal.org/node/141727#comment-644522

Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.
com/


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )