So where are these files on your site? I mean, which one is your site? :)

I agree with you, hacks should be avoided whenever possible. But if you are
looking for a way to check DB connection (which in Brad's case is an every
time check) then going first through a Have All controller seems like a lot
of overhead. Also you have the problem of having to update this controller
whenever you add a new model to your application.

I personally don't use this checking but someone may need them.

Furthermore, if he is willing to ship a base cake installation with this DB
checking embedded (until cake provides an easy way for it) then the
index.php check based approach is transparent to end cake users, while
having a catch-all controller is not.

I believe there are different ways to achieve this checking. Right on this
post you can see another way at thinkingphp.org, and yours seems like other
way. In the end, it is a give or take. :)

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!


-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de AD7six
Enviado el: Jueves, 30 de Noviembre de 2006 04:58 a.m.
Para: Cake PHP
Asunto: Re: Catching DB connection failure


Hi All,

I think it would be worth your time to investigate using an AppError
class. In this way there's no hacks, you can just override what happens
when there is no connection or no table etc. To check the existance of
all resources - just include all of them in a controller, if all
tables, helpers, components etc. exist - there will be no error,
otherwise the appError <relavent method> is triggered. So the code in
the "check everything's present" controller, which has all models
components and helpers inlcuded, the index method would just be
{redirect->(/);}.

I recently updated most of the downloadable plugins on my site to
handle missing connections tables, and 3rd party code to display an
error message of my choice from within the plugin. In the case of
missing tables, the needed SQL is displayed, to extend this to allow
the user to run the SQL wouldn't be difficult. Still WIP, but if you
want something to go with have a look at the code for any of the demos
(except the blog, as that's next on the list).


--~--~---------~--~----~------------~-------~--~----~
 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