function botcha_install in BOTCHA Spam Prevention 7
Same name and namespace in other branches
- 6 botcha.install \botcha_install()
- 6.2 botcha.install \botcha_install()
- 6.3 botcha.install \botcha_install()
- 7.4 botcha.install \botcha_install()
- 7.2 botcha.install \botcha_install()
- 7.3 botcha.install \botcha_install()
Implementation of hook_install().
File
- ./
botcha.install, line 96
Code
function botcha_install() {
$t = get_t();
// Insert some default BOTCHA points.
$form_ids = _botcha_default_form_ids();
foreach ($form_ids as $form_id) {
$id = db_insert('botcha_points')
->fields(array(
'form_id' => $form_id,
'botcha_type' => 'default',
))
->execute();
}
$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);
// Be friendly to your users: what to do after install?
drupal_set_message($t('You can now <a href="!botcha_admin">configure BOTCHA module</a> for your site.', array(
'!botcha_admin' => url('admin/config/people/botcha'),
)), 'status');
// UNUSED
// // Explain to users that page caching may be disabled.
// if (variable_get('cache', 0) != 0) {
// 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/config/development/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));
}