Jump to content

Feature Request: Email if board dies

Mat Barrie

Recommended Posts

Quite hard to implement I would have thought. For example the board won't run if MySQL dies so how can the board send a message to say that it is 'dead' if the code to send emails needs to get the email address from the database? On top of that, many of the mail server software systems (postfix, qmail, sendmail) often need MySQL themselves.

It is possible to specify in AdminCP what level of errors should cause emails to be sent and logs to be kept. That is a possibility: for thrid-party add-ons like hooks to be written well so that they add messages to logs when they cannot run properly.

But anything to say the board as a whole has died would need to have be implemented outside of the board, and therefore cannot really be part of the product itself.

Link to comment
Share on other sites

The ACP can still run about 80% of the time. It just depends on the MySQL error. Mail is managed by the ACP, so yes, it is possible.

Find the function that logs a MySQL error, and add a sendmail function to send it to your address. (Or just write one in php and save yourself some time.)

Link to comment
Share on other sites

rct2dotcom is right - you'd need to query the database to get the admin Email address - while in *some* cases we'd be able to still get that info (depending on the nature of the error) - it might not be possible.

What would probably be the best thing to do is make an edit yourself with a hardcoded Email like Dark Slipstream says.
That's actually a pretty simple edit. Something like this should suffice:

In ips_kernel/classDb.php - find:
else if ( $this->obj['use_error_log'] AND $this->obj['error_log'] ) {

Add below:
if ( !file_exists( $this->obj['error_log'] ) ) { mail('youremail@example.com', 'Driver Error', 'A driver error has been encountered on the forums!'); }

The if( !file_exists ... bit is to make sure that only one of these Emails gets sent out.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...