<?php
/**
 * @file
 * Install, uninstall and update functions.
 */

/**
 * Implements hook_install().
 */
function bassets_setup_install() {
  if (module_exists('bassets_client')) {
    // The 'setup_enabled' variable needs to be set to FALSE or
    // we can not use a different path.
    variable_set('setup_enabled', FALSE);

    // The 'setup_source' variable needs to be set to the relevant source,
    // so the knows which module wants the setup under example.com/setup.
    variable_set('setup_source', 'module-bassets_setup');
  }
}

/**
 * Clears the menu cache.
 *
 * Sets setup_source to empty string in case bassets_client is not installed.
 *
 * @see hook_update_N()
 */
function bassets_setup_update_7001() {
  menu_cache_clear_all();
  if (!module_exists('bassets_client')) {
    $source = variable_get('setup_source', '');
    if ($source == 'module-bassets_setup') {
      variable_set('setup_source', '');
    }
  }
}
