浏览代码

Fixed bug 1904410. No longer does Tripal give error on install of chado if the plpgsql language is already created. Also, fixed some code which said an incompatible version of Chado was installed when no version was installed at all.

spficklin 12 年之前
父节点
当前提交
8d85d9b204
共有 2 个文件被更改,包括 20 次插入14 次删除
  1. 1 1
      tripal_core/api/tripal_core.api.inc
  2. 19 13
      tripal_core/includes/chado_install.php

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

@@ -3289,7 +3289,7 @@ function tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FA
   if (preg_match('/^1\.2\d+$/', $effective_version)) {
     $effective_version = "1.2";
   }
-  if ($warn_if_unsupported and ($effective_version != 1.11 and $effective_version != 1.2)) {
+  if ($warn_if_unsupported and ($effective_version != 1.11 and $effective_version != 1.2 and $effective_version != 'not installed')) {
     drupal_set_message(t("WARNING: The currently installed version of Chado, v$exact_version, is not fully compatible with Tripal."), 'warning');
   }
   // if the callee has requested the exact version then return it

+ 19 - 13
tripal_core/includes/chado_install.php

@@ -92,17 +92,17 @@ function tripal_core_install_chado($action) {
     if (tripal_core_reset_chado_schema()) {
       $success = tripal_core_install_sql($schema_file);
       if ($success) {
-        print "Installation Complete!\n";
+        print "Install of Chado v1.2 (Step 1 of 2) Successful!\n";
       }
       else {
-        print "Installation Problems!  Please check output above for errors.\n";
+        print "Installation (Step 1 of 2) Problems!  Please check output above for errors.\n";
       }
       $success = tripal_core_install_sql($init_file);
       if ($success) {
-        print "Installation Complete!\n";
+        print "Install of Chado v1.2 (Step 2 of 2) Successful.\nInstallation Complete\n";
       }
       else {
-        print "Installation Problems!  Please check output above for errors.\n";
+        print "Installation (Step 2 of 2) Problems!  Please check output above for errors.\n";
       }
       chado_query($vsql,'1.2'); # set the version
     }
@@ -116,17 +116,17 @@ function tripal_core_install_chado($action) {
     $init_file = drupal_get_path('module', 'tripal_core') . '/chado_schema/upgrade-1.11-1.2.sql';
     $success = tripal_core_install_sql($schema_file);
     if ($success) {
-      print "Installation Complete!\n";
+      print "Upgrade from v1.11 to v1.2 (Step 1 of 2) Successful!\n";
     }
     else {
-      print "Installation Problems!  Please check output above for errors.\n";
+      print "Upgrade (Step 1 of 2) problems!  Please check output above for errors.\n";
     }
     $success = tripal_core_install_sql($init_file);
     if ($success) {
-      print "Installation Complete!\n";
+      print "Upgrade from v1.11 to v1.2 (Step 2 of 2) Successful.\nUpgrade Complete!\n";
     }
     else {
-      print "Installation Problems!  Please check output above for errors.\n";
+      print "Upgrade (Step 2 of 2) problems!  Please check output above for errors.\n";
     }
     chado_query($vsql,'1.2'); # set the version
   }
@@ -136,17 +136,17 @@ function tripal_core_install_chado($action) {
     if (tripal_core_reset_chado_schema()) {
       $success = tripal_core_install_sql($schema_file);
       if ($success) {
-        print "Installation Complete!\n";
+        print "Install of Chado v1.11 (Step 1 of 2) Successful!\n";
       }
       else {
-        print "Installation Problems!  Please check output above for errors.\n";
+        print "Installation (Step 1 of 2) Problems!  Please check output above for errors.\n";
       }
       $success = tripal_core_install_sql($init_file);
       if ($success) {
-        print "Installation Complete!\n";
+        print "Install of Chado v1.11 (Step 2 of 2) Successful.\nInstallation Complete!\n";
       }
       else {
-        print "Installation Problems!  Please check output above for errors.\n";
+        print "Installation (Step 2 of 2) Problems!  Please check output above for errors.\n";
       }
     }
     else {
@@ -187,7 +187,13 @@ function tripal_core_reset_chado_schema() {
   print "Creating 'chado' schema\n";
   db_query("create schema chado");
   if (tripal_core_schema_exists('chado')) {
-    db_query("create language plpgsql");
+    // before creating the plpgsql language let's check to make sure
+    // it doesn't already exists
+    $sql = "SELECT COUNT(*) FROM pg_language WHERE lanname = 'plpgsql'";
+    $count = db_fetch_object(db_query($sql));
+    if (!$count or $count->count == 0) {
+      db_query("create language plpgsql");
+    }
     return TRUE;
   }