imrpove dry-run and cli

This commit is contained in:
Cornelius Weiß 2007-06-21 18:07:31 +00:00
parent 5d9ff65391
commit 1c7e180154
4 changed files with 10 additions and 25 deletions

View File

@ -138,20 +138,20 @@
}
require_once('inc/class.definition.inc.php');
try {
$definition = new definition($definition);
}
catch (Exception $e) {
fwrite(STDERR,"importexport_cli: ". $e->getMessage(). "\n");
if( $definition->get_identifier() < 1 ) {
fwrite(STDERR,"importexport_cli: Definition not found! \n");
exit(INVALID_OPTION);
}
$GLOBALS['egw_info']['flags']['currentapp'] = $definition->application;
$definition->plugin_options['dry_run'] = $dryrun;
$type = $definition->type;
require_once("$path_to_egroupware/$definition->application/importexport/class.$definition->plugin.inc.php");
$po = new $definition->plugin;
$po->plugin_options['dry-run'] = true;
$type = $definition->type;
$resource = fopen( $file, 'r' );
$po->$type( $resource, $definition );

View File

@ -54,22 +54,6 @@ class bodefinitions {
return $this->definitions;
}
/**
* reads a definition from database
*
* @deprecated see class.definition.inc.php
* @param mixed &$definition
* @return bool success or not
*/
public function read(&$definition) {
if(is_int($definition)) $definition = array('definition_id' => $definition);
elseif(is_string($definition)) $definition = array('name' => $definition);
if(!$definition = $this->so_sql->read($definition)) return false;
$definition += (array)unserialize($definition['plugin_options']);
unset($definition['plugin_options']);
return true;
}
/**
* deletes a defintion
*

View File

@ -217,7 +217,7 @@ class definition implements iface_egw_record {
/**
* gets identifier of this record
*
* @return string identifier of this record
* @return int identifier of this record
*/
public function get_identifier() {
return $this->definition['definition_id'];

View File

@ -209,6 +209,7 @@ class import_csv implements iface_import_record { //, Iterator {
$record = $this->record;
$this->record = array();
foreach ($this->mapping as $cvs_idx => $new_idx) {
if( $new_idx == '' ) continue;
$this->record[$new_idx] = $record[$cvs_idx];
}
return true;