Author: mcantelon
Date: Thu Jan 12 16:51:56 2012
New Revision: 10664
Log:
Made source name a CLI option as you don't want to use the filename for it if
you're importing more than one CSV file.
Modified:
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Thu Jan 12 16:19:53 2012
(r10663)
+++ trunk/lib/task/csvImportTask.class.php Thu Jan 12 16:51:56 2012
(r10664)
@@ -42,7 +42,8 @@
$this->addOptions(array(
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.'),
- new sfCommandOption('error-log', null,
sfCommandOption::PARAMETER_OPTIONAL, 'File to log errors to.')
+ new sfCommandOption('error-log', null,
sfCommandOption::PARAMETER_OPTIONAL, 'File to log errors to.'),
+ new sfCommandOption('source-name', null,
sfCommandOption::PARAMETER_OPTIONAL, 'Source name to use when inserting keymap
entries.')
));
$this->namespace = 'csv';
@@ -81,6 +82,10 @@
$skipRows = ($options['skip-rows']) ? $options['skip-rows'] : 0;
+ $sourceName = ($options['source-name'])
+ ? $options['source-name']
+ : basename($arguments['filename']);
+
if (false === $fh = fopen($arguments['filename'], 'rb'))
{
throw new sfException('You must specify a valid filename');
@@ -125,7 +130,7 @@
from closure logic using the getStatus method */
'status' => array(
'options' => $options,
- 'sourceName' => 'cva_import',
//basename($arguments['filename']),
+ 'sourceName' => $sourceName,
'materialTypes' => $termData['materialTypes'],
'copyrightStatusTypes' => $termData['copyrightStatusTypes']
),
--
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.