Author: mcantelon
Date: Tue Jan 10 15:18:35 2012
New Revision: 10635
Log:
Added CLI option to skip rows.
Modified:
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Tue Jan 10 15:07:49 2012
(r10634)
+++ trunk/lib/task/csvImportTask.class.php Tue Jan 10 15:18:35 2012
(r10635)
@@ -40,7 +40,8 @@
));
$this->addOptions(array(
- new sfCommandOption('rows-until-update', null,
sfCommandOption::PARAMETER_OPTIONAL, 'Output total rows imported every n rows.')
+ new sfCommandOption('rows-until-update', null,
sfCommandOption::PARAMETER_OPTIONAL, 'Output total rows imported every n
rows.'),
+ new sfCommandOption('skip-rows', null,
sfCommandOption::PARAMETER_OPTIONAL, 'Skip n rows before importing.')
));
$this->namespace = 'csv';
@@ -78,6 +79,8 @@
throw new sfException('rows-until-update must be an integer');
}
+ $skipRows = ($options['skip-rows']) ? $options['skip-rows'] : 0;
+
if (false === $fh = fopen($arguments['filename'], 'rb'))
{
throw new sfException('You must specify a valid filename');
@@ -560,6 +563,6 @@
}
});
- $import->csv($fh);
+ $import->csv($fh, $skipRows);
}
}
--
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.