Author
|
Message
|
Jonathan Clavier
|
Wednesday 11 May 2011 5:56:36 am
Hello, I would like to import the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<test>
<article>
<title>France</title>
<intro>fr</intro>
</article>
<article>
<title>Allemagne</title>
<intro>al</intro>
</article>
<article>
<title>Italie</title>
<intro>it</intro>
</article>
</test> and I created class with the process method TestImportHandler following:
// $row is a SimpleXMLElement object
$this->currentGUID = $row->intro;
$contentOptions = new SQLIContentOptions( array(
'class_identifier' => 'article',
'remote_id' => (string)$row->intro
) );
print (string)$row->title;
$content = SQLIContent::create( $contentOptions );
$content->fields->title = (string)$row->title;
$content->fields->intro = (string)$row->intro;
// Now publish content
$content->addLocation( SQLILocation::fromNodeID( $this->handlerConfArray['DefaultParentNodeID'] ) );
$publisher = SQLIContentPublisher::getInstance();
$publisher->publish( $content );
// Free some memory. Internal methods eZContentObject::clearCache() and eZContentObject::resetDataMap() will be called
// @see SQLIContent::__destruct()
unset( $content ); and I changed the sqliimport config :
[testimporthandler-HandlerSettings]
Enabled=true
Name=Test XML
ClassName=TestImportHandler
Debug=enabled
DefaultParentNodeID=2
xmlFile=/var/www/ez/extension/sqliimport/stubs/test.xml but, the xml is not imported. Progress remains at 0. No error log. What is my mistake?
|
Amine BETARI
|
Wednesday 11 May 2011 6:50:55 am
Salam I think you missed a few lines in the config sqliimport,
[ImportSettings] AvailableSourceHandlers[]=Testimporthandler
|
Jonathan Clavier
|
Wednesday 11 May 2011 7:01:11 am
No, I already added this code, but it still does not.
[ImportSettings]
AvailableSourceHandlers[]=testimporthandler The import appears in the list.
|
Amine BETARI
|
Wednesday 11 May 2011 10:28:40 am
according to the source code as you showed, you use the article class, while the latter has the field as a block Intro XML, an XML attribute necks you get it this way:
$htmlMessage = '<p>My <strong>HTML</strong> content</p>';
$parser = new SQLIXMLInputParser();
$parser->setParseLineBreaks( true );
$document = $parser->process( $htmlMessage ); // Result is a DOM Document
$eZXMLString = eZXMLTextType::domString( $document ); But I am not sure, it remains a test solution
|
Jonathan Clavier
|
Thursday 12 May 2011 12:05:38 am
Thank you, that was the problem. I manage to create these items, but only with this command:
php extension/sqliimport/bin/php/sqlidoimport.php
Why backend import does not work?
|
Amine BETARI
|
Thursday 12 May 2011 3:33:21 am
Salam,
I think you need to use the commands classes exist to learn: php extension/sqliimport/bin/php/sqlidoimport.php --list-source-handlers And to initiate an import specific you had to use this command php extension/sqliimport/bin/php/sqlidoimport.php --source-handlers = testimporthandler Merci Amine Blog perso : www.abetari.com
|
Jonathan Clavier
|
Thursday 12 May 2011 7:51:22 am
Hello, I manage to import with the shell but not with the interface. Jonathan
|
Amine BETARI
|
Thursday 12 May 2011 9:07:34 am
Yes, or is it the problem is, you need only launched this command: php extension/sqliimport/bin/php/sqlidoimport.php --source-handlers = testimporthandler
|
Jonathan Clavier
|
Thursday 12 May 2011 9:45:17 am
I do not understand the interest of creating an admin interface like this it does not execute the command without.
|
Alex Muñoz
|
Wednesday 18 May 2011 4:54:47 am
I'm trying to execute via command line my own handler, but I can't continue with the proves, this message appear:
"Another import is already running. Aborting..."
I tried to delete all cachés, delete all imports in control panel and restart the apache, but nothing happened
What can I do? Thanks
|
Jérôme Vieilledent
|
Wednesday 18 May 2011 7:11:06 am
"
I do not understand the interest of creating an admin interface like this it does not execute the command without.
"
You need to run the cronjob in the crontab, as it is spotted in the doc ;) http://svn.projects.ez.no/sqliimport/trunk/doc/INSTALL.txt
|
Jérôme Vieilledent
|
Wednesday 18 May 2011 7:14:39 am
"
I'm trying to execute via command line my own handler, but I can't continue with the proves, this message appear:
"Another import is already running. Aborting..."
I tried to delete all cachés, delete all imports in control panel and restart the apache, but nothing happened
What can I do? Thanks
"
Maybe one of your previous imports failed (are you debugging ?). You can fix this by deleting the sqliimport_status entry from ezsite_data table.
|
Jonathan Clavier
|
Wednesday 18 May 2011 7:26:03 am
Thank you, I had a problem in the cron
|
Alex Muñoz
|
Wednesday 18 May 2011 9:39:29 am
Thanks, it runs perfectly
|