function tripal_core_get_chado_version

2.x tripal_core.DEPRECATED.api.inc tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FALSE)
3.x tripal_core.DEPRECATED.inc tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FALSE)
1.x tripal_core_chado.api.inc tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FALSE)

Returns the version number of the currently installed Chado instance. It can return the real or effective version.

@returns The version of Chado

Parameters

$exact: Set this argument to 1 to retrieve the exact version that is installed. Otherwise, this function will set the version to the nearest 'tenth'. Chado versioning numbers in the hundreds represent changes to the software and not the schema. Changes in the tenth's represent changes in the schema.

$warn_if_unsupported: If the currently installed version of Chado is not supported by Tripal the generatea a Drupal warning.

Related topics

5 calls to tripal_core_get_chado_version()
drush_tripal_core_tripal_chado_version in tripal_core/tripal_core.drush.inc
Returns the current version of chado
tripal_core_chado_get_foreign_key in tripal_core/api/tripal_core_chado.api.inc
Gets the value of a foreign key relationship
tripal_core_chado_load_form in tripal_core/includes/chado_install.inc
Load Chado Schema Form
tripal_core_get_chado_tables in tripal_core/api/tripal_core_chado.api.inc
Retrieves the list tables in the Chado schema. By default it only retursn the default Chado tables, but may also return custom tables added to the Chado schema as well.
tripal_core_get_chado_table_schema in tripal_core/api/tripal_core_chado.api.inc
Retrieves the chado tables Schema API array.

File

tripal_core/api/tripal_core_chado.api.inc, line 3559
The Tripal Core API

Code

function tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FALSE) {
  // first get the chado version that is installed
  $exact_version = variable_get('chado_version', '');
  if (!$exact_version) {
    $exact_version = tripal_core_set_chado_version();
  }

  // Tripal only supports v1.11 or newer.. really this is the same as v1.1
  // but at the time the v1.11 schema API was written we didn't know that so
  // we'll return the version 1.11 so the schema API will work.
  if (strcmp($exact_version, '1.11 or older') == 0) {
    $exact_version = "1.11";
    if ($warn_if_unsupported) {
      drupal_set_message(t("WARNING: Tripal does not fully support Chado version less than v1.11.  If you are certain this is v1.11
         or if Chado was installed using an earlier version of Tripal then all is well. If not please upgrade to v1.11 or later"), 
      'warning');
    }
  }

  // if not returing an exact version, return the version to the nearest 10th.
  // return 1.2 for all versions of 1.2x
  $effective_version = $exact_version;
  if (preg_match('/^1\.2\d+$/', $effective_version)) {
    $effective_version = "1.2";
  }
  if ($warn_if_unsupported and ($effective_version != 1.11 and $effective_version != 1.2 and $effective_version != 'not installed')) {
    drupal_set_message(t("WARNING: The currently installed version of Chado, v$exact_version, is not fully compatible with Tripal."), 'warning');
  }
  // if the callee has requested the exact version then return it
  if ($exact) {
    return $exact_version;
  }

  return $effective_version;
}