You are here

function ed_classified_install in Classified Ads 7.2

Same name and namespace in other branches
  1. 5.2 ed_classified.install \ed_classified_install()
  2. 5 ed_classified.install \ed_classified_install()
  3. 6.2 ed_classified.install \ed_classified_install()

File

./ed_classified.install, line 15

Code

function ed_classified_install() {
  $DRUPAL_VERSION = variable_get('ed_classified_drupal_version', 'UNKNOWN');
  if ('UNKNOWN' == $DRUPAL_VERSION) {
    if (defined('VERSION')) {
      drupal_set_message(t("!module: recording Drupal version as '!version.'", array(
        '!module' => EDI_CLASSIFIED_MODULE_NAME,
        '!version' => VERSION,
      )));
      variable_set('ed_classified_drupal_version', $DRUPAL_VERSION = VERSION);
    }
    else {
      if (!empty($theme_info) && !empty($theme_info->info)) {
        $DRUPAL_VERSION = $theme_info->info['core'];
        drupal_set_message(t("!module: detected Drupal version is '!version' (recording).", array(
          '!module' => EDI_CLASSIFIED_MODULE_NAME,
          '!version' => $DRUPAL_VERSION,
        )));
        variable_set('ed_classified_drupal_version', $DRUPAL_VERSION);
      }
      else {
        $msg = t('!module: failed to detect Drupal version during installation (aborting install).', array(
          '!module' => EDI_CLASSIFIED_MODULE_NAME,
        ));
        drupal_set_message($msg);
        watchdog($msg);
        return;

        // Give up
      }
    }
  }
  switch (reset(explode('.', $DRUPAL_VERSION))) {
    case 5:
      ed_classified_schema_drupal5();
      break;
    case 6:
    case 7:
      drupal_install_schema(EDI_CLASSIFIED_MODULE_NAME);
      break;
    default:
      break;
  }

  //ed_classified_init_taxonomy();

  // By requesting the vid the taxonomy will be automatically created and associated
  _ed_classified_get_vid();
}