Skip to content

Commit e20b97a

Browse files
committed
updates/fixs to someof the abuse scripts
1 parent f49412f commit e20b97a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

bin/clean_up_abuse_headers.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
2-
include 'include/functions.inc.php';
2+
include __DIR__.'/../../../../include/functions.inc.php';
3+
include_once __DIR__.'/../src/ImapAbuseCheck.php';
34
$db = get_module_db('default');
45
$db2 = get_module_db('default');
56
$limit = 10000;
@@ -8,14 +9,14 @@
89
while ($continue == true) {
910
$start = time();
1011
echo "Grabbing Rows $offset - ".($offset+$limit);
11-
$db->query("select * from abuse left join abuse_data using (abuse_id) where abuse_id >= 440000 and abuse_headers != '' limit $offset, $limit;");
12+
$db->query("select * from abuse left join abuse_data using (abuse_id) where abuse_headers != '' limit $offset, $limit;");
1213
echo " got ".$db->num_rows()." rows";
1314
if ($db->num_rows() < $limit) {
1415
$continue = false;
1516
}
1617
$offset += $limit;
1718
while ($db->next_record(MYSQL_ASSOC)) {
18-
$out = fix_headers($db->Record['abuse_headers']);
19+
$out = ImapAbuseCheck::fix_headers($db->Record['abuse_headers']);
1920
if ($out != $db->Record['abuse_headers']) {
2021
$db2->query("update abuse_data set abuse_headers='".$db->real_escape($out)."' where abuse_id={$db->Record['abuse_id']}");
2122
//echo ".";

src/ImapAbuseCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ public static function fix_headers($headers)
533533
}
534534
}
535535
}
536-
$out = preg_replace("/\n\s*\n/m", "\n", strip_tags($out));
536+
$out = rtrim(preg_replace("/\n\s*\n/m", "\n", strip_tags($out)));
537537
return $out;
538538
}
539539
}

0 commit comments

Comments
 (0)