## @TODO make a config, to allow tweaking on bigger systems while ($counter < $total) { $limit = ' limit ' . $counter . ', ' . $batchSize; $counter += $batchSize; cl_progress(s('processed %d out of %d bounces for advanced bounce rules', $counter, $total)); $req = Sql_Query(sprintf('select * from %s as bounce, %s as umb where bounce.id = umb.bounce %s', $GLOBALS['tables']['bounce'], $GLOBALS['tables']['user_message_bounce'], $limit)); while ($row = Sql_Fetch_Array($req)) { $alive = checkLock($process_id); if ($alive) { keepLock($process_id); } else { bounceProcessError($GLOBALS['I18N']->get("Process Killed by other process")); } # cl_output(memory_get_usage()); # outputProcessBounce('User '.$row['user']); $rule = matchBounceRules($row['header'] . "\n\n" . $row['data'], $bouncerules); # outputProcessBounce('Action '.$rule['action']); # outputProcessBounce('Rule'.$rule['id']); $userdata = array(); if ($rule && is_array($rule)) { if ($row['user']) { $userdata = Sql_Fetch_Array_Query("select * from {$tables["user"]} where id = " . $row['user']); } $report_linkroot = $GLOBALS['admin_scheme'] . '://' . $GLOBALS['website'] . $GLOBALS['adminpages']; Sql_Query(sprintf('update %s set count = count + 1 where id = %d', $GLOBALS['tables']['bounceregex'], $rule['id'])); Sql_Query(sprintf('insert ignore into %s (regex,bounce) values(%d,%d)', $GLOBALS['tables']['bounceregex_bounce'], $rule['id'], $row['bounce'])); switch ($rule['action']) { case 'deleteuser': logEvent('User ' . $userdata['email'] . ' deleted by bounce rule ' . PageLink2('bouncerule&id=' . $rule['id'], $rule['id'])); $advanced_report .= 'User ' . $userdata['email'] . ' deleted by bounce rule ' . $rule['id'] . "\n"; $advanced_report .= 'User: '******'/?page=user&id=' . $userdata['id'] . "\n";
$total = $req[0]; if (isset($_GET['s'])) { $s = sprintf('%d', $_GET['s']); $e = $s + $numperrun; } else { $s = 0; $e = $numperrun; } $limit = ' limit ' . $s . ', ' . $numperrun; if ($total > $numperrun && $e < $total) { $next = '<p>' . PageLink2('checkbouncerules&s=' . $e, sprintf($GLOBALS['I18N']->get('Process Next %d'), $numperrun)) . '</p>'; } else { $next = ''; } $unmatched = 0; $matched = 0; $req = Sql_Query(sprintf('select * from %s where comment != "not processed" %s', $GLOBALS['tables']['bounce'], $limit)); while ($row = Sql_Fetch_Array($req)) { $action = matchBounceRules($row['data'], $bouncerules); if ($action) { # print $row['comment']. " Match: $action<br/>"; $matched++; } else { $unmatched++; print $GLOBALS['I18N']->get('No match') . ': ' . $row['id'] . ' ' . PageLink2("bounce&id=" . $row['id'], $row['comment']) . '<br/>'; } flush(); } print '<br/>' . $unmatched . ' ' . $GLOBALS['I18N']->get('bounces did not match any current active rule'); print '<br/>' . $matched . ' ' . $GLOBALS['I18N']->get('bounce matched current active rules'); print $next;
## @TODO make a config, to allow tweaking on bigger systems while ($counter < $total) { $limit = ' limit ' . $counter . ', ' . $batchSize; $counter += $batchSize; cl_progress(s('processed %d out of %d bounces for advanced bounce rules', $counter, $total)); $req = Sql_Query(sprintf('select * from %s as bounce, %s as umb where bounce.id = umb.bounce %s', $GLOBALS['tables']['bounce'], $GLOBALS['tables']['user_message_bounce'], $limit)); while ($row = Sql_Fetch_Array($req)) { $alive = checkLock($process_id); if ($alive) { keepLock($process_id); } else { bounceProcessError($GLOBALS['I18N']->get("Process Killed by other process")); } # cl_output(memory_get_usage()); # outputProcessBounce('User '.$row['user']); $rule = matchBounceRules($row['data'], $bouncerules); # outputProcessBounce('Action '.$rule['action']); # outputProcessBounce('Rule'.$rule['id']); $userdata = array(); if ($rule && is_array($rule)) { if ($row['user']) { $userdata = Sql_Fetch_Array_Query("select * from {$tables["user"]} where id = " . $row['user']); } $report_linkroot = $GLOBALS['admin_scheme'] . '://' . $GLOBALS['website'] . $GLOBALS['adminpages']; Sql_Query(sprintf('update %s set count = count + 1 where id = %d', $GLOBALS['tables']['bounceregex'], $rule['id'])); Sql_Query(sprintf('insert ignore into %s (regex,bounce) values(%d,%d)', $GLOBALS['tables']['bounceregex_bounce'], $rule['id'], $row['bounce'])); switch ($rule['action']) { case 'deleteuser': logEvent('User ' . $userdata['email'] . ' deleted by bounce rule ' . PageLink2('bouncerule&id=' . $rule['id'], $rule['id'])); $advanced_report .= 'User ' . $userdata['email'] . ' deleted by bounce rule ' . $rule['id'] . "\n"; $advanced_report .= 'User: '******'/?page=user&id=' . $userdata['id'] . "\n";