Browse Source

Tripal Core: Updated to new api function names

Lacey Sanderson 11 years ago
parent
commit
984200e231

+ 16 - 16
tripal_core/includes/chado_install.inc

@@ -13,11 +13,11 @@
 function tripal_core_chado_load_form() {
 
   // we want to force the version of Chado to be set properly
-  $real_version = tripal_core_get_chado_version(TRUE);
+  $real_version = chado_get_version(TRUE);
 
   // get the effective version.  Pass true as second argument
   // to warn the user if the current version is not compatible
-  $version = tripal_core_get_chado_version(FALSE, TRUE);  
+  $version = chado_get_version(FALSE, TRUE);
 
   $form['current_version'] = array(
     '#type' => 'item',
@@ -78,13 +78,13 @@ function tripal_core_chado_load_form_submit($form, &$form_state) {
 function tripal_core_install_chado($action) {
 
   $vsql = "
-    INSERT INTO {chadoprop} (type_id, value) 
+    INSERT INTO {chadoprop} (type_id, value)
       VALUES (
-       (SELECT cvterm_id 
-        FROM {cvterm} CVT 
-          INNER JOIN {cv} CV on CVT.cv_id = CV.cv_id 
-         WHERE CV.name = 'chado_properties' AND CVT.name = 'version'), 
-       :version) 
+       (SELECT cvterm_id
+        FROM {cvterm} CVT
+          INNER JOIN {cv} CV on CVT.cv_id = CV.cv_id
+         WHERE CV.name = 'chado_properties' AND CVT.name = 'version'),
+       :version)
   ";
 
   if ($action == 'Install Chado v1.2') {
@@ -172,19 +172,19 @@ function tripal_core_install_chado($action) {
 function tripal_core_reset_chado_schema() {
 
   // drop current chado and chado-related schema
-  if (tripal_core_schema_exists('chado')) {
+  if (chado_dbschema_exists('chado')) {
     print "Dropping existing 'chado' schema\n";
     db_query("drop schema chado cascade");
   }
-  if (tripal_core_schema_exists('genetic_code')) {
+  if (chado_dbschema_exists('genetic_code')) {
     print "Dropping existing 'genetic_code' schema\n";
     db_query("drop schema genetic_code cascade");
   }
-  if (tripal_core_schema_exists('so')) {
+  if (chado_dbschema_exists('so')) {
     print "Dropping existing 'so' schema\n";
     db_query("drop schema so cascade");
   }
-  if (tripal_core_schema_exists('frange')) {
+  if (chado_dbschema_exists('frange')) {
     print "Dropping existing 'frange' schema\n";
     db_query("drop schema frange cascade");
   }
@@ -192,7 +192,7 @@ function tripal_core_reset_chado_schema() {
   // create the new chado schema
   print "Creating 'chado' schema\n";
   db_query("create schema chado");
-  if (tripal_core_schema_exists('chado')) {
+  if (chado_dbschema_exists('chado')) {
     // before creating the plpgsql language let's check to make sure
     // it doesn't already exists
     $sql = "SELECT COUNT(*) FROM pg_language WHERE lanname = 'plpgsql'";
@@ -216,8 +216,8 @@ function tripal_core_reset_chado_schema() {
  * @ingroup tripal_core
  */
 function tripal_core_install_sql($sql_file) {
-  
-  $chado_local = tripal_core_schema_exists('chado');
+
+  $chado_local = chado_dbschema_exists('chado');
 
   if ($chado_local) {
     db_query("set search_path to chado");
@@ -368,7 +368,7 @@ function tripal_core_install_sql($sql_file) {
 
       if (!$result) {
         $error  = pg_last_error();
-        print "FAILED. Line  $i, $in_string\n$error:\n$query\n\n";        
+        print "FAILED. Line  $i, $in_string\n$error:\n$query\n\n";
         tripal_core_chado_install_done();
         $success = 0;
         return $success;

+ 2 - 2
tripal_core/includes/custom_tables.inc

@@ -365,10 +365,10 @@ function tripal_custom_tables_form_submit($form, &$form_state) {
 
 
   if (strcmp($action, 'Edit') == 0) {
-    tripal_core_edit_custom_table($table_id, $schema_arr['table'], $schema_arr, $skip_creation);
+    chado_edit_custom_table($table_id, $schema_arr['table'], $schema_arr, $skip_creation);
   }
   elseif (strcmp($action, 'Add') == 0) {
-    tripal_core_create_custom_table($schema_arr['table'], $schema_arr, $skip_creation);
+    chado_create_custom_table($schema_arr['table'], $schema_arr, $skip_creation);
   }
   else {
     drupal_set_message(t("No action performed."));

+ 7 - 7
tripal_core/includes/jobs.inc

@@ -111,7 +111,7 @@ function tripal_jobs_report() {
 
   // run the following function which will
   // change the status of jobs that have errored out
-  tripal_jobs_check_running();
+  tripal_is_job_running();
 
   $job_status = '';
   $job_name = '';
@@ -161,9 +161,9 @@ function tripal_jobs_report() {
   // iterate through the jobs and build the table rows
   $rows = array();
   foreach ($jobs as $job) {
-    $submit = tripal_jobs_get_submit_date($job);
-    $start = tripal_jobs_get_start_time($job);
-    $end = tripal_jobs_get_end_time($job);
+    $submit = tripal_get_job_submit_date($job);
+    $start = tripal_get_job_start($job);
+    $end = tripal_get_job_end($job);
     $cancel_link = '';
     if ($job->start_time == 0 and $job->end_time == 0) {
       $cancel_link = "<a href=\"" . url("admin/tripal/tripal_jobs/cancel/" . $job->job_id) . "\">Cancel</a><br />";
@@ -269,9 +269,9 @@ function tripal_jobs_view($job_id) {
   }
 
   // make our start and end times more legible
-  $job->submit_date = tripal_jobs_get_submit_date($job);
-  $job->start_time = tripal_jobs_get_start_time($job);
-  $job->end_time = tripal_jobs_get_end_time($job);
+  $job->submit_date = tripal_get_job_submit_date($job);
+  $job->start_time = tripal_get_job_start($job);
+  $job->end_time = tripal_get_job_end($job);
 
   // construct the table headers
   $header = array('Detail', 'Value');

+ 15 - 15
tripal_core/tripal_core.drush.inc

@@ -169,7 +169,7 @@ function tripal_core_drush_command() {
 }
 
 /**
- * 
+ *
  * @param $username
  */
 function drush_tripal_core_set_user($username) {
@@ -198,21 +198,21 @@ function drush_tripal_core_set_user($username) {
  */
 function drush_tripal_core_tripal_jobs_launch($username) {
   $parallel = drush_get_option('parallel');
-  $job_id = drush_get_option('job_id');  
-  
+  $job_id = drush_get_option('job_id');
+
   drush_tripal_core_set_user($username);
 
   if ($parallel) {
     drush_print("Tripal Job Launcher (in parallel)");
     drush_print("Running as user '$username'");
     drush_print("-------------------");
-    tripal_jobs_launch($parallel, $job_id);
+    tripal_launch_job($parallel, $job_id);
   }
   else {
     drush_print("Tripal Job Launcher");
     drush_print("Running as user '$username'");
     drush_print("-------------------");
-    tripal_jobs_launch(0, $job_id);
+    tripal_launch_job(0, $job_id);
   }
 }
 
@@ -223,8 +223,8 @@ function drush_tripal_core_tripal_jobs_launch($username) {
  */
 function drush_tripal_core_tripal_jobs_rerun($username, $job_id) {
 
-  drush_tripal_core_set_user($username);  
-  $new_job_id = tripal_jobs_rerun($job_id, FALSE);
+  drush_tripal_core_set_user($username);
+  $new_job_id = tripal_rerun_job($job_id, FALSE);
   drush_tripal_core_tripal_jobs_launch($username, $new_job_id);
 
 }
@@ -236,12 +236,12 @@ function drush_tripal_core_tripal_jobs_rerun($username, $job_id) {
  */
 function drush_tripal_core_tripal_jobs_current() {
   $sql =  "
-    SELECT * 
-    FROM {tripal_jobs} TJ 
-    WHERE TJ.end_time IS NULL and NOT TJ.start_time IS NULL 
+    SELECT *
+    FROM {tripal_jobs} TJ
+    WHERE TJ.end_time IS NULL and NOT TJ.start_time IS NULL
   ";
   $jobs = db_query($sql);
-  
+
   foreach ($jobs as $job) {
     $job_pid = $job->pid;
     $output = "Name: " . $job->job_name . "\n" .
@@ -279,7 +279,7 @@ function drush_tripal_core_tripal_update_mview() {
     if ($table_name) {
       // if table_name supplied use that to get mview_id
       $sql = "SELECT mview_id FROM {tripal_mviews} WHERE mv_table = :mv_table";
-      $results = db_query($sql, array(':mv_table' => $table_name));      
+      $results = db_query($sql, array(':mv_table' => $table_name));
       $r = $resuls->fetchObject();
       if (!$r->mview_id) {
         drush_set_error('No Materialized View associated with that table_name.');
@@ -292,7 +292,7 @@ function drush_tripal_core_tripal_update_mview() {
   }
 
   drush_print('Updating the Materialized View with ID=' . $mview_id);
-  $status = tripal_update_mview($mview_id);
+  $status = tripal_populate_mview($mview_id);
   if ($status) {
     drush_log('Materialized View Updated', 'ok');
   }
@@ -319,7 +319,7 @@ function drush_tripal_core_tripal_chadotable_desc($table_name) {
   $section = drush_get_option('section');
 
   drush_print("Schema API Description for $table_name:");
-  $desc = tripal_core_get_chado_table_schema($table_name);
+  $desc = chado_get_schema($table_name);
 
   if (!empty($section)) {
     drush_print("$section = " . print_r($desc[$section], TRUE));
@@ -368,5 +368,5 @@ function drush_tripal_core_tripal_node_sync($module) {
  *  The name of a module with nodes associated with it. For example, feature
  */
 function drush_tripal_core_tripal_node_clean($module) {
-  tripal_core_chado_node_cleanup_orphaned($module, 0);
+  chado_cleanup_orphaned_nodes($module, 0);
 }

+ 75 - 75
tripal_core/tripal_core.install

@@ -13,13 +13,13 @@
 function tripal_core_install() {
 
   // make the data directory for this module
-  $data_dir = tripal_file_directory_path();
+  $data_dir = tripal_get_files_dir();
   if (!file_prepare_directory($data_dir, FILE_CREATE_DIRECTORY)) {
     $message = "Cannot create directory $data_dir. This module may not " .
                "behave correctly without this directory.  Please  create " .
                "the directory manually or fix the problem and reinstall.";
     drupal_set_message(check_plain($message), 'error');
-    tripal_core_report_error('tripal_core', TRIPAL_ERROR, $message, array());
+    tripal_report_error('tripal_core', TRIPAL_ERROR, $message, array());
   }
 
 }
@@ -41,7 +41,7 @@ function tripal_core_schema() {
   // Chado database.
   if (db_table_exists('tripal_custom_tables')) {
     $sql = 'SELECT * FROM {tripal_custom_tables}';
-    $results = db_query($sql);    
+    $results = db_query($sql);
     foreach ($results as $custom) {
       $schema[$custom->table_name] = unserialize($custom->schema);
     }
@@ -98,64 +98,64 @@ function tripal_core_mviews_schema() {
   $schema['tripal_mviews'] = array(
     'fields' => array(
       'mview_id' => array(
-        'type' => 'serial', 
-        'unsigned' => TRUE, 
+        'type' => 'serial',
+        'unsigned' => TRUE,
         'not NULL' => TRUE
       ),
       'name' => array(
-        'type' => 'varchar', 
-        'length' => 255, 
+        'type' => 'varchar',
+        'length' => 255,
         'not NULL' => TRUE
       ),
       'modulename' => array(
-        'type' => 'varchar', 
-        'length' => 50, 
-        'not NULL' => TRUE, 
+        'type' => 'varchar',
+        'length' => 50,
+        'not NULL' => TRUE,
         'description' => 'The module name that provides the callback for this job'
-      ),    
+      ),
       'mv_table' => array(
-        'type' => 'varchar', 
-        'length' => 128, 
+        'type' => 'varchar',
+        'length' => 128,
         'not NULL' => FALSE
       ),
       'mv_specs' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
       'mv_schema' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
       'indexed' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
       'query' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => TRUE
       ),
       'special_index' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
       'last_update' => array(
-        'type' => 'int', 
-        'not NULL' => FALSE, 
+        'type' => 'int',
+        'not NULL' => FALSE,
         'description' => 'UNIX integer time'
       ),
       'status'        => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
       'comment' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
     ),
@@ -184,92 +184,92 @@ function tripal_core_jobs_schema() {
   $schema['tripal_jobs'] = array(
     'fields' => array(
       'job_id' => array(
-        'type' => 'serial', 
-        'unsigned' => TRUE, 
+        'type' => 'serial',
+        'unsigned' => TRUE,
         'not NULL' => TRUE
       ),
       'uid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => TRUE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => TRUE,
         'description' => 'The Drupal userid of the submitee'
       ),
       'job_name' => array(
-        'type' => 'varchar', 
-        'length' => 255, 
+        'type' => 'varchar',
+        'length' => 255,
         'not NULL' => TRUE
       ),
       'modulename' => array(
-        'type' => 'varchar', 
-        'length' => 50, 
-        'not NULL' => TRUE, 
+        'type' => 'varchar',
+        'length' => 50,
+        'not NULL' => TRUE,
         'description' => 'The module name that provides the callback for this job'
       ),
       'callback' => array(
-        'type' => 'varchar', 
-        'length' => 255, 
+        'type' => 'varchar',
+        'length' => 255,
         'not NULL' => TRUE
       ),
       'arguments' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
       'progress' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'default' => 0, 
-        'not NULL' => FALSE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'default' => 0,
+        'not NULL' => FALSE,
         'description' => 'a value from 0 to 100 indicating percent complete'
       ),
       'status' => array(
-        'type' => 'varchar', 
-        'length' => 50, 
+        'type' => 'varchar',
+        'length' => 50,
         'not NULL' => TRUE
       ),
       'submit_date' => array(
-        'type' => 'int', 
-        'not NULL' => TRUE, 
+        'type' => 'int',
+        'not NULL' => TRUE,
         'description' => 'UNIX integer submit time'
       ),
       'start_time' => array(
-        'type' => 'int', 
-        'not NULL' => FALSE, 
+        'type' => 'int',
+        'not NULL' => FALSE,
         'description' => 'UNIX integer start time'
       ),
       'end_time' => array(
-        'type' => 'int', 
-        'not NULL' => FALSE, 
+        'type' => 'int',
+        'not NULL' => FALSE,
         'description' => 'UNIX integer end time'
       ),
       'error_msg' => array(
-        'type' => 'text', 
-        'size' => 'normal', 
+        'type' => 'text',
+        'size' => 'normal',
         'not NULL' => FALSE
       ),
       'pid' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => FALSE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => FALSE,
         'description' => 'The process id for the job'
       ),
       'priority' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => TRUE, 
-        'default' => '0', 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => TRUE,
+        'default' => '0',
         'description' => 'The job priority'
       ),
       'mlock' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => FALSE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => FALSE,
         'description' => 'If set to 1 then all jobs for the module are held until this one finishes'
       ),
       'lock' => array(
-        'type' => 'int', 
-        'unsigned' => TRUE, 
-        'not NULL' => FALSE, 
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not NULL' => FALSE,
         'description' => 'If set to 1 then all jobs are held until this one finishes'
       ),
     ),
@@ -295,17 +295,17 @@ function tripal_core_custom_tables_schema() {
   $schema['tripal_custom_tables'] = array(
     'fields' => array(
       'table_id' => array(
-        'type' => 'serial', 
-        'unsigned' => TRUE, 
+        'type' => 'serial',
+        'unsigned' => TRUE,
         'not NULL' => TRUE
       ),
       'table_name' => array(
-        'type' => 'varchar', 
-        'length' => 255, 
+        'type' => 'varchar',
+        'length' => 255,
         'not NULL' => TRUE
       ),
       'schema' => array(
-        'type' => 'text', 
+        'type' => 'text',
         'not NULL' => TRUE
       ),
     ),

+ 11 - 11
tripal_core/tripal_core.module

@@ -82,11 +82,11 @@ function tripal_core_set_globals() {
   // these variables are stored as globals rather than using the drupal_set_variable
   // functions because the Drupal functions make databaes queries and for long
   // running loaders we don't want those queries repeatedly.
-  $GLOBALS["chado_is_installed"]  = tripal_core_is_chado_installed();
+  $GLOBALS["chado_is_installed"]  = chado_is_installed();
   if ($GLOBALS["chado_is_installed"]) {
-    $GLOBALS["chado_is_local"]      = tripal_core_is_chado_local();
-    $GLOBALS["chado_version"]       = tripal_core_get_chado_version();
-    $GLOBALS["exact_chado_version"] = tripal_core_get_chado_version(TRUE);
+    $GLOBALS["chado_is_local"]      = chado_is_local();
+    $GLOBALS["chado_version"]       = chado_get_version();
+    $GLOBALS["exact_chado_version"] = chado_get_version(TRUE);
   }
 }
 
@@ -241,7 +241,7 @@ function tripal_core_menu() {
   $items['admin/tripal/tripal_jobs/cancel/%'] = array(
     'title' => 'Jobs',
     'description' => 'Cancel a pending job',
-    'page callback' => 'tripal_jobs_cancel',
+    'page callback' => 'tripal_cancel_job',
     'page arguments' => array(4),
     'access arguments' => array('administer tripal'),
     'type' => MENU_CALLBACK,
@@ -249,7 +249,7 @@ function tripal_core_menu() {
   $items['admin/tripal/tripal_jobs/rerun/%'] = array(
     'title' => 'Jobs',
     'description' => 'Re-run an existing job.',
-    'page callback' => 'tripal_jobs_rerun',
+    'page callback' => 'tripal_rerun_job',
     'page arguments' => array(4),
     'access arguments' => array('administer tripal'),
     'type' => MENU_CALLBACK,
@@ -461,17 +461,17 @@ function tripal_core_theme($existing, $type, $theme, $path) {
     // --------------------------------
     // Properties Node Form
     'chado_node_properties_form_table' => array(
-      'function' => 'theme_chado_node_properties_form_table',
+      'function' => 'theme_chado_add_node_form_properties',
       'render element' => 'element',
     ),
     // Additional Dbxrefs Nore Form
     'chado_node_additional_dbxrefs_form_table' => array(
-      'function' => 'theme_chado_node_additional_dbxrefs_form_table',
+      'function' => 'theme_chado_add_node_form_dbxrefs_table',
       'render element' => 'element',
     ),
     // Relationships Nore Form
     'chado_node_relationships_form_table' => array(
-      'function' => 'theme_chado_node_relationships_form_table',
+      'function' => 'theme_chado_add_node_form_relationships_tables',
       'render element' => 'element',
     ),
 
@@ -487,7 +487,7 @@ function tripal_core_theme($existing, $type, $theme, $path) {
 
 /**
  * Implements hook_job_describe_args().
- * Describes the arguements for the tripal_update_mview job to allow for greater
+ * Describes the arguements for the tripal_populate_mview job to allow for greater
  * readability in the jobs details pages.
  *
  * @param $callback
@@ -503,7 +503,7 @@ function tripal_core_theme($existing, $type, $theme, $path) {
  */
 function tripal_core_job_describe_args($callback, $args) {
   $new_args = array();
-  if ($callback == 'tripal_update_mview') {
+  if ($callback == 'tripal_populate_mview') {
     // get this mview details
     $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id ";
     $results = db_query($sql, array(':mview_id' => $args[0]));

+ 1 - 1
tripal_core/tripal_launch_jobs.php

@@ -44,7 +44,7 @@ fwrite($stdout, "Tripal Job Launcher\n");
 fwrite($stdout, "Running as user ' . $username . '\n");
 fwrite($stdout, "-------------------\n");
 
-tripal_jobs_launch($do_parallel);
+tripal_launch_job($do_parallel);
 
 /**
  * Print out the usage instructions if they are not followed correctly

+ 2 - 2
tripal_core/tripal_launch_jobs_multi.php

@@ -106,9 +106,9 @@ function runjob($sitename, $username) {
     fwrite($stdout, "'$username' is not a valid Drupal username. exiting...\n");
     exit;
   }
-  
+
   global $user;
   $user = user_load($u->uid);
 
-  tripal_jobs_launch();
+  tripal_launch_job();
 }