فهرست منبع

Fix to GFF loader

Stephen Ficklin 8 سال پیش
والد
کامیت
0781d162e5

+ 19 - 7
tripal_core/tripal_launch_jobs.php → tripal_core/tripal_launch_job.php

@@ -11,11 +11,27 @@
 $stdout = fopen('php://stdout', 'w');
 
 // we require one command-line argument
-if (sizeof($argv) < 2) {
+if (sizeof($argv) < 5) {
   print_usage($stdout);
   exit;
 }
 
+$job_id = $argv[1];
+$root = $argv[2];
+$username = $argv[3];
+$do_parallel = $argv[4];
+
+/**
+ * Root directory of Drupal installation.
+ */
+define('DRUPAL_ROOT', getcwd());
+
+
+
+require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
+drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+menu_execute_active_handler();
+
 $drupal_base_url = parse_url('http://www.example.com');
 $_SERVER['HTTP_HOST'] = $drupal_base_url['host'];
 //  $_SERVER['PHP_SELF'] = $drupal_base_url['path'].'/index.php';
@@ -23,12 +39,8 @@ $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
 $_SERVER['REMOTE_ADDR'] = NULL;
 $_SERVER['REQUEST_METHOD'] = NULL;
 
-require_once 'includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
-// check to make sure the username is valid
-$username = $argv[1];
-$do_parallel = $argv[2];
+
 $results = db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username));
 $u = $results->fetchObject();
 if (!$u) {
@@ -53,6 +65,6 @@ tripal_launch_job($do_parallel);
  */
 function print_usage($stdout) {
   fwrite($stdout, "Usage:\n");
-  fwrite($stdout, "  php ./sites/all/modules/tripal_core/tripal_launch_jobs <username> \n\n");
+  fwrite($stdout, "  php tripal_launch_job <job_id> <drupal_root_path> <username> <do parallel>\n\n");
   fwrite($stdout, "    where <username> is a Drupal user name\n\n");
 }

+ 0 - 114
tripal_core/tripal_launch_jobs_multi.php

@@ -1,114 +0,0 @@
-<?php
-
-/**
- * @file
- * This script can be used to launch jobs on a multi-site Drupal installation
- */
-
-include_once './includes/bootstrap.inc';
-
-fwrite(STDOUT, "Running Tripal Job Launcher\n");
-
-/**
- * SETTINGS
- */
-
-//the location of the 'sites' directory relative to this script.
-$sites_dir = 'sites';
-$debug=0;
-
-/**
- * END SETTINGS
- */
-
-//error_reporting(E_ALL);
-
-include ("Console/Getopt.php");
-
-// initialize object
-$cg = new Console_Getopt();
-
-/* define list of allowed options - p = h:sitename, u:username  */
-$allowed_short_options = "h:u:";
-
-// read the command line
-$args = $cg->readPHPArgv();
-
-// get the options
-$ret = $cg->getopt($args, $allowed_short_options);
-
-// check for errors and die with an error message if there was a problem
-if (PEAR::isError($ret)) {
-    die("Error in command line: " . $ret->getMessage() . "\n");
-}
-
-ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . './scripts');
-
-/*
- * This doesn't work in every case: getopt function is not always available
-  $options = getopt("h:r:");
-  var_dump($options);
- */
-
-$hostname = "";
-$username = "";
-
-// parse the options array
-$opts = $ret[0];
-if (sizeof($opts) > 0) {
-    // if at least one option is present
-    foreach ($opts as $opt) {
-        switch ($opt[0]) {
-            case 'h':
-                $hostname = $opt[1];
-                break;
-            case 'u':
-                $username = $opt[1];
-                break;
-            default:
-                fwrite(STDOUT, 'Usage: \n');
-                fwrite(STDOUT, '- h hostname\n');
-                fwrite(STDOUT, " -u username\n");
-                break;
-
-        }
-    }
-}
-else {
-  fwrite(STDOUT, "Usage: \n");
-  fwrite(STDOUT, " -h hostname\n");
-  fwrite(STDOUT, " -u username\n");
-
-}
-
-runjob($hostname, $username);
-
-/**
- * Runs tripal_launch_jobs() as the specified user
- *
- * @ingroup tripal_core
- */
-function runjob($sitename, $username) {
-  global $user;
-
-  $_SERVER['SCRIPT_NAME'] = '/sites/all/modules/tripal_jobs/tripal_launch_jobs_multi.php';
-  $_SERVER['SCRIPT_FILENAME'] = '/sites/all/modules/tripal_jobs/tripal_launch_jobs_multi.php';
-  $_SERVER['HTTP_HOST'] = $sitename;
-  $_SERVER['REMOTE_ADDR'] = 'localhost';
-  $_SERVER['REQUEST_METHOD'] = 'GET';
-
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
-  // check to make sure the username is valid
-  $results = db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username));
-  $u = $results->fetchObject();
-  if (!$u) {
-    fwrite($stdout, "'$username' is not a valid Drupal username. exiting...\n");
-    exit;
-  }
-
-  global $user;
-  $user = user_load($u->uid);
-
-  tripal_launch_job();
-}

+ 3 - 1
tripal_feature/includes/tripal_feature.gff_loader.inc

@@ -1348,8 +1348,10 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents,
           'fmin' => $fmin,
           'fmax' => $fmax,
           'strand' => $strand,
-          'phase' => $phase,
         );
+        if ($phase) {
+          $values['phase'] = $phase;
+        }
         $result = chado_insert_record('tripal_gffcds_temp', $values);
         if (!$result) {
           tripal_report_error('tripal_feature', TRIPAL_ERROR, "Cound not save record in temporary CDS table, Cannot continue.", array());

+ 1 - 1
tripal_feature/tripal_feature.install

@@ -132,7 +132,7 @@ function tripal_feature_add_tripal_gffcds_temp_table($skip_recreate = TRUE) {
       ),
       'phase' => array(
         'type' => 'int',
-        'not null' => TRUE,
+        'not null' => FALSE,
       ),
       'strand' => array(
         'type' => 'int',