tripal/trpdownload_api

Compatibility with Tripal 3

laceysanderson opened this issue · 1 comments

The Tripal Download API needs very little to make it compatible with Tripal 3. Really, the only change needed should be to change the dependency from tripal_core to tripal, since the Jobs API is supposed to be backwards compatible.

It turns out there is currently a new feature which breaks backwards compatibility: tripal/tripal#280. While we wait on that discussion the following patch will allow the Download API to work with Tripal 3.

diff --git a/trpdownload_api.info b/trpdownload_api.info
index 15dba75..411b23c 100644
--- a/trpdownload_api.info
+++ b/trpdownload_api.info
@@ -4,4 +4,4 @@ description = Provides an api for creating download pages. Uses tripal Jobs to g
 version = 7.x-0.x
 core = 7.x
 
-dependencies[] = tripal_core
+dependencies[] = tripal
diff --git a/trpdownload_api.module b/trpdownload_api.module
index b732d0a..9de494b 100644
--- a/trpdownload_api.module
+++ b/trpdownload_api.module
@@ -193,11 +193,14 @@ function trpdownload_api_prepare_download_page_vars(&$variables) {
     if (isset($info['functions']['generate_file']) AND function_exists($info['functions']['generate_file'])) {
       global $user;
       $variables['job_id'] = tripal_add_job(
-        'Download '.$info['type_name'],
-        'trpdownload_api',
-        $info['functions']['generate_file'],
-        array('variables' => $variables['download_args']),
-        $user->uid
+        'Download '.$info['type_name'],                          // job name
+        'trpdownload_api',                                       // module machine name
+        $info['functions']['generate_file'],                     // function to exec.
+        array('variables' => $variables['download_args']),       // args for function
+        $user->uid,                                              // user
+        10,                                                      // priority
+        array(),                                                 // files to include
+        FALSE                                                    // ignore duplicates
       );
 
       // Encode the URL.