Path

ez projects / xrowmetadata / forum / general / error with differnent rootn... / re: error with differnent r...


error with differnent RootNodes

You need to be logged in to post messages in the forums. New users may register here.

Andreas Adelsberger

Member since:
13 December 2005

Posts: 12

Thursday 22 December 2011 12:15:04 pm

Hi,

first of all really nice work;-). I found a but if your siteaccess have different RootNodes defined in different siteaccesses.

settings/xrowsitemap.ini.append.php:



AvailableSiteAccessList[]


AvailableSiteAccessList[]=access1


AvailableSiteAccessList[]=access2




settings/siteaccess/access1/content.ini



[NodeSettings]


RootNode=1205




settings/siteaccess/access2/content.ini



[NodeSettings]


RootNode=1423




The problem in extension/xrowmetadata/classes/xrowsitemaptools.php in line 461:
$node_id = eZINI::instance( 'content.ini' )->variable( 'NodeSettings', 'RootNode' );

It seems like changing the siteaccess has no affect on the eZINI::instance. So $node_id remains the same value as set in the very first siteaccess. A quick fix for me worked for now, but i thought that eZINI::instance takes care about the current siteaccess!




--- a/extension/xrowmetadata/classes/xrowsitemaptools.php


+++ b/extension/xrowmetadata/classes/xrowsitemaptools.php


@@ -288,6 +288,9 @@ class xrowSitemapTools


    public static function createSitemap()


    {


        eZDebug::writeDebug( "Generating Standard Sitemap ...", __METHOD__ );


+


+              self::$rootNode=null;


+


        eZContentLanguage::expireCache();


        $cli = $GLOBALS['cli'];


        global $cli, $isQuiet;


@@ -458,7 +461,8 @@ public static $rootNode;


    {


       if( self::$rootNode === null )


       {


-       $node_id = eZINI::instance( 'content.ini' )->variable( 'NodeSettings', 'RootNode' );


+       $node_id =


+                      eZINI::instance('content.ini.append.php',"settings/siteaccess/".$GLOBALS['eZCurrentAccess']['name'])->variable( 'NodeSettings', 'RootNode' );


        $rootNode = eZContentObjectTreeNode::fetch( $node_id );


 

        if ( ! $rootNode instanceof eZContentObjectTreeNode )




greetz Andi

---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

Up

Björn Dieding@xrow.de

Member since:
07 March 2003

Posts: 47

Thursday 05 January 2012 7:08:55 pm

This patch is invalid for the described problem.

The ID can`t be loaded like that eZINI::instance('content.ini.append.php',"settings/siteaccess/".$GLOBALS['eZCurrentAccess']['name'])->variable( 'NodeSettings', 'RootNode' );

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Up

Andreas Adelsberger

Member since:
13 December 2005

Posts: 12

Monday 09 January 2012 9:37:12 am

Hi Björn,

the formatting of the code was not nice so I modified the patch.

Fetching the node_id works like this:



$node_id = eZINI::instance('content.ini.append.php',"settings/siteaccess/".$GLOBALS['eZCurrentAccess']['name'])->variable( 'NodeSettings', 'RootNode' );




Patch:



--- a/extension/xrowmetadata/classes/xrowsitemaptools.php


+++ b/extension/xrowmetadata/classes/xrowsitemaptools.php


@@ -288,6 +288,9 @@ class xrowSitemapTools


    public static function createSitemap()


    {


        eZDebug::writeDebug( "Generating Standard Sitemap ...", __METHOD__ );


+


+      self::$rootNode=null;


+


        eZContentLanguage::expireCache();


        $cli = $GLOBALS['cli'];


        global $cli, $isQuiet;


@@ -458,7 +461,7 @@ public static $rootNode;


    {


       if( self::$rootNode === null )


       {


-       $node_id = eZINI::instance( 'content.ini' )->variable( 'NodeSettings', 'RootNode' );


+       $node_id = eZINI::instance('content.ini.append.php',"settings/siteaccess/".$GLOBALS['eZCurrentAccess']['name'])->variable( 'NodeSettings', 'RootNode' );


        $rootNode = eZContentObjectTreeNode::fetch( $node_id );


 

        if ( ! $rootNode instanceof eZContentObjectTreeNode )


---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

Up

You need to be logged in to post messages in the forums. New users may register here.