diff options
author | Silvio <silvio@devlet.com.br> | 2010-11-17 18:44:51 -0200 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-11-17 18:44:51 -0200 |
commit | 423b302430fa6eb707d4d492b6d943fa6174fc3b (patch) | |
tree | 5f5ae3cf604a538d27e60debe6e1c5bd1cc3473d /lib/sfIsisImporterManager.class.php | |
parent | 17be361fbd5f39738b78cecff3da64fc8bf4363e (diff) | |
download | sf_isis_importer_plugin-423b302430fa6eb707d4d492b6d943fa6174fc3b.tar.gz sf_isis_importer_plugin-423b302430fa6eb707d4d492b6d943fa6174fc3b.tar.bz2 |
Adding database option to isis:import task
Diffstat (limited to 'lib/sfIsisImporterManager.class.php')
-rw-r--r-- | lib/sfIsisImporterManager.class.php | 27 |
1 files changed, 14 insertions, 13 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); |