} $affrows = Sql_Affected_Rows(); while ($userdata = Sql_fetch_row($userids)) { if ($num_per_batch && $sent >= $num_per_batch) { output($GLOBALS['I18N']->get('batch limit reached') . ": {$sent} ({$num_per_batch})"); $GLOBALS["wait"] = $batch_period; return; } $userid = $userdata[0]; # id of the user $some = 1; set_time_limit(120); # check if we have been "killed" $alive = checkLock($send_process_id); if ($alive) { keepLock($send_process_id); } else { ProcessError($GLOBALS['I18N']->get('Process Killed by other process')); } # check if the message we are working on is still there and in process $status = Sql_Fetch_Array_query("select id,status from {$tables['message']} where id = {$messageid}"); if (!$status['id']) { ProcessError($GLOBALS['I18N']->get('Message I was working on has disappeared')); } elseif ($status['status'] != 'inprocess') { ProcessError($GLOBALS['I18N']->get('Sending of this message has been suspended')); } flush(); # check whether the user has already received the message $um = Sql_query("select entered from {$tables['usermessage']} where userid = {$userdata['0']} and messageid = {$messageid}"); if (!Sql_Affected_Rows()) { if ($script_stage < 4) {
$email_req = Sql_Fetch_Row_Query(sprintf('select email from %s where id = %d',$tables["user"],$user[0])); $unsubscribed_users .= $email_req[0] . " [$user[0]] ($cnt)\n"; } } elseif ($bounce["bounce"] == "") { $cnt = 0; } }*/ #$alive = 1;$removed = 0; DT 051105 $cnt = 0; $alive = 1; $removed = $msgokay = $unconfirmed = $unsubscribed = 0; #while ($alive && !$removed && $bounce = Sql_Fetch_Array($msg_req)) { DT 051105 while ($alive && !$removed && !$msgokay && ($bounce = Sql_Fetch_Array($msg_req))) { $alive = checkLock($process_id); if ($alive) { keepLock($process_id); } else { bounceProcessError("Process Killed by other process"); } if (stripos($bounce['status'], 'duplicate') === false && stripos($bounce['comment'], 'duplicate') === false) { if (sprintf('%d', $bounce["bounce"]) == $bounce["bounce"]) { $cnt++; if ($cnt >= $bounce_unsubscribe_threshold) { if (!$unsubscribed) { outputProcessBounce(sprintf('unsubscribing %d -> %d bounces', $user[0], $cnt)); $userurl = PageLink2("user&id={$user['0']}", $user[0]); logEvent(s('User (url:%s) has consecutive bounces (%d) over threshold (%d), user marked unconfirmed', $userurl, $cnt, $bounce_unsubscribe_threshold)); $emailreq = Sql_Fetch_Row_Query("select email from {$tables["user"]} where id = {$user['0']}"); addUserHistory($emailreq[0], s('Auto Unconfirmed'), s('Subscriber auto unconfirmed for %d consecutive bounces', $cnt)); Sql_Query(sprintf('update %s set confirmed = 0 where id = %d', $tables["user"], $user[0])); $email_req = Sql_Fetch_Row_Query(sprintf('select email from %s where id = %d', $tables["user"], $user[0]));