Changelog

Search
Feedback

The changelog can be activated by setting the structr.conf switch application.changelog.enabled to true. A Structr instance started with changelog enabled keeps a record of every modification of an entity. There are different kinds of actions (called verb) for which a record is kept.

The changelog itself can be retrieved by accessing the special property structrChangeLog of an entity or by using the builtin changelog() function.
The structrChangeLog property yields the “raw” changelog string which consists of one modification record per line. A modification record is a JSON string. (see the example below)

Verb Event type Keys in changeset
create Creation of an object verb,time,userId,userName,target
delete Deletion of an object verb,time,userId,userName,target
link A relationship to/from another object has been created verb,time,userId,userName,target, rel
unlink A relationship to/from another object has been removed verb,time,userId,userName,target, rel
change One of the properties of the object has been changed verb,time,userId,userName,key, prev, val
Key Content
verb type of changelog event (One of create, change, delete, link, unlink)
time Timestamp of the change (ms since epoch)
userId id of the user, 00000000000000000000000000000000 for SuperUser, null for anonymous
userName name of the user who triggered the modification
target id of the target node of the new or deleted relationship
relId id created/deleted relationship
rel relationship type of the created/deleted relationship
relDir relationship direction of the created/deleted relationship (in/out)
key Property key of the modified property
prev Previous value of the modified property
val New value of the modified property
Example
{"time":1455195862431,"userId":"f02e59a47dc9492da3e6cb7fb6b3ac25","userName":"admin","verb":"change","key":"name","prev":null,"val":"My new name"}
{"time":1455195903852,"userId":"f02e59a47dc9492da3e6cb7fb6b3ac25","userName":"admin","verb":"change","key":"name","prev":"My new name","val":"New Name"}
{"time":1455196049579,"userId":"f02e59a47dc9492da3e6cb7fb6b3ac25","userName":"admin","verb":"link","rel":"has","relId":"97d26b5778b54d3d991bba5026eb615e","relDir":"out","target":"4e32a9f6eb764d86be3de2faacbd7a6a"}
{"time":1455195961348,"userId":"f02e59a47dc9492da3e6cb7fb6b3ac25","userName":"admin","verb":"unlink","rel":"has","relId":"97d26b5778b54d3d991bba5026eb615e","relDir":"out","target":"4e32a9f6eb764d86be3de2faacbd7a6a"}
{"time":1455196115875,"userId":"00000000000000000000000000000000","userName":"superadmin","verb":"unlink","rel":"OWNS","relId":"b29e98329fb949b798162b88864aa038","relDir":"out","target":"f02e59a47dc9492da3e6cb7fb6b3ac25"}

Graph-Browser

Related Articles
About this article
Last change 2017-07-07
Topics ExperimentalStructr 2.0