Selaa lähdekoodia

Updated install files to import API to avoid problems with D6 -> D7 upgrades

Stephen Ficklin 9 vuotta sitten
vanhempi
commit
cfe6848e01

+ 15 - 5
tripal_analysis/tripal_analysis.install

@@ -294,8 +294,10 @@ function tripal_analysis_add_mview_analysis_organism() {
  *
  */
 function tripal_analysis_update_7200() {
-  // We cannot use the Tripal API calls in the 7200 update
-  // because during upgrade the tripal_core should also be disabled
+  // 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();
 
   // set the analysis_property as default
   try {
@@ -366,13 +368,17 @@ function tripal_analysis_update_7200() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_analysis_update_dependencies() {
+
+
   $dependencies = array();
 
-  // the tripal_cv update 7200 must run prior to update 7200 of this module
   $dependencies['tripal_analysis'][7200] = array(
     'tripal_cv' => 7200
   );
@@ -385,6 +391,10 @@ function tripal_analysis_update_dependencies() {
  *
  */
 function tripal_analysis_update_7201() {
+  // 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();
 
   // there is a bug in the Tripal v2.0-alpha release that didn't add the
   // materialized view schema to the mviews table.

+ 19 - 0
tripal_bulk_loader/tripal_bulk_loader.install

@@ -249,6 +249,10 @@ function tripal_bulk_loader_update_6152() {
  *
  */
 function tripal_bulk_loader_update_7200() {
+  // 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();
 
   db_change_field(
     'tripal_bulk_loader',
@@ -305,3 +309,18 @@ function tripal_bulk_loader_requirements($phase) {
   }
   return $requirements;
 }
+
+/**
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
+ */
+function tripal_bulk_loader_update_dependencies() {
+
+
+  $dependencies = array();
+
+  return $dependencies;
+}

+ 20 - 4
tripal_contact/tripal_contact.install

@@ -240,8 +240,10 @@ function tripal_contact_add_custom_tables(){
  */
 function tripal_contact_update_7200() {
 
-  // We cannot use the Tripal API calls in the 7200 update
-  // because during upgrade the tripal_core will be disabled
+  // 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();
 
   // add the contact_type CV
   try {
@@ -368,10 +370,14 @@ function tripal_contact_update_7200() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_contact_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module
@@ -387,6 +393,11 @@ function tripal_contact_update_dependencies() {
  *
  */
 function tripal_contact_update_7201() {
+  // 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();
+
   // there was a bug in the function for creating a custom table that
   // kept foreign key constraints from being added.  So, we need to add those
   // to keep from error messages appear, we will drop the FK if it already
@@ -425,6 +436,11 @@ function tripal_contact_update_7201() {
  * Updates path of tripal_contact OBO to be relative.
  */
 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();
+
   try {
     // Remove duplicates.
     db_delete('tripal_cv_obo')

+ 40 - 23
tripal_core/tripal_core.module

@@ -13,29 +13,8 @@
  * @}
  */
 
-// APPLICATION PROGRAMMER INTERFACE -------------
-// Chado API
-require_once 'api/tripal_core.chado_general.api.inc';
-require_once 'api/tripal_core.chado_query.api.inc';
-require_once 'api/tripal_core.chado_variables.api.inc';
-require_once 'api/tripal_core.chado_schema.api.inc';
-require_once 'api/tripal_core.chado_nodes.api.inc';
-require_once 'api/tripal_core.chado_nodes.title_and_path.inc';
-require_once 'api/tripal_core.chado_nodes.properties.api.inc';
-require_once 'api/tripal_core.chado_nodes.dbxrefs.api.inc';
-require_once 'api/tripal_core.chado_nodes.relationships.api.inc';
-
-// Table API
-require_once 'api/tripal_core.custom_tables.api.inc';
-require_once 'api/tripal_core.mviews.api.inc';
-
-// Miscellaneous API
-require_once 'api/tripal_core.files.api.inc';
-require_once 'api/tripal_core.jobs.api.inc';
-require_once 'api/tripal_core.tripal.api.inc';
-require_once 'api/tripal_core.tripal_variables.api.inc';
-require_once 'api/tripal_core.d3js.api.inc';
-require_once 'api/tripal_core.DEPRECATED.inc';
+// Import the full Tripal API into Scope.
+tripal_core_import_api();
 
 // INCLUDES
 require_once 'includes/tripal_core.jobs.inc';
@@ -44,6 +23,7 @@ require_once 'includes/tripal_core.custom_tables.inc';
 require_once 'includes/tripal_core.chado_install.inc';
 require_once 'includes/tripal_core.form_elements.inc';
 
+// Set some global variables.
 tripal_core_set_globals();
 
 /**
@@ -673,4 +653,41 @@ function tripal_core_node_view($node, $view_mode, $langcode) {
  */
 function tripal_core_exclude_type_by_default() {
   return array('text' => 'strlen("<field_value> ") > 250');
+}
+
+
+/**
+ * Imports all of the Tripal API into scope.
+ *
+ * Typically this function call is not necessary as all of the API is
+ * automaticaly included by the tripal_core module.  However this function can
+ * be useful in the .install files during a site upgrade when the tripal_core
+ * module is not enabld.
+ *
+ * Example usage:
+ * @code
+ *   module_load_include('module', 'tripal_core', 'tripal_core');
+ *   tripal_core_import_api();
+ * @endcode
+ *
+ */
+function tripal_core_import_api() {
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_general.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_nodes.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_nodes.dbxrefs.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_nodes.properties.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_nodes.relationships.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_nodes.title_and_path.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_query.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_schema.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.chado_variables.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.custom_tables.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.d3js.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.DEPRECATED.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.files.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.jobs.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.mviews.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.schema_V1.11.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.schema_v1.2.api');
+  module_load_include('inc', 'tripal_core', 'api/tripal_core.tripal_variables.api');
 }

+ 24 - 0
tripal_cv/tripal_cv.install

@@ -264,6 +264,11 @@ function tripal_cv_add_obo_defaults() {
  */
 function tripal_cv_update_7200() {
 
+  // 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();
+
   // add in the new tripal_cv_defaults table
   try {
     $schema = array();
@@ -282,6 +287,11 @@ function tripal_cv_update_7200() {
  */
 function tripal_cv_update_7201() {
 
+  // 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();
+
   // there is a bug in the Tripal v2.0-alpha release that didn't add the
   // materialized view schema to the mviews table.
   // get the schema for the materialized view from the custom_tables table
@@ -308,4 +318,18 @@ function tripal_cv_update_7201() {
       ->condition('name', $view_name)
       ->execute();
   }
+}
+
+/**
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
+ */
+function tripal_cv_update_dependencies() {
+
+  $dependencies = array();
+
+  return $dependencies;
 }

+ 14 - 0
tripal_db/tripal_db.install

@@ -59,3 +59,17 @@ function tripal_db_uninstall() {
 
 }
 
+
+/**
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
+ */
+function tripal_db_update_dependencies() {
+
+  $dependencies = array();
+
+  return $dependencies;
+}

+ 12 - 7
tripal_example/tripal_example.install

@@ -573,10 +573,10 @@ function tripal_example_update_7200() {
   // This function should be named according to the instructions provided here:
   // https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7
   //
-  // It is best not to use Tripal API calls inside of this function because an
-  // upgrade from Drupal 6 to Drupal 7 requires that all modules be disabled
-  // which means the Tripal API is not available. This is an unfortunate
-  // requirement, but will prevent errors during a major upgrade.
+  // 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();
 
   // it is good to wrap any database changes inside of a try catch block:
   try {
@@ -588,11 +588,16 @@ function tripal_example_update_7200() {
   }
 }
 
+
 /**
- * Implementation of hook_update_dependencies(). It specifies a list of other
- * modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_example_update_dependencies() {
+
   $dependencies = array();
 
   // EXPLANATION: here we can specify which modules must be updated prior to
@@ -605,4 +610,4 @@ function tripal_example_update_dependencies() {
   );
 
   return $dependencies;
-}
+}

+ 25 - 2
tripal_feature/tripal_feature.install

@@ -336,6 +336,11 @@ function tripal_feature_add_cvs() {
  * This update may take some time to complete.
  */
 function tripal_feature_update_7200() {
+  // 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();
+
   // During the upgrade from D6 to D7 the vocabulary terms assigned to features were
   // copied to the field_data_taxonomyextra table rather than to the correct
   // field_data_taxonomy_vocabulary_[vid] table. We'll move them.
@@ -469,10 +474,14 @@ function tripal_feature_update_7200() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_feature_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module
@@ -488,6 +497,10 @@ function tripal_feature_update_dependencies() {
  *
  */
 function tripal_feature_update_7201() {
+  // 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();
 
   try {
     // there is a bug in the Tripal v2.0-alpha release that didn't add the
@@ -527,6 +540,11 @@ function tripal_feature_update_7201() {
  * Adds the temporary tables used for loading GFF files.
  */
 function tripal_feature_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();
+
   try {
     tripal_feature_add_tripal_gff_temp_table();
     tripal_feature_add_tripal_gffcds_temp_table();
@@ -542,6 +560,11 @@ function tripal_feature_update_7202() {
  * Removes the unique constraint on the tripal_gffcds_temp table.
  */
 function tripal_feature_update_7203() {
+  // 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();
+
   try {
     tripal_feature_add_tripal_gffcds_temp_table(FALSE);
   }

+ 21 - 4
tripal_featuremap/tripal_featuremap.install

@@ -12,6 +12,7 @@
  */
 function tripal_featuremap_disable() {
 
+
   // Disable all default views provided by this module
   require_once("tripal_featuremap.views_default.inc");
   $views = tripal_featuremap_views_default_views();
@@ -490,8 +491,10 @@ function tripal_featuremap_add_custom_tables(){
  * This update may take some time to complete.
  */
 function tripal_featuremap_update_7200() {
-  // We can't use the Tripal API during an upgrade from D6 to D7 Tripal  because the tripal_core
-  // module is disabled. So, we have to manually make database additions/changes to chado.
+  // 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();
 
   // set the default vocabularies
   // featuremap_units
@@ -569,10 +572,14 @@ function tripal_featuremap_update_7200() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_featuremap_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module
@@ -588,6 +595,11 @@ function tripal_featuremap_update_dependencies() {
  *
  */
 function tripal_featuremap_update_7201() {
+  // 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();
+
   // there was a bug in the function for creating a custom table that
   // kept foreign key constraints from being added.  So, we need to add those
   // to keep from error messages appear, we will drop the FK if it already
@@ -675,6 +687,11 @@ function tripal_featuremap_update_7201() {
  * Fixes a typo when setting the default CV for the unittype_id field of the featuremap table.
  */
 function tripal_featuremap_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();
+
   try {
     tripal_set_default_cv('featuremap', 'unittype_id', 'featuremap_units');
   }

+ 14 - 2
tripal_library/tripal_library.install

@@ -264,6 +264,10 @@ function tripal_library_add_cvterms() {
  *
  */
 function tripal_library_update_7200() {
+  // 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();
 
   // the library types were formerly in a vocabulary named 'tripal_library_types'.
   // rename that to just be 'library_type'. We cannot use the Tripal API calls
@@ -424,10 +428,14 @@ function tripal_library_update_7200() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_library_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module
@@ -443,6 +451,10 @@ function tripal_library_update_dependencies() {
  *
  */
 function tripal_library_update_7201() {
+  // 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();
 
   // there is a bug in the Tripal v2.0-alpha release that didn't add the
   // materialized view schema to the mviews table.

+ 14 - 0
tripal_natural_diversity/tripal_natural_diversity.install

@@ -41,6 +41,20 @@ function tripal_natural_diversity_requirements($phase) {
   return $requirements;
 }
 
+/**
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
+ */
+function tripal_natural_diversity_dependencies() {
+
+  $dependencies = array();
+
+  return $dependencies;
+}
+
 /**
  * Implementation of hook_install().
  *

+ 11 - 2
tripal_organism/tripal_organism.install

@@ -130,6 +130,11 @@ function tripal_organism_add_cvterms() {
  */
 function tripal_organism_update_7200() {
 
+  // 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();
+
   // Add the new organism_property vocabulary
   // We cannot use the Tripal API calls in the 7000 update
   // because during upgrade the tripal_core should also be disabled
@@ -207,10 +212,14 @@ function tripal_organism_update_7200() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_organism_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module

+ 10 - 2
tripal_project/tripal_project.install

@@ -139,6 +139,10 @@ function tripal_project_add_cvterms() {
  *
  */
 function tripal_project_update_7200() {
+  // 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();
 
   // add the project_property CV
   try {
@@ -234,10 +238,14 @@ function tripal_project_update_7200() {
 
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_project_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module

+ 20 - 3
tripal_pub/tripal_pub.install

@@ -281,7 +281,10 @@ function tripal_pub_add_cvterms() {
  *
  */
 function tripal_pub_update_7200() {
-
+  // 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();
 
   // add the tripal_pub CV and set it to be the default for pub types and pub properties
   try {
@@ -406,10 +409,14 @@ function tripal_pub_update_7200() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_pub_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module
@@ -425,6 +432,11 @@ function tripal_pub_update_dependencies() {
  *
  */
 function tripal_pub_update_7201() {
+  // 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();
+
   // there was a bug in the function for creating a custom table that
   // kept foreign key constraints from being added.  So, we need to add those
   // to keep from error messages appear, we will drop the FK if it already
@@ -463,6 +475,11 @@ function tripal_pub_update_7201() {
  * Updates path of tripal_pub OBO to be relative.
  */
 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();
+
   try {
     // Remove duplicates.
     db_delete('tripal_cv_obo')

+ 14 - 5
tripal_stock/tripal_stock.install

@@ -211,9 +211,10 @@ function tripal_stock_add_cvterms() {
  *
  */
 function tripal_stock_update_7200() {
-  // add the new CVs.  We can't use the Tripal API because during
-  // an upgrade from D6 to D7 Tripal is disable. So, we have to manually add these
-  // new vocabularies.
+  // 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();
 
   // add the stock_relationshp CV
   try {
@@ -330,6 +331,10 @@ function tripal_stock_update_7200() {
  * Add materialized views
  */
 function tripal_stock_update_7201() {
+  // 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();
 
   // add the materialized view
   tripal_stock_add_organism_count_mview();
@@ -337,10 +342,14 @@ function tripal_stock_update_7201() {
 }
 
 /**
- * Implementation of hook_update_dependencies().  It specifies a list of
- * other modules whose updates must be run prior to this one.
+ * Implementation of hook_update_dependencies().
+ *
+ * It specifies a list of other modules whose updates must be run prior to
+ * this one.  It also ensures the the Tripal API is in scope for site
+ * upgrades when tripal_core is disabled.
  */
 function tripal_stock_update_dependencies() {
+
   $dependencies = array();
 
   // the tripal_cv update 7200 must run prior to update 7200 of this module