if (isset($options['list-source-handlers'])) { if ($aAvailableSourceHandlers) { $cli->notice('Available source handlers :'); $cli->warning(implode(', ', $aAvailableSourceHandlers)); } else { $cli->error('No source handler defined !'); } $script->shutdown(); } else { /* * Process requested import handlers * An SQLIImportItem object will be created and stored in DB for each handler */ $requestedHandlers = $options['source-handlers'] ? $options['source-handlers'] : ''; $aRequestedHandlers = $requestedHandlers ? explode(',', $requestedHandlers) : $importINI->variable('ImportSettings', 'AvailableSourceHandlers'); $areValidHandlers = SQLIImportFactory::checkExistingHandlers($aRequestedHandlers); // An exception may be thrown if a handler is not defined in sqliimport.ini if ($aRequestedHandlers) { $aHandlersOptions = SQLIImportHandlerOptions::decodeHandlerOptionLine($options['options']); $importUser = eZUser::fetchByName('admin'); // As this is a manual script, "Admin" user will be used to import $aImportItems = array(); // First stores an SQLIImportItem for each handler to process foreach ($aRequestedHandlers as $handler) { $handlerOptions = isset($aHandlersOptions[$handler]) ? $aHandlersOptions[$handler] : null; $pendingImport = new SQLIImportItem(array('handler' => $handler, 'user_id' => $importUser->attribute('contentobject_id'))); if ($handlerOptions instanceof SQLIImportHandlerOptions) { $pendingImport->setAttribute('options', $handlerOptions); } $pendingImport->store(); $aImportItems[] = $pendingImport;