Browse Source

Merge branch '7.x-2.x' of git.drupal.org:project/tripal into 7.x-2.x

Lacey Sanderson 10 years ago
parent
commit
6a54145301

+ 18 - 8
tripal_core/api/tripal_core.chado_nodes.title_and_path.inc

@@ -418,13 +418,14 @@ function chado_add_admin_form_set_title_form_submit($form, $form_state) {
  *   of the specified content type.
  */
 function chado_node_get_title_format($content_type, &$tokens, $base_table = NULL) {
-  $format = '';
+  $format_record_format = $format = '';
+  $format_record_tokens = '';
 
   // Is there a title format set?
   $format_record = chado_node_get_token_format('title', $content_type, array('return_record' => TRUE));
   if (!empty($format_record)) {
-    $format = $format_record->format;
-    $tokens = $format_record->tokens;
+    $format_record_format = $format = $format_record->format;
+    $format_record_tokens = $tokens = $format_record->tokens;
   }
 
   // All three options below need the tokens to be generated so do that now
@@ -457,7 +458,11 @@ function chado_node_get_title_format($content_type, &$tokens, $base_table = NULL
   }
 
   // Add the format to table so we can use it later
-  chado_node_add_token_format('title', $content_type, $format, $tokens);
+  // (optimization: to speed up bulk updates, don't update the record if
+  // the format and tokens are unchanged)
+  if ($format != $format_record_format || $tokens != $format_record_tokens) {
+    chado_node_add_token_format('title', $content_type, $format, $tokens);
+  }
 
   return $format;
 }
@@ -947,13 +952,14 @@ function chado_add_admin_form_set_url_form_submit($form, $form_state) {
  *   of the specified content type.
  */
 function chado_node_get_url_format($content_type, &$tokens, $base_table = NULL) {
-  $format = '';
+  $format_record_format = $format = '';
+  $format_record_tokens = '';
 
   // Is there a url format set?
   $format_record = chado_node_get_token_format('url', $content_type, array('return_record' => TRUE));
   if (!empty($format_record)) {
-    $format = $format_record->format;
-    $tokens = $format_record->tokens;
+    $format_record_format = $format = $format_record->format;
+    $format_record_tokens = $tokens = $format_record->tokens;
   }
 
   // All three options below need the tokens to be generated so do that now
@@ -988,7 +994,11 @@ function chado_node_get_url_format($content_type, &$tokens, $base_table = NULL)
   }
 
   // Add the format to table so we can use it later
-  chado_node_add_token_format('url', $content_type, $format, $tokens);
+  // (optimization: to speed up bulk updates, don't update the record if
+  // the format and tokens are unchanged)
+  if ($format != $format_record_format || $tokens != $format_record_tokens) {
+    chado_node_add_token_format('url', $content_type, $format, $tokens);
+  }
 
   return $format;
 }

+ 0 - 4
tripal_core/tripal_core.install

@@ -380,10 +380,6 @@ function tripal_core_tripal_token_schema() {
         'not null' => TRUE
       ),
     ),
-    'indexes' => array(
-      'tripal_format_id' => array('tripal_format_id'),
-      'type_application' => array('content_type', 'application'),
-    ),
     'unique keys' => array(
       'type_application' => array('content_type', 'application'),
     ),

+ 1 - 1
tripal_feature/theme/templates/tripal_feature_references.tpl.php

@@ -31,7 +31,7 @@ if(count($references) > 0){ ?>
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Dababase', 'Accession');
+  $headers = array('Database', 'Accession');
   
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation

+ 1 - 1
tripal_featuremap/theme/templates/tripal_featuremap_references.tpl.php

@@ -19,7 +19,7 @@ if(count($references) > 0){ ?>
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Dababase', 'Accession');
+  $headers = array('Database', 'Accession');
   
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation

+ 1 - 1
tripal_library/theme/templates/tripal_library_references.tpl.php

@@ -19,7 +19,7 @@ if(count($references) > 0){ ?>
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Dababase', 'Accession');
+  $headers = array('Database', 'Accession');
   
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation

+ 1 - 1
tripal_organism/theme/templates/tripal_organism_references.tpl.php

@@ -25,7 +25,7 @@ if(count($references) > 0){ ?>
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Dababase', 'Accession');
+  $headers = array('Database', 'Accession');
   
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation

+ 1 - 1
tripal_stock/theme/templates/tripal_stock_references.tpl.php

@@ -31,7 +31,7 @@ if(count($references) > 0){ ?>
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Dababase', 'Accession');
+  $headers = array('Database', 'Accession');
   
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation