function botcha_install in BOTCHA Spam Prevention 6
Same name and namespace in other branches
- 6.2 botcha.install \botcha_install()
- 6.3 botcha.install \botcha_install()
- 7.4 botcha.install \botcha_install()
- 7 botcha.install \botcha_install()
- 7.2 botcha.install \botcha_install()
- 7.3 botcha.install \botcha_install()
Implementation of hook_install().
File
- ./
botcha.install, line 93
Code
function botcha_install() {
$t = get_t();
drupal_install_schema('botcha');
// Insert some default BOTCHA points.
$form_ids = _botcha_default_form_ids();
foreach ($form_ids as $form_id) {
db_query("INSERT INTO {botcha_points} (form_id, botcha_type) VALUES ('%s', 'default')", $form_id);
}
$i18n_variables = variable_get('i18n_variables', '');
if (!is_array($i18n_variables)) {
$i18n_variables = array();
}
$i18n_variables = array_merge($i18n_variables, _botcha_variables(TRUE));
variable_set('i18n_variables', $i18n_variables);
// Explain to users that page caching may be disabled.
if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) {
drupal_set_message($t('Note that BOTCHA module disables <a href="!performance_admin">page caching</a> of pages that include forms processed by BOTCHA. ', array(
'!performance_admin' => url('admin/settings/performance'),
)), 'warning');
}
// Generate unique secret for this site
variable_set('botcha_secret', md5(uniqid(mt_rand(), TRUE)));
// Ensure statistics variables exist
variable_set('botcha_form_passed_counter', variable_get('botcha_form_passed_counter', 0));
variable_set('botcha_form_blocked_counter', variable_get('botcha_form_blocked_counter', 0));
}