Author: mcantelon
Date: Thu Aug 23 15:16:22 2012
New Revision: 12183

Log:
Added support for --quiet option to CSV CLI import.

Modified:
   trunk/lib/QubitFlatfileImport.class.php
   trunk/lib/task/import/csvImportTask.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Thu Aug 23 15:06:47 2012        
(r12182)
+++ trunk/lib/QubitFlatfileImport.class.php     Thu Aug 23 15:16:22 2012        
(r12183)
@@ -30,6 +30,7 @@
   public $context;                   // optional sfContext
   public $className;                 // optional class name of object to 
create/save
   public $errorLog;                  // optional location of error log file
+  public $displayProgress = true;    // display progress by default
   public $rowsUntilProgressDisplay;  // optional display progress every n rows
 
   public $status          = array(); // place to store data related to overall 
import
@@ -462,8 +463,10 @@
 
         $this->status['rows']++;
 
-        print $this->renderProgressDescription();
-
+        if ($this->displayProgress)
+        {
+          print $this->renderProgressDescription();
+        }
       } else {
         $this->status['rows']++;
       }

Modified: trunk/lib/task/import/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportTask.class.php       Thu Aug 23 15:06:47 
2012        (r12182)
+++ trunk/lib/task/import/csvImportTask.class.php       Thu Aug 23 15:16:22 
2012        (r12183)
@@ -147,6 +147,9 @@
       /* What type of object are we importing? */
       'className' => 'QubitInformationObject',
 
+      /* Allow silencing of progress info */
+      'displayProgress' => ($options['quiet']) ? false : true,
+
       /* How many rows should import until we display an import status update? 
*/
       'rowsUntilProgressDisplay' => $options['rows-until-update'],
 

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to