Fix cleanup function placement
- registering cleanup should go after the potential error call
This commit is contained in:
parent
e21a01dba6
commit
8ebe1aa560
|
@ -296,6 +296,8 @@ function checkWithSpamNoticer($config, $post, $boardname) {
|
||||||
print_err($body);
|
print_err($body);
|
||||||
$reasons_bitmap = json_decode($body)->reason;
|
$reasons_bitmap = json_decode($body)->reason;
|
||||||
$result->reason = renderReasons($reasons_bitmap);
|
$result->reason = renderReasons($reasons_bitmap);
|
||||||
|
} else if ($config['debug']) {
|
||||||
|
print_err((string) $response->getBody());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print_err("spamnoticer status code: " . $status_code);
|
print_err("spamnoticer status code: " . $status_code);
|
||||||
|
|
8
post.php
8
post.php
|
@ -1044,6 +1044,10 @@ function handle_post(){
|
||||||
|
|
||||||
$spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']);
|
$spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']);
|
||||||
|
|
||||||
|
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
|
||||||
|
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we have an error with posting this later, send back the
|
* If we have an error with posting this later, send back the
|
||||||
* delete token to spamnoticer to remove the post from the recent
|
* delete token to spamnoticer to remove the post from the recent
|
||||||
|
@ -1055,10 +1059,6 @@ function handle_post(){
|
||||||
|
|
||||||
push_global_post_cleanup($f_spamnoticer_cleanup_on_err);
|
push_global_post_cleanup($f_spamnoticer_cleanup_on_err);
|
||||||
|
|
||||||
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
|
|
||||||
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
$debug['time']['post']['spam_noticer'] = round((microtime(true) - $time_1) * 1000, 2) . 'ms';
|
$debug['time']['post']['spam_noticer'] = round((microtime(true) - $time_1) * 1000, 2) . 'ms';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue