Yep, adding a redirect to AppController was my inclination as well.
However, the tricky part is testing for a database connection. Anyone
have any idea how best to do this? Seems like it shouldn't be very
difficult - I just don't have a grasp on the esoteric inner-workings
of the framework. Thanks!



On Dec 17, 12:29 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> It may not be the best place but I would probably put that check in my
> AppController, in the constructor or a before filter. THat way you
> have access to all of Cake and can check the connection. I don't know
> the best way to do this either but two possibilities would be either
> something like loadInfo() in a model or directly calling
> ConnectionManager::getDataSource(). You could probably make use of
> ConnectionManager from bootstrap too.
>
> I'd love to hear some other ideas that may be better suited.
>
> (my vauge answers can in part be attributed to not having any cake-app
> in front of me at the moment)
>
> On Dec 17, 6:12 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > > It's called 'write code that actually checks for errors'.  This is an
> > > issue for any application, and I cannot think of any framework that
> > > automatically gives you that kind of functionality.  What you call
> > > 'automatic' is the result of a forward-thinking developer who made a
> > > commitment to proper error handling.
>
> > Yup, true. But, how *would* you configure cake to redirect to a site
> > down page if the database connection failed?
>
> > Some code in bootstrap.php that checks for a connection and then
> > redirect to pages/site_down for example?
>
> > On Dec 17, 3:41 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> > > On Dec 17, 2007 10:28 AM, squidliberty <[EMAIL PROTECTED]> wrote:
>
> > > > I have on occasion had problems with my hosting during which MySQL is
> > > > not accessible. The result is that CakePHP renders a malformed page
> > > > and (if Debug is in use) throws a number of errors (such as "Too many
> > > > connections"). In this sort of situation, some CMS (eg. Joomla!) will
> > > > automatically throw up a "This site is down" page. Can anyone tell me
> > > > how this might be done with CakePHP? I assume that there is some way
> > > > to check for a proper database connection and generate an error
> > > > message if one cannot be established. Any advice appreciated!
>
> > > It's called 'write code that actually checks for errors'.  This is an
> > > issue for any application, and I cannot think of any framework that
> > > automatically gives you that kind of functionality.  What you call
> > > 'automatic' is the result of a forward-thinking developer who made a
> > > commitment to proper error handling.
>
> > > --
> > > Chris Hartjes
>
> > > My motto for 2007:  "Just build it, damnit!"
>
> > > @TheKeyboard -http://www.littlehart.net/atthekeyboard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to