Esempio n. 1
0
    }
}
$importConfig = new $options['arguments'][0]();
if ($importConfig->getContentClass() instanceof eZContentClass === false) {
    $cli->error('Import config hasn`t a valid content class');
    $script->shutdown(1);
}
if ($importConfig instanceof nxcImportConfig === false) {
    $cli->error('Class "' . $options['arguments'][0] . '" isn`t a valid import config');
    $script->shutdown(1);
}
if (count($filterAttributes) > 0) {
    $importConfig->setFilterAttributes($filterAttributes);
}
$importController = new nxcImportController($importConfig, $cli);
$importController->log('Starting import for ' . $importConfig, array('blue'));
$startTime = microtime(true);
$importController->run($remove, $useStateHashes, $update, $create);
$executionTime = round(microtime(true) - $startTime, 2);
$importController->log('Import took ' . $executionTime . ' secs.');
$importController->log('Created ' . $importController->counter['create'] . ' objects, updated ' . $importController->counter['update'] . ' objects, skiped ' . $importController->counter['skip'] . ' object.');
$importController->log('Available objects in feed: ' . count($importController->config->dataList) . '.');
if ($importController->counter['create'] + $importController->counter['update'] > 0) {
    $speed = round(($importController->counter['create'] + $importController->counter['update']) / $executionTime, 2);
    $importController->log('Average speed: ' . $speed . ' objects/sec.');
}
if ($importController->counter['remove'] > 0) {
    $importController->log($importController->counter['remove'] . ' objects was removed');
}
unset($importController);
$script->shutdown(0);