소스 검색

Merge pull request #195 from abretaud/3fixes

Fix some warnings
Stephen Ficklin 7 년 전
부모
커밋
41c65de493

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.DS_Store

+ 3 - 12
tripal/api/tripal.entities.api.inc

@@ -218,7 +218,7 @@ function hook_tripal_cron_notification() {
  * @param $submitter_id
  *   A unique ID provided by the submitter for checking to make sure that the notification is not added more than once.
  */
-function tripal_add_notifcation($title, $details, $type, $actions, $submitter_id) {
+function tripal_add_notification($title, $details, $type, $actions, $submitter_id) {
   $transaction = db_transaction();
 
   // Check the notification isn't already in the admin notification table.
@@ -242,9 +242,6 @@ function tripal_add_notifcation($title, $details, $type, $actions, $submitter_id
       $transaction->rollback();
       watchdog('tripal_cron', 'Could not write notification to database.');
     }
-    if ($success) {
-      watchdog('tripal_cron', 'New field notification created.');
-    }
   }
 }
 /**
@@ -444,7 +441,7 @@ function tripal_tripal_cron_notification() {
         $type = 'Field';
         $submitter_id = $details['field_name'] . '-' . $bundle_name->name . '-' . $module;
 
-        tripal_add_notifcation($title, $detail_info, $type, $actions, $submitter_id);
+        tripal_add_notification($title, $detail_info, $type, $actions, $submitter_id);
         $num_created++;
       }
     }
@@ -471,13 +468,10 @@ function tripal_tripal_cron_notification() {
         $type = 'Field';
         $submitter_id = $details['field_name'] . '-' . $bundle_name->name . '-' . $module;
 
-        tripal_add_notifcation($title, $detail_info, $type, $actions, $submitter_id);
+        tripal_add_notification($title, $detail_info, $type, $actions, $submitter_id);
         $num_created++;
       }
     }
-    if ($num_created == 0) {
-      watchdog('tripal_cron', '<pre>No new fields for '. print_r($bundle_name->name, TRUE) .'</pre>');
-    }
   }
 }
 
@@ -1127,6 +1121,3 @@ function tripal_entity_label($entity) {
   }
   return NULL;
 }
-
-
-

+ 5 - 5
tripal/api/tripal.importer.api.inc

@@ -95,6 +95,8 @@ function tripal_run_importer($import_id, TripalJob $job = NULL) {
   $loader->setJob($job);
   $loader->prepareFiles();
 
+  print "\nRunning '".$loader::$name."' importer";
+
   print "\nNOTE: Loading of file is performed using a database transaction. \n" .
         "If it fails or is terminated prematurely then all insertions and \n" .
         "updates are rolled back and will not be found in the database\n\n";
@@ -107,15 +109,14 @@ function tripal_run_importer($import_id, TripalJob $job = NULL) {
     tripal_run_importer_post_run($loader, $job);
 
     // Check for tables with new cvterms
+    print "Remapping Chado Controlled vocabularies to Tripal Terms...";
     tripal_chado_map_cvterms();
 
     // Check for new fields and notify the user.
     tripal_tripal_cron_notification();
 
-    // Clear the Drpual chace
+    // Clear the Drupal cache
     cache_clear_all();
-
-    print "\nDone\n";
   }
   catch (Exception $e) {
     if ($job) {
@@ -145,7 +146,7 @@ function tripal_run_importer_run($loader, $job) {
     $loader->run();
 
     if ($job) {
-      $job->logMessage("Done");
+      $job->logMessage("\nDone.\n");
     }
 
     // Remove the temp file
@@ -181,4 +182,3 @@ function tripal_run_importer_post_run($loader, $job) {
     throw $e;
   }
 }
-

+ 17 - 15
tripal/includes/TripalImporter.inc

@@ -424,15 +424,15 @@ class TripalImporter {
     }
 
     try {
-      for($i = 0; $i < count($this->arguments['file']); $i++) {
-        if (!empty($this->arguments['file'][$i]['file_remote'])) {
-          $file_remote = $this->arguments['file'][$i]['file_remote'];
+      for($i = 0; $i < count($this->arguments['files']); $i++) {
+        if (!empty($this->arguments['files'][$i]['file_remote'])) {
+          $file_remote = $this->arguments['files'][$i]['file_remote'];
           $this->logMessage('Download file: !file_remote...', array('!file_remote' => $file_remote));
 
           // If this file is compressed then keepthe .gz extension so we can
           // uncompress it.
           $ext = '';
-          if (preg_match('/^(.*?)\.gz$/', $this->arguments['file']['file_remote'])) {
+          if (preg_match('/^(.*?)\.gz$/', $file_remote)) {
             $ext = '.gz';
           }
           // Create a temporary file.
@@ -451,17 +451,17 @@ class TripalImporter {
             fwrite($tmp_fh, fread($url_fh, 255), 255);
           }
           // Set the path to the file for the importer to use.
-          $this->arguments['file']['file_path'] = $temp;
+          $this->arguments['files'][$i]['file_path'] = $temp;
           $this->is_prepared = TRUE;
         }
 
         // Is this file compressed?  If so, then uncompress it
         $matches = array();
-        if (preg_match('/^(.*?)\.gz$/', $this->arguments['file']['file_path'], $matches)) {
-          $this->logMessage("Uncompressing: !file", array('!file' => $this->arguments['file']['file_path']));
+        if (preg_match('/^(.*?)\.gz$/', $this->arguments['files'][$i]['file_path'], $matches)) {
+          $this->logMessage("Uncompressing: !file", array('!file' => $this->arguments['files'][$i]['file_path']));
           $buffer_size = 4096;
           $new_file_path = $matches[1];
-          $gzfile = gzopen($this->arguments['file']['file_path'], 'rb');
+          $gzfile = gzopen($this->arguments['files'][$i]['file_path'], 'rb');
           $out_file = fopen($new_file_path, 'wb');
           if (!$out_file) {
             throw new Exception("Cannot uncompress file: new temporary file, '$new_file_path', cannot be created.");
@@ -480,8 +480,8 @@ class TripalImporter {
 
           // Now remove the .gz file and reset the file_path to the new
           // uncompressed version.
-          unlink($this->arguments['file'][$i]['file_path']);
-          $this->arguments['file'][$i]['file_path'] = $new_file_path;
+          unlink($this->arguments['files'][$i]['file_path']);
+          $this->arguments['files'][$i]['file_path'] = $new_file_path;
         }
       }
     }
@@ -499,11 +499,13 @@ class TripalImporter {
   public function cleanFile() {
     try {
       // If a remote file was downloaded then remove it.
-      if (!empty($this->arguments['file']['file_remote']) and
-          file_exists($this->arguments['file']['file_path'])) {
-        $this->logMessage('Removing downloaded file...');
-        unlink($this->arguments['file']['file_path']);
-        $this->is_prepared = FALSE;
+      for($i = 0; $i < count($this->arguments['files']); $i++) {
+          if (!empty($this->arguments['files'][$i]['file_remote']) and
+              file_exists($this->arguments['files'][$i]['file_path'])) {
+            $this->logMessage('Removing downloaded file...');
+            unlink($this->arguments['files'][$i]['file_path']);
+            $this->is_prepared = FALSE;
+          }
       }
     }
     catch (Exception $e){

+ 4 - 4
tripal/tripal.drush.inc

@@ -67,7 +67,7 @@ function tripal_drush_command() {
     ),
   );
   $items['trp-run-jobs'] = array(
-    'description' => dt('Launches jobs waiting in the queue. Only one job can execute at a time unless the --parllel=1 option is provided.'),
+    'description' => dt('Launches jobs waiting in the queue. Only one job can execute at a time unless the --parallel=1 option is provided.'),
     'examples' => array(
       'Single Job' => 'drush trp-run-jobs --username=administrator',
       'Parallel Job' => 'drush trp-run-jobs --username=administrator --parallel=1',
@@ -200,7 +200,7 @@ function drush_tripal_trp_run_jobs() {
 
   // Unfortunately later versions of Drush use the '--user' argument which
   // makes it incompatible with how Tripal was using it.  For backwards
-  // compatabiliy we will accept --user with a non numeric value only. The
+  // compatibility we will accept --user with a non numeric value only. The
   // numeric value should be for Drush. Tripal will instead use the
   // --username argument for the fture.
   $user = drush_get_option('user');
@@ -385,9 +385,9 @@ function drush_tripal_trp_set_permissions() {
     $postgres_password = drush_prompt(dt('postgres password'));
     drush_print(dt(""));
     drush_print(dt(
-    "This is the information provided, please review and confirm it is correct: 
+    "This is the information provided, please review and confirm it is correct:
      Database host: $host
-     Database name: $database 
+     Database name: $database
      Database username: $postgres_username
      Database user password: $postgres_password
      "

+ 3 - 2
tripal_chado/includes/TripalImporter/FASTAImporter.inc

@@ -581,10 +581,10 @@ class FASTAImporter extends TripalImporter {
           $analysis_id, $organism_id, $cvterm, $source, $method, $re_name,
           $match_type, $parentcvterm, $relcvterm, $seq['seq_start'],
           $seq['seq_end']);
-      $this->setItemsHandled($i);
+      $this->setItemsHandled($j);
     }
     fclose($fh);
-    $this->setItemsHandled($i);
+    $this->setItemsHandled($num_seqs);
   }
 
   /**
@@ -886,6 +886,7 @@ class FASTAImporter extends TripalImporter {
     // get a specific bytes read then append the sequence to the one in the
     // database.
     $partial_seq_size = 0;
+    $chunk_intv_read = 0;
     while ($line = fgets($fh)) {
       $num_read += strlen($line) + 1;
       $chunk_intv_read += strlen($line) + 1;

+ 1 - 2
tripal_chado/includes/tripal_chado.mapping.inc

@@ -14,7 +14,6 @@ function tripal_chado_map_cvterms() {
 
     // Iterate through the referring tables to see what records are there.
     foreach ($base_tables as $tablename) {
-      print "Examining $tablename...\n";
       $ref_schema = chado_get_schema($tablename);
       $fkeys = $ref_schema['foreign keys'];
       if (!isset($fkeys['cvterm']['columns'])) {
@@ -126,4 +125,4 @@ function tripal_chado_add_cvterm_mapping($cvterm_id, $tablename, $chado_field) {
     ->execute()
     ;
   }
-}
+}

BIN
tripal_ds/theme/fonts/font-awesome-4.7.0/.DS_Store


BIN
tripal_ws/.DS_Store