You are here

function botcha_install in BOTCHA Spam Prevention 7.2

Same name and namespace in other branches
  1. 6 botcha.install \botcha_install()
  2. 6.2 botcha.install \botcha_install()
  3. 6.3 botcha.install \botcha_install()
  4. 7.4 botcha.install \botcha_install()
  5. 7 botcha.install \botcha_install()
  6. 7.3 botcha.install \botcha_install()

Implements of hook_install().

File

./botcha.install, line 211

Code

function botcha_install() {
  $t = get_t();
  $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(Botcha::BOTCHA_ADMIN_PATH),
  )), 'status');

  // 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));

  // DRY: Re-use once written.
  botcha_update_7200();
  botcha_update_7201();

  // Clear the cache to get updates to menu router and themes.
  cache_clear_all();
}