瀏覽代碼

Adding requirement for Chado installation to all modules

spficklin 12 年之前
父節點
當前提交
05cde25dcb

+ 14 - 25
tripal_analysis/tripal_analysis.install

@@ -116,21 +116,23 @@ function tripal_analysis_schema() {
 }
 
 /**
- * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
- * before installation
- * @todo: Check if this is needed
+ * Provide update script for adding new cvterms
+ */
+function tripal_analysis_update_6001() {
+   // we have some new cvterms to add
+  tripal_cv_add_cvterm(array('name' => 'based_on_analysis', 'def' => 'The analysis that this analysis was based on. For example, blast/kegg/interpro analyses are based on a unigene analysis. The unigene analysis_id should be stored in analysisprop as the rank using this cvterm. The name of said unigene analysis can be inserted as the value in analysisprop.'), 'tripal', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'additional_files', 'def' => 'Additional files for this analysis. Each file should be separated by a semi-colon and have this format: <file description>, <file path>;'), 'tripal', 0, 1, 'tripal');
+  $ret = array(
+      '#finished' => 1,
+  );
+  return $ret;
+}
+/**
+ * Implementation of hook_requirements(). 
  */
 function tripal_analysis_requirements($phase) {
   $requirements = array();
   if ($phase == 'install') {
-  	// make sure the core module is installed
-    if (!function_exists('tripal_create_moddir')) {
-      $requirements ['tripal_analysis'] = array(
-            'title' => "tripal_analysis",
-            'value' => "error. Some required modules are just being installed. Please try again.",
-            'severity' => REQUIREMENT_ERROR,
-      );
-    }
     // make sure chado is installed
     $version = tripal_core_set_chado_version();
     if ($version == 'not installed') {
@@ -142,17 +144,4 @@ function tripal_analysis_requirements($phase) {
     }
   }
   return $requirements;
-}
-
-/**
- * Provide update script for adding new cvterms
- */
-function tripal_analysis_update_6001() {
-   // we have some new cvterms to add
-  tripal_cv_add_cvterm(array('name' => 'based_on_analysis', 'def' => 'The analysis that this analysis was based on. For example, blast/kegg/interpro analyses are based on a unigene analysis. The unigene analysis_id should be stored in analysisprop as the rank using this cvterm. The name of said unigene analysis can be inserted as the value in analysisprop.'), 'tripal', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'additional_files', 'def' => 'Additional files for this analysis. Each file should be separated by a semi-colon and have this format: <file description>, <file path>;'), 'tripal', 0, 1, 'tripal');
-  $ret = array(
-      '#finished' => 1,
-  );
-  return $ret;
-}
+}

+ 18 - 0
tripal_bulk_loader/tripal_bulk_loader.install

@@ -213,4 +213,22 @@ function tripal_bulk_loader_update_6152() {
   );
 
   return $ret;
+}
+/**
+ * Implementation of hook_requirements(). 
+  */
+function tripal_bulk_loader_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'install') {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
+      $requirements ['tripal_bulk_loader'] = array(
+            'title' => "tripal_bulk_loader",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
 }

+ 19 - 0
tripal_cv/tripal_cv.install

@@ -148,3 +148,22 @@ function tripal_cv_add_obo_defaults() {
   }
 
 }
+
+/**
+ * Implementation of hook_requirements(). 
+ */
+function tripal_cv_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'install') {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
+      $requirements ['tripal_cv'] = array(
+            'title' => "tripal_cv",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
+}

+ 8 - 9
tripal_db/tripal_db.install

@@ -27,21 +27,20 @@ function tripal_db_uninstall() {
 }
 
 /**
- * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
- * before installation
- *
- * @ingroup tripal_db
+ * Implementation of hook_requirements(). 
  */
 function tripal_db_requirements($phase) {
   $requirements = array();
   if ($phase == 'install') {
-    if (!function_exists('tripal_create_moddir')) {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
       $requirements ['tripal_db'] = array(
-        'title' => "tripal_db",
-        'value' => "Required modules must be installed first before Tripal DB module can be installed. Please try again.",
-        'severity' => REQUIREMENT_ERROR,
+            'title' => "tripal_db",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
       );
     }
   }
   return $requirements;
-}
+}

+ 20 - 22
tripal_feature/tripal_feature.install

@@ -132,27 +132,6 @@ function tripal_feature_uninstall() {
   }
 }
 
