Browse Source

Fixed issues with re-setting Feature URLs and node languages. Also started to fix same for stocks but can't create a stock... need to debug that

Stephen Ficklin 11 years ago
parent
commit
5e82fb32e8

+ 1 - 2
tripal_core/api/tripal_core.chado_general.api.inc

@@ -231,8 +231,7 @@ $cv_name, $value, $update_if_present = 0) {
     }
     }
   }
   }
 
 
-  // make sure the cvterm exists.  Otherwise we'll get an error with
-  // prepared statements not matching
+  // make sure the cvterm exists.  
   $values = array(
   $values = array(
     'cv_id' => array(
     'cv_id' => array(
       'name' => $cv_name,
       'name' => $cv_name,

+ 9 - 9
tripal_core/api/tripal_core.chado_nodes.api.inc

@@ -237,15 +237,14 @@ function chado_node_sync_form($form, &$form_state) {
         $form['sync']['ids'] = array(
         $form['sync']['ids'] = array(
           '#title'         => 'Avaliable ' . $args['record_type_title']['plural'],
           '#title'         => 'Avaliable ' . $args['record_type_title']['plural'],
           '#type'          => 'checkboxes',
           '#type'          => 'checkboxes',
-          '#description'   => t("The above  %title_plural have not been synced. Check those to be synced or leave all unchecked to sync them all.",
-            array(
-              '%title_singular' => strtolower($args['record_type_title']['singular']),
-              '%title_plural'   => strtolower($args['record_type_title']['plural'])
-            )),
           '#options'       => $values,
           '#options'       => $values,
           '#default_value' => (isset($form_state['values']['ids'])) ? $form_state['values']['ids'] : array(),
           '#default_value' => (isset($form_state['values']['ids'])) ? $form_state['values']['ids'] : array(),
-          '#prefix'        => '<div style="height: 200px; overflow: scroll">',
           '#suffix'        => '</div><br>',
           '#suffix'        => '</div><br>',
+          '#prefix'       => t("The following  %title_plural have not been synced. Check those to be synced or leave all unchecked to sync them all.",
+              array(
+                '%title_singular' => strtolower($args['record_type_title']['singular']),
+                '%title_plural'   => strtolower($args['record_type_title']['plural'])
+              )) . '<div style="height: 200px; overflow: scroll">',
         );
         );
       }
       }
       else {
       else {
@@ -476,7 +475,7 @@ function chado_node_sync_records($base_table, $max_sync = FALSE, $organism_id =
   // execute the query
   // execute the query
   $results = chado_query($query, $sql_args);
   $results = chado_query($query, $sql_args);
 
 
-  // Iterate through features that need to be synced
+  // Iterate through records that need to be synced
   $count = $results->rowCount();
   $count = $results->rowCount();
   $interval = intval($count * 0.01);
   $interval = intval($count * 0.01);
   if ($interval < 1) {
   if ($interval < 1) {
@@ -490,7 +489,7 @@ function chado_node_sync_records($base_table, $max_sync = FALSE, $organism_id =
   try {
   try {
     foreach ($results as $record) {
     foreach ($results as $record) {
 
 
-      print "\nLoading $base_table " . ($i + 1) . " of $count ($base_table_id=".$record->{$base_table_id}.")...";
+      print "\nLoading $base_table " . ($i + 1) . " of $count ($base_table_id=" . $record->{$base_table_id} . ")...";
 
 
       // update the job status every 1% features
       // update the job status every 1% features
       if ($job_id and $i % $interval == 0) {
       if ($job_id and $i % $interval == 0) {
@@ -500,7 +499,7 @@ function chado_node_sync_records($base_table, $max_sync = FALSE, $organism_id =
       }
       }
 
 
       // Check if it is in the chado linking table (ie: check to see if it is already linked to a node)
       // Check if it is in the chado linking table (ie: check to see if it is already linked to a node)
-      $result = db_select('chado_'.$base_table, 'lnk')
+      $result = db_select('chado_' . $base_table, 'lnk')
         ->fields('lnk',array('nid'))
         ->fields('lnk',array('nid'))
         ->condition($base_table_id, $record->{$base_table_id}, '=')
         ->condition($base_table_id, $record->{$base_table_id}, '=')
         ->execute()
         ->execute()
@@ -517,6 +516,7 @@ function chado_node_sync_records($base_table, $max_sync = FALSE, $organism_id =
         $new_node->uid = $user->uid;
         $new_node->uid = $user->uid;
         $new_node->{$base_table_id} = $record->{$base_table_id};
         $new_node->{$base_table_id} = $record->{$base_table_id};
         $new_node->$base_table = $record;
         $new_node->$base_table = $record;
+        //$new_node->language = LANGUAGE_NONE;
 
 
         // TODO: should we get rid of this hook and use hook_node_presave() instead?
         // TODO: should we get rid of this hook and use hook_node_presave() instead?
         // allow base module to set additional fields as needed
         // allow base module to set additional fields as needed

+ 1 - 6
tripal_core/api/tripal_core.chado_query.api.inc

@@ -843,7 +843,6 @@ function chado_delete_record($table, $match, $options = NULL) {
   $args = array();
   $args = array();
   foreach ($delete_matches as $field => $value) {
   foreach ($delete_matches as $field => $value) {
     // if we have an array values then this is an "IN" clasue.
     // if we have an array values then this is an "IN" clasue.
-    // we cannot use prepared statements with these
 
 
     if (count($value) > 1) {
     if (count($value) > 1) {
       $sql .= "$field IN (";
       $sql .= "$field IN (";
@@ -1180,15 +1179,11 @@ function chado_select_record($table, $columns, $values, $options = NULL) {
   }
   }
 
 
 
 
-  // now build the SQL and prepared SQL statements. We may not use
-  // the prepared statement if it wasn't requested in the options or if the
-  // argument in a where statement has multiple values.
+  // now build the SQL 
   if (empty($where)) {
   if (empty($where)) {
     // sometimes want to select everything
     // sometimes want to select everything
     $sql  = "SELECT " . implode(', ', $columns) . " ";
     $sql  = "SELECT " . implode(', ', $columns) . " ";
     $sql .= 'FROM {' . $table . '} ';
     $sql .= 'FROM {' . $table . '} ';
-    // we don't prepare a statement if there is no where clause
-    $prepared = FALSE;
   }
   }
   else {
   else {
     $sql  = "SELECT " . implode(', ', $columns) . " ";
     $sql  = "SELECT " . implode(', ', $columns) . " ";

+ 60 - 40
tripal_core/tripal_core.install

@@ -349,49 +349,69 @@ function tripal_core_custom_tables_schema() {
  *
  *
  */
  */
 function tripal_core_update_7200() {
 function tripal_core_update_7200() {
-
-  // add an mview column to the tripal_custom_tables table so we
-  // can associate which of the custom tables are also mviews
-  if (!db_field_exists('tripal_custom_tables', 'mview_id')) {
-    $spec = array(
-      'type' => 'int',
-      'not NULL' => FALSE
-    );
-    $keys = array(
-      'foreign keys' => array(
-        'tripal_mviews' => array(
-          'table' => 'tripal_mviews',
-          'columns' => array(
-            'mview_id' => 'mview_id'
+  try {
+    // add an mview column to the tripal_custom_tables table so we
+    // can associate which of the custom tables are also mviews
+    if (!db_field_exists('tripal_custom_tables', 'mview_id')) {
+      $spec = array(
+        'type' => 'int',
+        'not NULL' => FALSE
+      );
+      $keys = array(
+        'foreign keys' => array(
+          'tripal_mviews' => array(
+            'table' => 'tripal_mviews',
+            'columns' => array(
+              'mview_id' => 'mview_id'
+            ),
           ),
           ),
         ),
         ),
-      ),
-    );
-    db_add_field('tripal_custom_tables', 'mview_id', $spec, $keys);
+      );
+      db_add_field('tripal_custom_tables', 'mview_id', $spec, $keys);
+      
+      // the foreign key specification doesn't really add one to the
+      // Drupal schema, it is just used internally, but we want one
+      db_query('
+        ALTER TABLE {tripal_custom_tables}
+        ADD CONSTRAINT tripal_custom_tables_fk1
+        FOREIGN KEY (mview_id) REFERENCES {tripal_mviews} (mview_id)
+        ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
+      ');
+    }
     
     
-    // the foreign key specification doesn't really add one to the
-    // Drupal schema, it is just used internally, but we want one
-    db_query('
-      ALTER TABLE {tripal_custom_tables}
-      ADD CONSTRAINT tripal_custom_tables_fk1
-      FOREIGN KEY (mview_id) REFERENCES {tripal_mviews} (mview_id)
-      ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
-    ');
+    // now link the materialized view to it's custom table entry
+    $mviews = db_select('tripal_mviews', 'tmv')
+      ->fields('tmv', array('mview_id', 'mv_table'))
+      ->execute();
+    foreach ($mviews as $mview) {
+      db_update('tripal_custom_tables')
+       ->fields(array(
+         'mview_id' => $mview->mview_id
+       ))
+       ->condition('table_name', $mview->mv_table)
+       ->execute();
+    }
   }
   }
-  
-  // now link the materialized view to it's custom table entry
-  $mviews = db_select('tripal_mviews', 'tmv')
-    ->fields('tmv', array('mview_id', 'mv_table'))
-    ->execute();
-  foreach ($mviews as $mview) {
-    db_update('tripal_custom_tables')
-     ->fields(array(
-       'mview_id' => $mview->mview_id
-     ))
-     ->condition('table_name', $mview->mv_table)
-     ->execute();
-     
-     
+  catch (\PDOException $e) {
+    $error = $e->getMessage();
+    throw new DrupalUpdateException('Could not update tripal_mviews table and link to custom tables: '. $error);
+  }
+}
+
+/**
+ * Fixes missing language for nodes and URL aliases. This may take awhile...
+ *
+ */
+function tripal_core_update_7201() {
+
+  try {
+    $sql = "UPDATE {node} SET language = :language WHERE language = ''";
+    db_query($sql, array(':language' => LANGUAGE_NONE));
+    $sql = "UPDATE {url_alias} SET language = :language WHERE language = ''";
+    db_query($sql, array(':language' => LANGUAGE_NONE));
+  }
+  catch (\PDOException $e) {
+    $error = $e->getMessage();
+    throw new DrupalUpdateException('Could not reset language for nodes and url aliases: '. $error);
   }
   }
-  
 }
 }

+ 3 - 3
tripal_cv/includes/tripal_cv.cvterm_form.inc

@@ -204,6 +204,7 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
     '#type'          => 'textfield',
     '#type'          => 'textfield',
     '#title'         => t("Term Name"),
     '#title'         => t("Term Name"),
     '#default_value' => $name,
     '#default_value' => $name,
+    '#description'   => t('The term must be unique within the database selected below.'),
     '#required'      => TRUE,
     '#required'      => TRUE,
   );
   );
 
 
@@ -238,7 +239,7 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
   $form['fields']['db_id'] = array(
   $form['fields']['db_id'] = array(
     '#type'         => 'select',
     '#type'         => 'select',
     '#title'         => t('Database'),
     '#title'         => t('Database'),
-    '#description'   => t('All terms must be assocated with a database. If the term you are adding is custom for this database, consider creating a database specific for your site and use that anytime you would like to add terms.'),
+    '#description'   => t('All terms must be assocated with a database. If there is no database for this term (e.g. it is a custom term specific to this site) then select the database \'null\' or consider creating a database specific for your site and use that anytime you would like to add terms.'),
     '#options'      => $dbs,
     '#options'      => $dbs,
     '#default_value' => $db_id,
     '#default_value' => $db_id,
     '#required' => TRUE,
     '#required' => TRUE,
@@ -250,8 +251,7 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
     '#description'   => t('If this term has an existing accession (unique identifier) in the database
     '#description'   => t('If this term has an existing accession (unique identifier) in the database
        please enter that here.  If the accession is numeric with a database prefix (e.g. GO:003023), please
        please enter that here.  If the accession is numeric with a database prefix (e.g. GO:003023), please
        enter just the numeric value.  The database prefix will be appended whenever the term is displayed.
        enter just the numeric value.  The database prefix will be appended whenever the term is displayed.
-       If the accession is not numeric then enter it as is.  If no value is provied, the term name
-       provided above will be used as the accession.'),
+       If you do not have a numeric value consider entering the term name as the accession.'),
     '#required'      => TRUE,
     '#required'      => TRUE,
     '#default_value' => $accession,
     '#default_value' => $accession,
   );
   );

+ 7 - 5
tripal_feature/includes/tripal_feature.admin.inc

@@ -50,7 +50,7 @@ function tripal_feature_admin() {
   $form['title'] = array(
   $form['title'] = array(
     '#type' => 'fieldset',
     '#type' => 'fieldset',
     '#title' => t('Feature Page Titles'),
     '#title' => t('Feature Page Titles'),
-    '#collapsible' => TRUE,
+    '#collapsible' => FALSE,
     '#collapsed' => FALSE,
     '#collapsed' => FALSE,
   );
   );
   $form['title']['desc'] = array(
   $form['title']['desc'] = array(
@@ -82,7 +82,7 @@ function tripal_feature_admin() {
   $form['url'] = array(
   $form['url'] = array(
     '#type' => 'fieldset',
     '#type' => 'fieldset',
     '#title' => t('Feature URL Path'),
     '#title' => t('Feature URL Path'),
-    '#collapsible' => TRUE,
+    '#collapsible' => FALSE,
     '#collapsed' => FALSE,
     '#collapsed' => FALSE,
   );
   );
   
   
@@ -143,7 +143,7 @@ function tripal_feature_admin() {
   $form['browser'] = array(
   $form['browser'] = array(
      '#type' => 'fieldset',
      '#type' => 'fieldset',
      '#title' => t('Feature Browser'),
      '#title' => t('Feature Browser'),
-     '#collapsible' => TRUE,
+     '#collapsible' => FALSE,
      '#collapsed' => FALSE,
      '#collapsed' => FALSE,
   );
   );
   $form['browser']['browser_desc'] = array(
   $form['browser']['browser_desc'] = array(
@@ -172,7 +172,7 @@ function tripal_feature_admin() {
   $form['summary'] = array(
   $form['summary'] = array(
      '#type' => 'fieldset',
      '#type' => 'fieldset',
      '#title' => t('Feature Summary Report'),
      '#title' => t('Feature Summary Report'),
-     '#collapsible' => TRUE,
+     '#collapsible' => FALSE,
      '#collapsed' => FALSE,
      '#collapsed' => FALSE,
   );
   );
   $form['summary']['feature_mapping'] = array(
   $form['summary']['feature_mapping'] = array(
@@ -213,10 +213,12 @@ function tripal_feature_admin_validate($form, &$form_state) {
       break;
       break;
 
 
     case t('Set Feature URLs') :
     case t('Set Feature URLs') :
-      variable_set('chado_feature_url', $form_state['values']['feature_url']);
+      variable_set('chado_feature_url_string', $form_state['values']['chado_feature_url_string']);
       tripal_add_job('Set Feature URLs', 'tripal_feature',
       tripal_add_job('Set Feature URLs', 'tripal_feature',
         'tripal_feature_set_urls', $job_args, $user->uid);
         'tripal_feature_set_urls', $job_args, $user->uid);
       break;
       break;
   }
   }
 
 
 }
 }
+
+

+ 80 - 0
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -901,6 +901,86 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
 
 
   return $url_alias;
   return $url_alias;
 }
 }
+/**
+ * Resets all of the URL alias for all features.  This function is meant to
+ * be run using Tripal's job managmenet interface
+ *  
+ * @param $na
+ *   Tripal expects all jobs to have at least one argument. For this function
+ *   we don't need any, so we have this dummy argument as a filler
+ * @param $job_id
+ * 
+ * @ingroup tripal_feature
+ */
+function tripal_feature_set_urls($na = NULL, $job = NULL) {
+
+  $transaction = db_transaction();
+
+  print "\nNOTE: Setting of URLs is performed using a database transaction. \n" .
+      "If the load fails or is terminated prematurely then the entire set of \n" .
+      "new URLs will be rolled back and no changes will be made\n\n";
+
+  try {
+    // get the number of records we need to set URLs for
+    $csql = "SELECT count(*) FROM {chado_feature}";
+    $num_nodes = db_query($csql)->fetchField();
+
+    // calculate the interval at which we will print an update on the screen
+    $num_set = 0;
+    $num_per_interval = 100;
+
+    // prepare the statements which will quickly add url alias. Because these
+    // are not Chado tables we must manually prepare them
+    $dsql = "DELETE FROM {url_alias} WHERE source = :source";
+    $isql = "INSERT INTO url_alias (source, alias, language) VALUES (:source, :alias, :language)";
+
+    // get the URL alias syntax string
+    $url_alias = variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]');
+    $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
+
+    // get the list of features that have been synced
+    $sql = "SELECT * FROM {chado_feature}";
+    $nodes = db_query($sql);
+    foreach ($nodes as $node) {
+       
+      // get the URL alias
+      $src = "node/$node->nid";
+      $dst = tripal_feature_get_feature_url($node, $url_alias);
+
+      // if the src and dst is the same (the URL alias couldn't be set)
+      // then skip to the next one. There's nothing we can do about this one.
+      if($src == $dst) {
+        continue;
+      }
+
+      // remove any previous alias and then add the new one
+      db_query($dsql, array(':source' => $src));
+      db_query($isql, array(':source' => $src, ':alias' => $dst, ':language' => LANGUAGE_NONE));
+
+      // update the job status every 1% features
+      if ($job and $num_set % $num_per_interval == 0) {
+        $percent = ($num_set / $num_nodes) * 100;
+        tripal_job_set_progress($job, intval($percent));
+        $percent = sprintf("%.2f", $percent);
+        print "Setting URLs (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
+
+      }
+      $num_set++;
+    }
+    $percent = ($num_set / $num_nodes) * 100;
+    tripal_job_set_progress($job, intval($percent));
+    $percent = sprintf("%.2f", $percent);
+    print "Setting URLs (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
+    print "\nDone. Set " . number_format($num_set) . " URLs\n";
+
+  }
+  catch (Exception $e) {
+    $transaction->rollback();
+    print "\n"; // make sure we start errors on new line
+    watchdog_exception('tripal_feature', $e);
+    watchdog('trp-seturl', "Failed Removing URL Alias: %src", array('%src' => $src), WATCHDOG_ERROR);
+  }
+}
 
 
 /**
 /**
  * Implements hook_node_view().
  * Implements hook_node_view().

+ 2 - 2
tripal_feature/includes/tripal_feature.gff_loader.inc

@@ -899,8 +899,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     }
     }
   }
   }
   catch (Exception $e) {
   catch (Exception $e) {
-    print "\n"; // make sure we start errors on new line
-    watchdog_exception('T_gff3_loader', $e);
+    print "\n"; // make sure we start errors on new line    
     if ($use_transaction) {
     if ($use_transaction) {
       $transaction->rollback();
       $transaction->rollback();
       print "FAILED: Rolling back database changes...\n";
       print "FAILED: Rolling back database changes...\n";
@@ -908,6 +907,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     else {
     else {
       print "FAILED\n";
       print "FAILED\n";
     }
     }
+    watchdog_exception('T_gff3_loader', $e);
     return 0;
     return 0;
   }
   }
 
 

+ 5 - 5
tripal_feature/theme/tripal_feature.theme.inc

@@ -725,11 +725,11 @@ function tripal_feature_load_organism_feature_counts($organism) {
   // get the feature counts.  This is dependent on a materialized view
   // get the feature counts.  This is dependent on a materialized view
   // installed with the organism module
   // installed with the organism module
   $sql = "
   $sql = "
-  SELECT OFC.num_features,OFC.feature_type,CVT.definition
-  FROM {organism_feature_count} OFC
-  INNER JOIN {cvterm} CVT on OFC.cvterm_id = CVT.cvterm_id
-  WHERE $where organism_id = :organism_id
-  ORDER BY num_features desc
+    SELECT OFC.num_features,OFC.feature_type,CVT.definition
+    FROM {organism_feature_count} OFC
+      INNER JOIN {cvterm} CVT on OFC.cvterm_id = CVT.cvterm_id
+    WHERE $where organism_id = :organism_id
+    ORDER BY num_features desc
   ";
   ";
   $args[':organism_id'] = $organism->organism_id;
   $args[':organism_id'] = $organism->organism_id;
   $org_features = chado_query($sql, $args);
   $org_features = chado_query($sql, $args);

+ 80 - 0
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -1000,4 +1000,84 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   }
   }
 
 
   return $url_alias;
   return $url_alias;
+}
+/**
+ * Resets all of the URL alias for all stocks.  This function is meant to
+ * be run using Tripal's job managmenet interface
+ *
+ * @param $na
+ *   Tripal expects all jobs to have at least one argument. For this function
+ *   we don't need any, so we have this dummy argument as a filler
+ * @param $job_id
+ *
+ * @ingroup tripal_stock
+ */
+function tripal_stock_set_urls($na = NULL, $job = NULL) {
+
+  $transaction = db_transaction();
+
+  print "\nNOTE: Setting of URLs is performed using a database transaction. \n" .
+      "If the load fails or is terminated prematurely then the entire set of \n" .
+      "new URLs will be rolled back and no changes will be made\n\n";
+
+  try {
+    // get the number of records we need to set URLs for
+    $csql = "SELECT count(*) FROM {chado_stock}";
+    $num_nodes = db_query($csql)->fetchField();
+
+    // calculate the interval at which we will print an update on the screen
+    $num_set = 0;
+    $num_per_interval = 100;
+
+    // prepare the statements which will quickly add url alias. Because these
+    // are not Chado tables we must manually prepare them
+    $dsql = "DELETE FROM {url_alias} WHERE source = :source";
+    $isql = "INSERT INTO url_alias (source, alias, language) VALUES (:source, :alias, :language)";
+
+    // get the URL alias syntax string
+    $url_alias = variable_get('chado_stock_url_string', '/stock/[genus]/[species]/[type]/[uniquename]');
+    $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
+
+    // get the list of stocks that have been synced
+    $sql = "SELECT * FROM {chado_stock}";
+    $nodes = db_query($sql);
+    foreach ($nodes as $node) {
+       
+      // get the URL alias
+      $src = "node/$node->nid";
+      $dst = tripal_stock_get_stock_url($node, $url_alias);
+
+      // if the src and dst is the same (the URL alias couldn't be set)
+      // then skip to the next one. There's nothing we can do about this one.
+      if($src == $dst) {
+        continue;
+      }
+
+      // remove any previous alias and then add the new one
+      db_query($dsql, array(':source' => $src));
+      db_query($isql, array(':source' => $src, ':alias' => $dst, ':language' => LANGUAGE_NONE));
+
+      // update the job status every 1% stocks
+      if ($job and $num_set % $num_per_interval == 0) {
+        $percent = ($num_set / $num_nodes) * 100;
+        tripal_job_set_progress($job, intval($percent));
+        $percent = sprintf("%.2f", $percent);
+        print "Setting URLs (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
+
+      }
+      $num_set++;
+    }
+    $percent = ($num_set / $num_nodes) * 100;
+    tripal_job_set_progress($job, intval($percent));
+    $percent = sprintf("%.2f", $percent);
+    print "Setting URLs (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
+    print "\nDone. Set " . number_format($num_set) . " URLs\n";
+
+  }
+  catch (Exception $e) {
+    $transaction->rollback();
+    print "\n"; // make sure we start errors on new line
+    watchdog_exception('tripal_stock', $e);
+    watchdog('trp-seturl', "Failed Removing URL Alias: %src", array('%src' => $src), WATCHDOG_ERROR);
+  }
 }
 }

+ 6 - 1
tripal_stock/tripal_stock.install

@@ -49,6 +49,11 @@ function tripal_stock_requirements($phase) {
 function tripal_stock_install() {
 function tripal_stock_install() {
   // create the module's data directory
   // create the module's data directory
   tripal_create_files_dir('tripal_stock');
   tripal_create_files_dir('tripal_stock');
+  
+  // add some controlled vocabularies 
+  tripal_stock_add_cvs();
+  
+  tripal_stock_add_cvterms();
 
 
   // set the default vocabularies
   // set the default vocabularies
   tripal_set_default_cv('stock', 'type_id', 'stock_type');
   tripal_set_default_cv('stock', 'type_id', 'stock_type');
@@ -301,7 +306,7 @@ function tripal_stock_update_7200() {
 }
 }
 
 
 /**
 /**
- * Upgrade to 7.x-2.0.1-alpha
+ * Add materialized views
  */
  */
 function tripal_stock_update_7201() {
 function tripal_stock_update_7201() {