Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

how to send errors to email and resync mysql DB?

Quote Reply
how to send errors to email and resync mysql DB?
Hi, I was wondering if anybody knows how to:

A) resync the mysql tables for a LSQL database from time to time. Is there a build-in function that does this?

B) how can LSQL send a single email to the administrator if there is a connectivity issue/problem between it and MYSQL or any other error that prevents a build from executing - basically to pipe any <%error%> to an email address...
Quote Reply
Re: [scorpioncapital] how to send errors to email and resync mysql DB? In reply to
Hi.

1) perl nph-build.cgi --repair

2) You would probably need to edit /admin/Links.pm, &fatal().

Hope that helps :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] how to send errors to email and resync mysql DB? In reply to
In the setup under MISC there is a custom error handler field. I believe this is a standard HTML page. Is it possible to have a PHP code in this file that pipes it to an email?

e.g. <?php send (<%error%>) to email address ?>

the only problem, how can a LSQL tag be resolved within a PHP tag - I bet you a billion bucks its impossible :)
Quote Reply
Re: [scorpioncapital] how to send errors to email and resync mysql DB? In reply to
You would be better off editing /admin/Links.pm, about line 409;

Just below the following;

Code:
my $msg = shift;
my $debug = defined $CFG->{debug_level} ? $CFG->{debug_level} : $DEBUG;

$IN ||= new GT::CGI;
print $IN->header();

... you need to add a GT::Mail call, so it sends you an email :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] how to send errors to email and resync mysql DB? In reply to
Maybe, I suspect though that it may send an email everytime somebody 'touches' the error...

I am thinking though since GT::Mail is a function probably it can be called either 1) direct from the template or 2) a global can be written where the input argument is $error, the error msg..
Quote Reply
Re: [scorpioncapital] how to send errors to email and resync mysql DB? In reply to
Is there a way to write a cgi script that prints out the debug level error messages and environment in the case that you CANNOT get into the admin, i.e. the admin is crashed somehow?
Quote Reply
Re: [scorpioncapital] how to send errors to email and resync mysql DB? In reply to
The best you could probably do is just set a cookie on the users PC before the mailing function. i.e;

Code:
my $chk = check if cookie exists;
if ($chk) {
#yes
# dont email
} else {
# no it doesn't exist, so send an email...
# set a cookie here,
}

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!