function tripal_pub_update_7202

2.x tripal_pub.install tripal_pub_update_7202()
3.x tripal_pub.install tripal_pub_update_7202()

Updates path of tripal_pub OBO to be relative.

File

tripal_pub/tripal_pub.install, line 431
Installation of the publication module

Code

function tripal_pub_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 Publication')
      ->execute();

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