<?php

/**
* @file
* Install, update and uninstall functions for the logintoboggan module.
*/

/**
 * Implement hook_update_last_removed().
 */
function logintoboggan_update_last_removed() {
  return 6001;
}

/**
 * Implement hook_disable().
 *
 */
function logintoboggan_disable() {
  // Clean up the custom access denied path if it's set.
  if (variable_get('site_403', '') == 'toboggan/denied') {
    variable_set('site_403', '');
  }
}

/**
 * Remove hardcoded numeric deltas from blocks.
 */
function logintoboggan_update_7000(&$sandbox) {
  // Get an array of the renamed block deltas, organized by module.
  $renamed_deltas = array(
    'logintoboggan' => array(
      '0' => 'logintoboggan_logged_in',
    ),
  );

  update_fix_d7_block_deltas($sandbox, $renamed_deltas);
}

/**
 * Implement hook_uninstall().
 */
function logintoboggan_uninstall() {
  $variables = array(
    'logintoboggan_login_block_type',
    'logintoboggan_login_block_message',
    'logintoboggan_login_with_email',
    'logintoboggan_confirm_email_at_registration',
    'logintoboggan_pre_auth_role',
    'logintoboggan_purge_unvalidated_user_interval',
    'logintoboggan_redirect_on_register',
    'logintoboggan_redirect_on_confirm',
    'logintoboggan_login_successful_message',
    'logintoboggan_minimum_password_length',
    'logintoboggan_immediate_login_on_register',
    'logintoboggan_override_destination_parameter',
    'logintoboggan_denied_remove_sidebars',
  );
  foreach ($variables as $variable) {
  	variable_del($variable);
  }
}
