Browse Source

General improvements

Nick Booher 8 years ago
parent
commit
49a182d59e
2 changed files with 4 additions and 4 deletions
  1. 1 1
      tripal/api/tripal.jobs.api.inc
  2. 3 3
      tripal_bulk_loader/tripal_bulk_loader.module

+ 1 - 1
tripal/api/tripal.jobs.api.inc

@@ -158,7 +158,7 @@ function tripal_is_job_running() {
           "WHERE TJ.end_time IS NULL and NOT TJ.start_time IS NULL ";
   $jobs = db_query($sql);
   foreach ($jobs as $job) {
-    $status = `ps -p $job->pid -o pid=`;
+    $status = shell_exec('ps -p ' . escapeshellarg($job->pid) . ' -o pid=');
     if ($job->pid && $status) {
       // the job is still running so let it go
       // we return 1 to indicate that a job is running

+ 3 - 3
tripal_bulk_loader/tripal_bulk_loader.module

@@ -399,8 +399,8 @@ function tripal_bulk_loader_progess_file_get_progress($job_id, $update_progress
     return (object) array();
   }
 
-  $num_lines = trim(`wc --lines < $filename`);
-  $num_records = trim(`grep -o "." $filename | wc --lines`);
+  $num_lines = trim(shell_exec('wc --lines < ' . escapeshellarg($filename)));
+  $num_records = trim(shell_exec('grep -o "." ' . escapeshellarg($filename) . ' | wc --lines'));
 
   $job = db_query("SELECT j.*, b.file, b.file_has_header, c.num as num_constant_sets
                               FROM {tripal_jobs} j
@@ -418,7 +418,7 @@ function tripal_bulk_loader_progess_file_get_progress($job_id, $update_progress
     if ($job->num_constant_sets != $num_constant_sets_loaded) {
 
       // total lines in input file
-      $total_lines = trim(`wc --lines < $job->file`);
+      $total_lines = trim(shell_exec('wc --lines < ' . escapeshellarg($job->file)));
       if ($job->file_has_header) {
         $total_lines--;
       }