Graceful handling of missing plugins

15 views
Skip to first unread message

Andrew Godziuk

unread,
Jan 26, 2010, 9:34:08 AM1/26/10
to joomla-...@googlegroups.com
Hi,

I'd like to try to write a patch to Joomla core so it doesn't die with
fatal error when it can't include a plugin file (in other words:
plugin exists in DB but filesystem entry is deleted).

Do you have any thoughts on how to notify administrator about the
problem, when such condition happens? The most strightforward solution
- sending an email every time - may kill his mailbox on a high traffic
website, and I'm open to better suggestions. I'm asking here because I
intend to submit the patch to bug tracker, if I succeed to make it.

--
Andrzej Godziuk
http://CloudAccess.net/

Ian MacLennan

unread,
Jan 26, 2010, 9:46:07 AM1/26/10
to joomla-...@googlegroups.com
Interesting idea.

If the plugin file doesn't exist, perhaps you could send a system email and then disable the plugin in the database.  This would prevent multiple emails.

Ian


--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.


Andrew Godziuk

unread,
Jan 26, 2010, 10:09:54 AM1/26/10
to joomla-...@googlegroups.com
On Tue, Jan 26, 2010 at 3:46 PM, Ian MacLennan <ian.ma...@joomla.org> wrote:
> Interesting idea.

Our support people deal with this problem all the time.

>
> If the plugin file doesn't exist, perhaps you could send a system email and
> then disable the plugin in the database.  This would prevent multiple
> emails.

This looks like a good solution, thanks!

Louis Landry

unread,
Jan 26, 2010, 4:53:23 PM1/26/10
to joomla-...@googlegroups.com
Yep... that sounds like a good idea Ian.

Let us know when you have something to submit Andrew.

- Louis

Andrzej Godziuk
http://CloudAccess.net/

--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.




--
Development Coordinator
Joomla! ... because open source matters.
http://www.joomla.org

Christopher Garvis

unread,
Jan 26, 2010, 5:28:58 PM1/26/10
to Joomla! CMS Development
I think this bring up a bigger issue, tracking of system events. The
problem is that even if an error happens, how can the administrator be
notified of that error and get helpful system information about it.
We all have had the situation where a user tell us that they are
"getting an error" but they can't remember what they did, thus we
can't replicate the error. It would be nice to have something that
integrated with JError and logged all system notifications,warnings,
and errors along with the user's session state. Once there is a
location for all this information, it would be easy to extended and
configured to notifying administrators either by email or via
notifications when they logged in. Drupal has something similar
called Watchdog.

On Jan 26, 4:53 pm, Louis Landry <louis.lan...@joomla.org> wrote:
> Yep... that sounds like a good idea Ian.
>
> Let us know when you have something to submit Andrew.
>
> - Louis
>
> On Tue, Jan 26, 2010 at 9:09 AM, Andrew Godziuk <and...@cloudaccess.net>wrote:
>
>
>

> > On Tue, Jan 26, 2010 at 3:46 PM, Ian MacLennan <ian.maclen...@joomla.org>


> > wrote:
> > > Interesting idea.
>
> > Our support people deal with this problem all the time.
>
> > > If the plugin file doesn't exist, perhaps you could send a system email
> > and
> > > then disable the plugin in the database.  This would prevent multiple
> > > emails.
>
> > This looks like a good solution, thanks!
>
> > --
> > Andrzej Godziuk
> >http://CloudAccess.net/
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Joomla! CMS Development" group.
> > To post to this group, send an email to joomla-...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > joomla-dev-cm...@googlegroups.com<joomla-dev-cms%2Bunsu...@googlegroups.com>

Hannes Papenberg

unread,
Jan 27, 2010, 3:21:57 AM1/27/10
to joomla-...@googlegroups.com
One of the things that I want to do for 1.7 is rewriting JLog and
provide a few logging levels, like notices, warnings and fatal errors,
which are then stored in the database or similar stuff. This would have
to be implemented everywhere throughout Joomla, which makes it to much
work for 1.6. But maybe we can get this and JError implemented
everywhere in 1.7.

Hannes

Nicholas H

unread,
Jan 27, 2010, 4:00:26 AM1/27/10
to Joomla! CMS Development
I do like with vbulletin, where there is a database error, it will
send an email of the issue with information.

With 1.5 when you turn on debug, it will stop and show you the email,
it would be nice to fire an email off when ever an error happens with
what ever information you can get.

Andrew Godziuk

unread,
Jan 28, 2010, 2:09:54 PM1/28/10
to joomla-...@googlegroups.com
I have the main logic working. It looks like in PHP it's not possible
to gracefuly handle fatal/parse errors, so I registered a shutdown
handler instead. Before 5.0.3 there used to be a function that could
do it, but not anymore.

It handles fatal errors using JError::raise(), but this method fails
for parse errors.

Fatal error (missing function):
http://img.nopaste.pl/upload/jplugin-fatal-error_4b61dfc5b28cf.png

Parse error:
http://img.nopaste.pl/upload/jplugin-parse-error_4b61dff3bc4a9.png

Two questions to the community:
- Should I leave it as is, or disable plugin and silently reload the
page? Of course, I would still send the email.
- How do I unregister a plugin nicely? Usually I would do a SQL query,
but maybe it's a good moment to learn something? I couldn't find
anything like JPlugin::disable() but maybe there is other nice way to
do it?

Andrew Godziuk

unread,
Jan 29, 2010, 5:06:51 AM1/29/10
to joomla-...@googlegroups.com
Okay, this is how I made it:
- When debug in Global Configuration is disabled, try to handle it
gracefuly. On failure, disable plugin, send email to admins, reload
page.
- When debug is enabled, display a Joomla error and don't disable
plugin. Auto-disabling could be annoying for plugin developers.
- In case disabling fails, display error message instead of reloading page.

I'm attaching a patch, it may not meet all Joomla code standards, I
didn't check it for this yet. One thing that certainly does not meet
standards is comments.

Please let know what do you think about it.

helper.php.patch
Reply all
Reply to author
Forward
0 new messages