Browse Source

Merge pull request #226 from abretaud/smallfixes

Small fixes
Stephen Ficklin 7 years ago
parent
commit
f586110aa2

+ 5 - 1
tripal/includes/tripal.upload.inc

@@ -118,6 +118,7 @@ function tripal_file_upload_merge($filename, $type, $user_dir) {
       $status = 'failed';
       $message = 'Cannot open merged file: ' . $merge_file . '.';
     }
+    flock($merge_fh, LOCK_UN);
     fclose($merge_fh);
   }
 
@@ -234,6 +235,7 @@ function tripal_file_upload_put($filename, $chunk, $user_dir) {
       while ($data = fread($putdata, 1024)) {
         fwrite($fh, $data);
       }
+      flock($fh, LOCK_UN);
       fclose($fh);
     }
   }
@@ -271,6 +273,7 @@ function tripal_file_upload_read_log($temp_dir) {
       }
       $log = unserialize($contents);
     }
+    flock($fh, LOCK_UN);
     fclose($fh);
   }
   if (!is_array($log)) {
@@ -309,5 +312,6 @@ function tripal_file_upoad_write_log($temp_dir, $log) {
   if ($fh and flock($fh, LOCK_EX)) {
     fwrite($fh, serialize($log));
   }
+  flock($fh, LOCK_UN);
   fclose($fh);
-}
+}

+ 1 - 1
tripal_chado/api/tripal_chado.query.api.inc

@@ -1923,7 +1923,7 @@ function chado_schema_get_foreign_key($table_desc, $field, $values, $options = N
        key referrs to (<foreign table>) and then implement
        hook_chado_chado_schema_v<version>_<foreign table>(). See
        tripal_chado_chado_v1_2_schema_feature for an example. Chado version: $version");
-    tripal_report_error('tripal_chado', $message);
+    tripal_report_error('tripal_chado', TRIPAL_ERROR, $message);
     drupal_set_message(check_plain($message), 'error');
   }
 

+ 3 - 3
tripal_chado/includes/TripalFields/local__source_data/local__source_data_formatter.inc

@@ -21,13 +21,13 @@ class local__source_data_formatter extends ChadoFieldFormatter {
     if ($items[0]['value']) {
       $content = "<dl class=\"tripal-dl\">";
       if (!empty($items[0]['value'][$sourcename_term])) {
-        $content .= "<dt>Source Name</dt><dd>: " . $items[0]['value']['schema:name'] . " </dd>";
+        $content .= "<dt>Source Name</dt><dd>: " . $items[0]['value'][$sourcename_term] . " </dd>";
       }
       if (!empty($items[0]['value'][$sourceversion_term])) {
-        $content .= "<dt>Source Version</dt><dd>: " . $items[0]['value']['IAO:0000129'] . " </dd>";
+        $content .= "<dt>Source Version</dt><dd>: " . $items[0]['value'][$sourceversion_term] . " </dd>";
       }
       if (!empty($items[0]['value'][$sourceuri_term])) {
-        $content .= "<dt>Source URI</dt><dd>: " . l($items[0]['value']['data:1047'], $items[0]['value']['data:1047'], array('attributes' => array('target' => '_blank'))) . " </dd>";
+        $content .= "<dt>Source URI</dt><dd>: " . l($items[0]['value'][$sourceuri_term], $items[0]['value'][$sourceuri_term], array('attributes' => array('target' => '_blank'))) . " </dd>";
       }
       $content .= "</dl>";
     }

+ 1 - 1
tripal_chado/includes/TripalFields/schema__publication/schema__publication_formatter.inc

@@ -19,7 +19,7 @@ class schema__publication_formatter extends ChadoFieldFormatter {
 
       $title = isset($item['value']['TPUB:0000039']) ? $item['value']['TPUB:0000039'] : '';
       $citation = isset($item['value']['TPUB:0000003']) ? $item['value']['TPUB:0000003'] : '';
-      $entity = array_key_exists('entity', $item['value']) ? $item['value']['entity'] : '';
+      $entity = (is_array($item['value']) && array_key_exists('entity', $item['value'])) ? $item['value']['entity'] : '';
       if ($entity) {
         list($entity_type, $entity_id) = explode(':', $entity);
         $new_title = l($title, 'bio_data/' . $entity_id);

+ 1 - 1
tripal_chado/includes/TripalFields/sio__annotation/sio__annotation_formatter.inc

@@ -28,7 +28,7 @@ class sio__annotation_formatter extends ChadoFieldFormatter {
     $chado_table = $this->instance['settings']['chado_table'];
     foreach ($items as $delta => $item) {
 
-      if ($item['chado-' . $chado_table . '__cvterm_id']) {
+      if (!empty($item['chado-' . $chado_table . '__cvterm_id'])) {
         $cvterm = chado_generate_var('cvterm', array('cvterm_id' => $item['chado-' . $chado_table . '__cvterm_id']));
         $dbxref = $cvterm->dbxref_id;
 

+ 0 - 1
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -1328,4 +1328,3 @@ function tripal_chado_field_storage_bundle_mapping_form_submit($form,
   }
 }
 
-

+ 1 - 1
tripal_ws/includes/TripalWebService.inc

@@ -224,7 +224,7 @@ class TripalWebService {
     $cfh = fopen($context_file_path, "w");
     if (flock($cfh, LOCK_EX)) {
       fwrite($cfh, json_encode($context));
-      flock($context_file_path, LOCK_UN);
+      flock($cfh, LOCK_UN);
       fclose($cfh);
     }
     else {