Changelog#
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 using the builtin changelog()
function. The changelog is written to disk at changelog.path
in a subfolder n
for nodes and r
for relationships.
If user-centric changelog (application.changelog.user_centric.enabled
) is enabled the changelog is written to the subfolder u
. In older versions of structr the changelog was written to the structrChangeLog
property of a node.
The following tables show the possible keys/values of modification records. Modification records are stored as 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"}