function botcha_requirements in BOTCHA Spam Prevention 7.2
Same name and namespace in other branches
- 6 botcha.install \botcha_requirements()
- 6.2 botcha.install \botcha_requirements()
- 6.3 botcha.install \botcha_requirements()
- 7 botcha.install \botcha_requirements()
- 7.3 botcha.install \botcha_requirements()
Implements hook_requirements().
File
- ./
botcha.install, line 155
Code
function botcha_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'runtime') {
// Just clean up -dev variables that were renamed
//FIXME: decrement this for release: 1
//FIXME: remove the below for release when the above is 0
if (variable_get('botcha_form_pass_counter', 0) > 0) {
variable_set('botcha_form_passed_counter', variable_get('botcha_form_passed_counter', 0) + variable_get('botcha_form_pass_counter', 0));
variable_del('botcha_form_pass_counter');
}
if (variable_get('botcha_wrong_response_counter', 0) > 0) {
variable_set('botcha_form_blocked_counter', variable_get('botcha_form_blocked_counter', 0) + variable_get('botcha_wrong_response_counter', 0));
variable_del('botcha_wrong_response_counter');
}
$block_cnt = variable_get('botcha_form_blocked_counter', 0);
$build_cnt = variable_get('botcha_form_passed_counter', 0) + $block_cnt;
// Show statistic counters in the status report.
$requirements['botcha_statistics'] = array(
'title' => $t('BOTCHA'),
'value' => format_plural($block_cnt, 'Already 1 blocked form submission', 'Already @count blocked form submissions') . ($build_cnt > 0 ? ' ' . $t('(!percent% of total !build_cnt processed)', array(
'!percent' => sprintf("%0.3f", 100 * $block_cnt / $build_cnt),
'!build_cnt' => $build_cnt,
)) : ''),
'severity' => REQUIREMENT_INFO,
);
}
return $requirements;
}