Ver código fonte

ChadoSchema: add warning if chado is not instaled or not local.

Lacey Sanderson 6 anos atrás
pai
commit
16024c180f
1 arquivos alterados com 27 adições e 6 exclusões
  1. 27 6
      tripal_chado/api/ChadoSchema.inc

+ 27 - 6
tripal_chado/api/ChadoSchema.inc

@@ -2,14 +2,16 @@
 /**
  * Provides an application programming interface (API) for describing Chado tables.
  *
- * The functions provided in this documentation should not be called as is, but if you need
- * the Drupal-style array definition for any table, use the following function
- * call:
- *
- *   $table_desc = chado_get_schema($table)
+ * If you need the Drupal-style array definition for any table, use the following:
+ * @code
+
+    $chado_schema = new \ChadoSchema();
+    $table_schema = $chado_schema->getTableSchema($table_name);
+
+ * @endcode
  *
  * where the variable $table contains the name of the table you want to
- * retireve.  The chado_get_schema function determines the appropriate version of
+ * retireve.  The getTableSchema method determines the appropriate version of
  * Chado and uses the Drupal hook infrastructure to call the appropriate
  * hook function to retrieve the table schema.
  */
@@ -51,6 +53,25 @@ class ChadoSchema {
     else {
       $this->schema_name = $schema_name;
     }
+
+    // Check functions require the chado schema be local and installed...
+    // So lets check that now...
+    if (!chado_is_local()) {
+      tripal_report_error(
+        'ChadoSchema',
+        TRIPAL_NOTICE,
+        'The ChadoSchema class requires chado be installed within the drupal database
+          in a separate schema for any compliance checking functionality.'
+      );
+    }
+    if (!chado_is_installed()) {
+      tripal_report_error(
+        'ChadoSchema',
+        TRIPAL_NOTICE,
+        'The ChadoSchema class requires chado be installed
+          for any compliance checking functionality.'
+      );
+    }
   }
 
   /**