confused by owner, creator, modified, created, published, ..

Author Message

*- pike

Tuesday 02 June 2009 1:38:22 pm

Hi

ezpublish has a number of attributes to choose from to show the history of a node, object, or version. I've found

    * $node.creator (contentobjecttreenode)
    * $node.object.owner (contentobject)
    * $node.object.current.creator (contentobjectversion)
    * $node.object.modified (contentobject)
    * $node.object.published (contentobject)
    * $node.object.current.created (contentobjectversion)
    * $node.object.current.modified (contentobjectversion)

It seems all these values can be different. how do they relate to each other ?
and then, when doing a fetch("content","list", you can sort results by

   * 'sort_by',array('modified',false())
   * 'sort_by',array('published',false())

which values does that refer to ?

confused,
*-pike

---------------
The class eZContentObjectTreeNode does.

Ivo Lukac

Wednesday 03 June 2009 12:41:14 am

'creator' - user who modified (last) version
'owner' - user who created first version, original creator
'published' - time of first creation (can be changed with workflow)
'modified' - time of version change

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

*- pike

Wednesday 03 June 2009 5:34:52 am

hi

so

'owner' = $node.object.owner == $node.object.versions[0].creator
'creator' = $node.creator == $node.object.current.creator
'modified' = $node.object.modified == $node.object.current.modified
'published' = $node.object.versions[0].created
'(unnamed)' = $node.object.current.created

is that correct ? am I missing one ?
what keeps those values in sync ?

thanks,
*-pike

---------------
The class eZContentObjectTreeNode does.

Ivo Lukac

Wednesday 03 June 2009 5:52:34 am

AFAIK that is it.

Don't know exactly what $node.object.current.created is. Probably that is time when draft is created and $node.object.current.modified is when the draft is saved. Or something like that.

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

*- pike

Thursday 04 June 2009 11:42:17 am

Thanks - let me be more specific.

I need to *set* the creation date, modification date, creator and owner on a node, using PHP. But I'm not really sure what to set, to start with.

I've tried

$version->setAttribute( 'created', $set_created);
$version->setAttribute( 'creator_id', $set_creator_id);
$version->setAttribute( 'modified', $set_modified);

where $version is a current contentObjectVersion, and then did a

$operationResult = eZOperationHandler::execute( 'content','publish', array(
 	'object_id' => $version->attribute( 'contentobject_id' ),
	'version' => $version->attribute( 'version' ) 
) );

The result in the admin interface is even more confusing. The values seem to be set on the current version, but the *object's* modifier is me and the modification date now.

Does anyone know how to do this ?

thanks,
*-pike

---------------
The class eZContentObjectTreeNode does.

*- pike

Friday 10 July 2009 10:17:27 am

The fact that the admin (history page) is confusing may be due to a bug in the admin:
http://issues.ez.no/IssueView.php?Id=15157

---------------
The class eZContentObjectTreeNode does.

*- pike

Friday 10 July 2009 10:30:46 am

I'm testing a bit .. since nobody knows and imho its a bit of a mess there :-)
So I'm pushing numbers straight into the database using SQL to see what *output* changes in the template operators. I can not, this way, see what internal php logic would keep the several values in sync, or how.

the treenode has no fields in the database to store userids, so $node.creator must be read from either the object beneath the node or one of its versions. I should add I'm using ezp 4.03.

I'm focusing on 4 things:
- the object
- the initial version from $object.versions[0]
- the initial version from fetch('content','version_list',..)
- the current version from $object.current

It should be noted both initial versions return different objects, allthough they have the same $version.id, see http://issues.ez.no/IssueView.php?Id=15158

If I change initial version creator id in the db
	this changes: 
                $initialfetched.creator
	
If I change current version creator id  in the db
	these change:
		$node.creator
		$node.object.versions[0].creator (that seems wrong)
		$node.object.current.creator 
	but this doesnt
		$node.object.owner

If I change object owner id  in the db
	only this changes:
		$node.object.owner

So $node.object.owner may be synced by some other internal method in php, eg content/publish. And $node.object.versions[0].creator seems to be incorrect. the admin history page uses the fetch(content.version_list and shows the right values.

More to come,
*-pike

---------------
The class eZContentObjectTreeNode does.

*- pike

Friday 10 July 2009 11:21:49 am

I did the same for 'version.created', 'version.modified', 'object.modified' and 'object.published'.

change initial version "created"
	this changes
		initialfetched.created
		
change initial version "modified"
	this changes
		initialfetched.modified
		
change current version "created"
	changes
		$node.object.versions[0].created (that seems wrong)
		$node.object.current.created
		
change current version "modified"
	changes
		$node.object.versions[0].modified (that seems wrong)
		$node.object.current.modified
		
change object "created"
	changes
		$node.object.created

change object "published"
	changes
		$node.object. published

So again, $node.object.* seems to be kept in sync using php, and $node.object.versions[0] seems wrong.

That doesnt really answer my original question :-) But I know a bit more now:

To change $node.creator, I have to change $node.object.current.creator

To change $node.object.owner, I can just set it in SQL. Common sense tells me to update the "creator" of the first version as well.

To change $node.object.modified, I can just set it in SQL. Common sense tells me to update the "modified" of the current version as well.

.. and $node.object.published i can apparently just set using SQL. Common sense tells me to update the "modified" of the first version as well.

And
* 'sort_by',array('modified',false())
* 'sort_by',array('published',false())
will most likely sort by $object.modified and $object.published, allthough i havent checked that.

$2c,
*-pike

 

---------------
The class eZContentObjectTreeNode does.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 18:21:37
Script start
Timing: Jan 18 2025 18:21:37
Module start 'layout'
Timing: Jan 18 2025 18:21:37
Module start 'content'
Timing: Jan 18 2025 18:21:38
Module end 'content'
Timing: Jan 18 2025 18:21:38
Script end

Main resources:

Total runtime0.8614 sec
Peak memory usage4,096.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.1563152.6563
Module start 'layout' 0.00480.0025 740.812539.5078
Module start 'content' 0.00720.8528 780.3203622.1797
Module end 'content' 0.86000.0013 1,402.500020.0938
Script end 0.8613  1,422.5938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3498160.0002
Check MTime0.00130.1535160.0001
Mysql Total
Database connection0.00070.079710.0007
Mysqli_queries0.792992.0544720.0110
Looping result0.00060.0682700.0000
Template Total0.829496.320.4147
Template load0.00190.217420.0009
Template processing0.827596.071820.4138
Template load and register function0.00030.030610.0003
states
state_id_array0.00120.141910.0012
state_identifier_array0.00120.137120.0006
Override
Cache load0.00170.1983740.0000
Sytem overhead
Fetch class attribute can translate value0.00040.046620.0002
Fetch class attribute name0.00100.118590.0001
XML
Image XML parsing0.00070.079820.0003
class_abstraction
Instantiating content class attribute0.00000.0025100.0000
General
dbfile0.00180.2078170.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
22content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
12content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 53
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs