Browse Source

Fix for the TripalImporter create()

Stephen Ficklin 7 years ago
parent
commit
6ed18b2856

+ 0 - 2
tripal/api/tripal.jobs.api.inc

@@ -528,5 +528,3 @@ function tripal_get_active_jobs($modulename = NULL) {
   }
   return $jobs;
 }
-
-

+ 1 - 0
tripal/api/tripal.notice.api.inc

@@ -231,3 +231,4 @@ function tripal_log($message, $type = 'error', $options = array()) {
   return error_log($message);
 
 }
+

+ 2 - 4
tripal/includes/TripalImporter.inc

@@ -1,4 +1,5 @@
 <?php
+
 class TripalImporter {
 
   // --------------------------------------------------------------------------
@@ -287,7 +288,7 @@ class TripalImporter {
       }
 
       // Validate the $file_details argument.
-      if ($has_file == 0 and $this->file_required == TRUE) {
+      if ($has_file == 0 and $class::file_required == TRUE) {
         throw new Exception("Must provide a proper file identifier for the \$file_details argument.");
       }
 
@@ -509,9 +510,6 @@ class TripalImporter {
     // Generate a translated message.
     $tmessage = t($message, $variables);
 
-    // For the sake of the command-line user, print the message to the
-    // terminal.
-    print $tmessage . "\n";
 
     // If we have a job then pass along the messaging to the job.
     if ($this->job) {

+ 5 - 2
tripal/includes/TripalJob.inc

@@ -20,7 +20,6 @@ class TripalJob {
    * create() function.
    */
   public function __construct() {
-    $this->log = '';
   }
 
   /**
@@ -457,13 +456,17 @@ class TripalJob {
     // Generate a translated message.
     $tmessage = t($message, $variables);
 
+    // For the sake of the command-line user, print the message to the
+    // terminal.
+    print $tmessage . "\n";
+
     // Add this message to the job's log.
     $this->job->error_msg .= "\n" . $tmessage;
 
     // Report this message to watchdog or set a message.
     if ($severity == TRIPAL_CRITICAL or $severity == TRIPAL_ERROR) {
       tripal_report_error('tripal_job', $severity, $message, $variables);
-      $this->job->status = 'Error';
+        $this->job->status = 'Error';
     }
   }
 }

+ 17 - 6
tripal_chado/includes/TripalImporter/FASTAImporter.inc

@@ -41,6 +41,19 @@ class FASTAImporter extends TripalImporter {
    */
   public static $button_text = 'Import FASTA file';
 
+
+  /**
+   * Indicates the methods that the file uploader will support.
+   */
+  public static $methods = array(
+    // Allow the user to upload a file to the server.
+    'file_upload' => TRUE,
+    // Allow the user to provide the path on the Tripal server for the file.
+    'file_local' => TRUE,
+    // Allow the user to provide a remote URL for the file.
+    'file_remote' => TRUE,
+  );
+
   /**
    * @see TripalImporter::form()
    */
@@ -406,9 +419,8 @@ class FASTAImporter extends TripalImporter {
     if ($parent_type) {
       $parentcvterm = chado_query($cvtermsql, array(':cvname' => 'sequence', ':name' => $parent_type,':synonym' => $parent_type))->fetchObject();
       if (!$parentcvterm) {
-        $this->logMessage("Cannot find the paretne term type: '!type'", array(
-          '!type' => $parentcvterm
-        ), TRIPAL_ERROR);
+        $this->logMessage("Cannot find the paretne term type: '!type'",
+          array('!type' => $parentcvterm), TRIPAL_ERROR);
         return 0;
       }
     }
@@ -417,9 +429,8 @@ class FASTAImporter extends TripalImporter {
     if ($rel_type) {
       $relcvterm = chado_query($cvtermsql, array(':cvname' => 'sequence',':name' => $rel_type,':synonym' => $rel_type))->fetchObject();
       if (!$relcvterm) {
-        $this->logMessage("Cannot find the relationship term type: '!type'", array(
-          '!type' => $relcvterm
-        ), TRIPAL_ERROR);
+        $this->logMessage("Cannot find the relationship term type: '!type'",
+          array('!type' => $relcvterm), TRIPAL_ERROR);
         return 0;
       }
     }

+ 2 - 2
tripal_chado/includes/tripal_chado.install.inc

@@ -191,7 +191,7 @@ function tripal_chado_load_form_submit($form, &$form_state) {
  *
  * @ingroup tripal_chado
  */
-function tripal_chado_install_chado($action) {
+function tripal_chado_install_chado($action, TripalJob $job = NULL) {
 
   $vsql = "
     INSERT INTO {chadoprop} (type_id, value)
@@ -248,7 +248,7 @@ function tripal_chado_install_chado($action) {
 /**
  * Installs Chado v1.3.
  */
-function tripal_chado_install_chado_1_3() {
+function tripal_chado_install_chado_1_3(TripalJob $job = NULL) {
   // Get the path to the schema and init SQL files.
   $schema_file = drupal_get_path('module', 'tripal_chado') .
     '/chado_schema/default_schema-1.3.sql';