function tripal_contact_update_7202

2.x tripal_contact.install tripal_contact_update_7202()

Updates path of tripal_contact OBO to be relative.

File

tripal_contact/tripal_contact.install, line 400
Handles install, uninstall, disable and enable functionality including database tables.

Code

function tripal_contact_update_7202() {
  // Make sure we have the full API loaded this will help during a
  // site upgrade when the tripal_core module is disabled.
  module_load_include('module', 'tripal_core', 'tripal_core');
  tripal_core_import_api();
  module_load_include('inc', 'tripal_cv', 'api/tripal_cv.api');

  try {
    // Remove duplicates.
    db_delete('tripal_cv_obo')
      ->condition('name', 'Tripal Contacts')
      ->execute();

    // Add in the updated path.
    $obo_path = '{tripal_contact}/files/tcontact.obo';
    $obo_id = tripal_insert_obo('Tripal Contacts', $obo_path);
  }
  catch (\PDOException $e) {
    $error = $e->getMessage();
    throw new DrupalUpdateException('Failed to update tripal_contact OBO path: ' . $error);
  }
}