diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sfIsisImporterManager.class.php | 27 | ||||
-rw-r--r-- | lib/task/isisImportTask.class.php | 3 |
2 files changed, 16 insertions, 14 deletions
diff --git a/lib/sfIsisImporterManager.class.php b/lib/sfIsisImporterManager.class.php index bd799d3..ce65c7b 100644 --- a/lib/sfIsisImporterManager.class.php +++ b/lib/sfIsisImporterManager.class.php @@ -81,8 +81,17 @@ class sfIsisImporterManager extends IsisConnector * * @return array Available databases */ - public function databases() + public function databases($databases = null) { + if (is_array($databases)) + { + return $databases; + } + elseif ($databases != null && !is_array($databases)) + { + return array($databases); + } + $databases = array(); foreach (glob(sfConfig::get('sf_lib_dir') ."/cinisis/schemas/*.yaml") as $file) @@ -111,18 +120,10 @@ class sfIsisImporterManager extends IsisConnector */ public function info($caller, $section = 'info', $databases = null) { - // Additional logging settings. + // Setup. $this->logger->setCaller($caller); $this->logger->setSection($section); - - if ($databases == null) - { - $databases = $this->databases(); - } - elseif (!is_array($databases)) - { - $databases = array($databases); - } + $databases = $this->databases($databases); foreach ($databases as $database) { @@ -162,13 +163,13 @@ class sfIsisImporterManager extends IsisConnector * @param string $section Caller section (whether an action or task) * @param int $entries Number of entries to import (defaults to all) */ - public function massImport($caller, $section, $entries = null, $offset = 0) + public function massImport($caller, $section, $entries = null, $offset = 0, $databases = null) { // Additional logging settings. $this->logger->setCaller($caller); $this->logger->setSection($section); - foreach ($this->databases() as $database) + foreach ($this->databases($databases) as $database) { // Open database. $importer = $this->newImporter($database); diff --git a/lib/task/isisImportTask.class.php b/lib/task/isisImportTask.class.php index 660c106..124932c 100644 --- a/lib/task/isisImportTask.class.php +++ b/lib/task/isisImportTask.class.php @@ -11,6 +11,7 @@ class isisImportTask extends mySfTask new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'), new sfCommandOption('loglevel', 'l', sfCommandOption::PARAMETER_REQUIRED, 'Log level', 'info'), + new sfCommandOption('database', 'd', sfCommandOption::PARAMETER_REQUIRED, 'Database', null), )); $this->namespace = 'isis'; @@ -42,6 +43,6 @@ EOF; } // Mass ISIS import. - $isis->massImport($this, 'task', $arguments['rows'], $arguments['offset']); + $isis->massImport($this, 'task', $arguments['rows'], $arguments['offset'], $options['database']); } } |