Преглед на файлове

Fixed bug of exceeding max length when adding database description. Also, fixed error when loading file in bulk loader. Should have used a try,catch block

spficklin преди 12 години
родител
ревизия
b4819f886d
променени са 2 файла, в които са добавени 12 реда и са изтрити 6 реда
  1. 4 2
      tripal_bulk_loader/tripal_bulk_loader.loader.inc
  2. 8 4
      tripal_db/includes/tripal_db.admin.inc

+ 4 - 2
tripal_bulk_loader/tripal_bulk_loader.loader.inc

@@ -288,8 +288,10 @@ function tripal_bulk_loader_load_data($nid, $job_id) {
     // Open File
     print "\tPreparing to load the current constant set...\n";
     print "\t\tOpen File...\n";
-    $file = new SplFileObject($node->file, 'r');
-    if (!$file) {
+    try {
+      $file = new SplFileObject($node->file, 'r');
+    }
+    catch (Exception $e) {
       watchdog('T_bulk_loader', 'Could not open file %file',
         array($node->file), WATCHDOG_ERROR);
       return;

+ 8 - 4
tripal_db/includes/tripal_db.admin.inc

@@ -135,7 +135,8 @@ function tripal_db_form(&$form_state = NULL, $action = 'Update') {
     '#description'   => t('Please enter the name for this external database.'),
     '#required'      => TRUE,
     '#default_value' => $default_db,
-    '#weight'        => 1
+    '#weight'        => 1,
+    '#maxlength'     => 255,
   );
 
   $form['description']= array(
@@ -143,21 +144,24 @@ function tripal_db_form(&$form_state = NULL, $action = 'Update') {
     '#title'         => t('Description'),
     '#description'   => t('Please enter a description for this database'),
     '#default_value' => $default_desc,
-    '#weight'        => 2
+    '#weight'        => 2,
+    '#maxlength'     => 255,
   );
   $form['url']= array(
     '#type'          => 'textfield',
     '#title'         => t('URL'),
     '#description'   => t('Please enter the web address for this database.'),
     '#default_value' => $default_url,
-    '#weight'        => 3
+    '#weight'        => 3,
+    '#maxlength'     => 255,
   );
   $form['urlprefix']= array(
     '#type'          => 'textfield',
     '#title'         => t('URL prefix'),
     '#description'   => t('Tripal can provide links to external databases when accession numbers or unique identifiers are known.  Typically, a database will provide a unique web address for each accession and the accession usually is the last component of the page address.  Please enter the web address, minus the accession number for this database.  When an accession number is present, Tripal will combine this web address with the accession and provide a link to the external site.'),
     '#default_value' => $default_urlprefix,
-    '#weight'        => 4
+    '#weight'        => 4,
+    '#maxlength'     => 255,
   );