-/**
- * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
- * before installation
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_requirements($phase) {
-  $requirements = array();
-  if ($phase == 'install') {
-    // make sure the core module is installed...
-    if (!function_exists('tripal_create_moddir')) {
-      $requirements ['tripal_feature'] = array(
-        'title' => "tripal_feature",
-        'value' => "error. Some required modules are just being installed. Please try again.",
-        'severity' => REQUIREMENT_ERROR,
-      );
-    }
-  }
-  return $requirements;
-}
-
 /**
  * This function simply defines all tables needed for the module to work
  * correctly.  By putting the table definitions in a separate function we
@@ -195,4 +174,23 @@ function tripal_feature_get_schemas($table = NULL) {
     );
   }
   return $schema;
-};
+};
+
+/**
+ * Implementation of hook_requirements(). 
+ */
+function tripal_feature_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'install') {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
+      $requirements ['tripal_feature'] = array(
+            'title' => "tripal_feature",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
+}

+ 9 - 10
tripal_featuremap/tripal_featuremap.install

@@ -90,21 +90,20 @@ function tripal_featuremap_get_schemas() {
 }
 
 /**
- * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
- * before installation
- *
- * @ingroup tripal_featuremap
+ * Implementation of hook_requirements(). 
  */
 function tripal_featuremap_requirements($phase) {
   $requirements = array();
   if ($phase == 'install') {
-    if (!function_exists('tripal_create_moddir')) {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
       $requirements ['tripal_featuremap'] = array(
-        'title' => "tripal_featuremap",
-        'value' => "error. Some required modules are just being installed. Please try again.",
-        'severity' => REQUIREMENT_ERROR,
-        );
+            'title' => "tripal_featuremap",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
+      );
     }
   }
   return $requirements;
-}
+}

+ 9 - 11
tripal_library/tripal_library.install

@@ -138,23 +138,21 @@ function tripal_library_get_schemas() {
   );
   return $schema;
 }
-
 /**
- * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
- * before installation
- *
- * @ingroup tripal_library
+ * Implementation of hook_requirements(). 
  */
 function tripal_library_requirements($phase) {
   $requirements = array();
   if ($phase == 'install') {
-    if (!function_exists('tripal_create_moddir')) {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
       $requirements ['tripal_library'] = array(
-        'title' => "tripal_library",
-        'value' => "error. Some required modules are just being installed. Please try again.",
-        'severity' => REQUIREMENT_ERROR,
-        );
+            'title' => "tripal_library",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
+      );
     }
   }
   return $requirements;
-}
+}

+ 8 - 8
tripal_organism/tripal_organism.install

@@ -109,21 +109,21 @@ function tripal_organism_get_schemas() {
 }
 
 /**
- * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
- * before installation
+ * Implementation of hook_requirements(). 
  *
- * @ingroup tripal_organism
  */
 function tripal_organism_requirements($phase) {
   $requirements = array();
   if ($phase == 'install') {
-    if (!function_exists('tripal_create_moddir')) {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
       $requirements ['tripal_organism'] = array(
-        'title' => "tripal_organism",
-        'value' => "error. Some required modules are just being installed. Please try again.",
-        'severity' => REQUIREMENT_ERROR,
+            'title' => "tripal_organism",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
       );
     }
   }
   return $requirements;
-}
+}

+ 19 - 0
tripal_project/tripal_project.install

@@ -64,3 +64,22 @@ function tripal_project_schema() {
   return $schema;
 }
 
+/**
+ * Implementation of hook_requirements(). 
+ *
+ */
+function tripal_project_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'install') {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
+      $requirements ['tripal_project'] = array(
+            'title' => "tripal_project",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
+}

+ 19 - 0
tripal_stock/tripal_stock.install

@@ -67,3 +67,22 @@ function tripal_stock_schema() {
 
   return $schema;
 }
+/**
+ * Implementation of hook_requirements(). 
+ *
+ */
+function tripal_stock_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'install') {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
+      $requirements ['tripal_stock'] = array(
+            'title' => "tripal_stock",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
+}

+ 9 - 24
tripal_views/tripal_views.install

@@ -322,36 +322,21 @@ function tripal_views_views_schema() {
   return $schema;
 }
 /**
- * Implementation of hook_requirements(). Make sure Chado database is accessible
- * before installation
+ * Implementation of hook_requirements(). 
  *
- * @ingroup tripal_views
  */
-/*function tripal_views_requirements($phase) {
-  global $db_url;
-  
+function tripal_views_requirements($phase) {
   $requirements = array();
   if ($phase == 'install') {
-    $is_remote = FALSE;
-    $is_local = FALSE;
-  
-    // check if chado is accessible but not local
-    if (is_array($db_url) && isset($db_url['chado'])) {
-       $is_remote = TRUE;
-    }
-    // check if chado is locally accessible
-    $is_local = tripal_core_chado_schema_exists();
-  
-    if (!$is_remote and $is_local) {
+    // make sure chado is installed
+    $version = tripal_core_set_chado_version();
+    if ($version == 'not installed') {
       $requirements ['tripal_views'] = array(
-        'title' => "tripal_views",
-        'value' => t("Chado must be available before Tripal Views can be enabled.  
-                      Please ensure Chado is in the Drupal database in a 'chado' 
-                      schema (desired) or defined in the \$db_url variable of 
-                      the settings.php file."),
-        'severity' => REQUIREMENT_ERROR,
+            'title' => "tripal_views",
+            'value' => "ERROR: Chado most be installed before this module can be enabled",
+            'severity' => REQUIREMENT_ERROR,
       );
     }
   }
   return $requirements;
-}*/
+}