9 Dec 16:26
ver. 2.10.10 - error handling in processqueue.php
Alberto Granzotto <agranzot <at> gmail.com>
2009-12-09 15:26:42 GMT
2009-12-09 15:26:42 GMT
PHPList version: 2.10.10
PHP version: 5
Hosting: tophost.it
I had a problem sending a message, after pressing "Process Queue" I had
a lot of "MySQL server has gone away" errors.
I have took a look to [b]processqueue.php[/b], the common pattern in
errors handling is:
$userids = Sql_query($query);
if (Sql_Has_Error($database_connection)) {
ProcessError(Sql_Error($database_connection)); }
More or less:
* do the query;
* if some error happens, do ProcessError (which [b]exits[/b] from the
script).
Sql_Has_Error w/ ProcessError are not used -- as far as I can see, and
only in the "sending loop" -- in those lines:
528: $userids = Sql_Query(sprintf('select * from %s where id =
0',$tables["user"]));
559: $um = Sql_query("select entered from {$tables['usermessage']} where
userid = $userdata[0] and messageid = $messageid");
564: $users = Sql_query("select
id,email,uniqid,htmlemail,rssfrequency,confirmed,blacklisted from
{$tables['user']} where id = $userid");
654: $um = Sql_query("replace into {$tables['usermessage']}
(entered,userid,messageid,status)
values(now(),$userid,$messageid,\"sent\")");
657: $status = Sql_query("update {$tables['rssitem']} set processed =
processed +1 where id = $rssitemid");
658: $um = Sql_query("replace into {$tables['rssitem_user']}
(userid,itemid) values($userid,$rssitemid)");
660: Sql_Query("replace into {$tables["user_rss"]} (userid,last)
values($userid,date_sub(now(),interval 15 minute))");
673: Sql_Query(sprintf('update %s set confirmed = 0 where email = "%s"',
$GLOBALS['tables']['user'],$useremail));
715: $um = Sql_query("replace into {$tables['usermessage']}
(entered,userid,messageid,status) values(now(),$userid,$messageid,\"not
sent\")");
737: $um = Sql_query("replace into {$tables['usermessage']}
(entered,userid,messageid,status)
values(now(),$userid,$messageid,\"unconfirmed user\")");
745: $um = Sql_query("replace into {$tables['usermessage']}
(entered,userid,messageid,status)
values(now(),$userid,$messageid,\"invalid email\")");
760: $status = Sql_query("update {$tables['message']} set processed =
processed +1 where id = $messageid");
792: Sql_Query(sprintf('insert ignore into %s (name,id,data)
values("end_notified",%d,now())',
$GLOBALS['tables']['messagedata'],$messageid));
795: $timetaken = Sql_Fetch_Row_query("select sent,sendstart from
{$tables['message']} where id = \"$messageid\"");
So, afaik, if a connection problem occurs during the main loop,
nothing calls ProcessError and so the script goes on printing ADO errors
using the function Sql_Error. I don't think this is the right behaviour,
I think the script must exits with an error code.
thank you,
vrde
P.S.: sometimes the function Sql_affected_rows() is used, other times
Sql_Affected_Rows() (with different "case"), why?
--
--
Alberto Granzotto
Caro Candidato @ LinuxDay 2009
http://vrde.wordpress.com/
_______________________________________________
Phplist-developers mailing list
Phplist-developers <at> tincan.co.uk
http://mail.tincan.co.uk/mailman/listinfo/phplist-developers
RSS Feed