Thursday 13 January 2011 11:25:37 am
Hello, I've run into a couple problems with the ezcontentobject_tree table. Mainly, the two fields of 'path_identification_string' and 'path_string' seem to be inaccurate from time to time. The 'path_identification_string' is the least of the worries since this can be easily rectified by running the mentioned script (updateniceurls.php). However, I do see on occasion an incorrect 'path_string'. I think this mainly happens when an upgrade to the database is attempted. Nevertheless, if one is going to the trouble of running the script in general, It would be nice to see 'path_string' included in the process.
I've already created a function and added it to my own install. I listed the function here:
function updatePathString( $node )
{
$parentNode = $node->attribute( 'parent' );
$pathString = $parentNode->attribute( 'path_string' ).$node->attribute( 'node_id' ).'/';
if( $node->attribute( 'path_string' ) != $pathString )
{
$node->setAttribute( 'path_string', $pathString );
$node->sync();
} } The call would be as shown:
foreach ( array_keys( $nodeList ) as $key )
{
$node = $nodeList[ $key ];
updatePathString( $node ); $hasChanged = $node->updateSubTreePath(); As you can see, its fairly simple and does the job. Thanks, -erik
|