The changelog can be activated via the structr.conf switch application.changelog.enabled. 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 The type of changelog event
time The time of the event as a long
userId The id of the user who triggered the modification
userName The name of the user who triggered the modification
target The id of the remote object
rel The relationship type of the created/deleted relationship
key The property key which has been modified
prev The previous value of the modified property
val The new value of the modified property
{"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"}


About this article
Last change 2016-08-29
Topics ExperimentalStructr 2.0