Forums / Extensions / Sqliimport and multilocation

Sqliimport and multilocation

Author Message

SEBBANE Alexandre

Monday 02 May 2011 1:21:25 am

Hello,

i use to work with sqliimport but i try to do multilocation and it does not succeed :

here is a part of my code which work :

$contentOptions = new SQLIContentOptions( array(
'class_identifier' => 'agence',
'remote_id' => (string)md5($row->etab."-".$row->guichet),
'creator_id' => 14
) );
$content = SQLIContent::create( $contentOptions );
$content->fields->nom_du_guichet = (string) $row->nomguichet;
$content->fields->entite = (string) $row->etab;
$content->addLocation( SQLILocation::fromNodeID( $parentnodeid ) );

$publisher = SQLIContentPublisher::getInstance();
$publisher->publish( $content );

the same with multilocation to contentroot et mediaroot doesn't work :

 

$contentOptions = new SQLIContentOptions( array(
'class_identifier' => 'agence',
'remote_id' => (string)md5($row->etab."-".$row->guichet),
'creator_id' => 14
) );
$content = SQLIContent::create( $contentOptions );
$content->fields->nom_du_guichet = (string) $row->nomguichet;
$content->fields->entite = (string) $row->etab;
$content->addLocation( SQLILocation::fromNodeID( $parentnodeid ) );
$content->addLocation( SQLILocation::fromNodeID( 2 ) );
$content->addLocation( SQLILocation::fromNodeID( 43 ) );

$publisher = SQLIContentPublisher::getInstance();
$publisher->publish( $content );

thanks a lot for your help.

Alexandre

Paris, France

Jérôme Vieilledent

Monday 02 May 2011 2:20:41 am

Hi Alex

It seems to be a simple right access issue. Does your import user has the right to create/edit content in the media section ?

SEBBANE Alexandre

Monday 02 May 2011 2:33:24 am

hello,

14 is the admin ....

Alexandre

Paris, France

Jérôme Vieilledent

Monday 02 May 2011 2:41:20 am

Yes, but there is no login action here...

Try this in your sqliimport.ini :

[ImportSettings]
RobotUserID=14

With that setting, the admin will be logged in. Without it, Anonymous User is used. The creator_id option is different. It's for forcing a user as content owner.

SEBBANE Alexandre

Monday 02 May 2011 2:48:25 am

I try to do this but nothing change ...

How the first code work with anonymous ? anonimous don't have any rights to write .... so i do'nt understand.

Alexandre

Paris, France

Jérôme Vieilledent

Monday 02 May 2011 3:02:38 am

"

I try to do this but nothing change ...

How the first code work with anonymous ? anonimous don't have any rights to write .... so i do'nt understand.

Alexandre

"

When creating/editing content via script, security policies are not always checked.

Do you have anything in your logs (error.log / sqliimport logs) ?

SEBBANE Alexandre

Monday 02 May 2011 3:17:52 am

Cool it's works.... You rock.

i 'am using : sqliimport 1.2.1 et ezpublish 4.5 community

Alexandre

Thanks ...

Paris, France