#!/usr/bin/php5 -q
<?php
/***************************************************************************
- * Copyright (C) 2003-2010 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
$sent_mails = 0;
$handler = time();
+/* Cleanup dead locks */
+XDB::execute('UPDATE email_list_moderate
+ SET handler = NULL
+ WHERE handler < NOW() - 300');
+
while ($sent_mails < $globals->lists->max_mail_per_min
&& time() - $handler < 60) {
// take a lock on a mail
if (XDB::affectedRows() == 0) {
break;
}
- $query = XDB::query('SELECT a.fullname, a.uid, a.password,
+ $query = XDB::query('SELECT a.full_name, a.uid, a.password,
ml.ml, ml.domain, ml.mid, ml.action, ml.message
FROM accounts AS a
INNER JOIN email_list_moderate AS ml ON (a.uid = ml.uid)