Yii Framework Forum: ActiveRecord change log behavior - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

ActiveRecord change log behavior Rate Topic: ***** 1 Votes

#1 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 29 April 2010 - 02:40 AM

This extension/behavior is based on the following Cookbook article: How to log changes of ActiveRecords?.

SystemLog is a behavior that will record every create/update/delete action performed within an ActiveRecord-based model, including whom made the change, and (if the Timestamp behavior is enabled) when the change occurred. (Just a note, while it currently relies on the Timestamp behavior, that is subject to change, as I'll likely just move timestamp handling directly into SystemLog)

Disclaimer: The paragraph below talks about what SystemLog could be used for, but there is no interface built yet for viewing/reverting record changes
What's great about this, is that it should be rather simple to create an interface to display modified records, and the change history of each individual record (with the ability to revert changes). So if an admin becomes overzealous with updating or deleting records, those changes could be reverted easily.


Check out the behavior here:
SystemLog Behavior - http://code.google.c...ents/behaviors/

I still have some changes to make (noted in the @todo), comments to add.
Once it's ready, I'll of course provide the SQL and models that are associated with the behavior.


Any initial thoughts?
Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,338
  • Joined: 12-October 09
  • Location:Croatia

Posted 29 April 2010 - 03:26 AM

Link is not working... I get "google error - not found"
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 29 April 2010 - 03:40 AM

Thx mdomba, turns out the forum is lowercasing the "b" in SystemLogBehavior.php, thus breaking the URL.

URL updated to point to the directory where the file resides, testing fine right now.
Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#4 User is offline   Gogu87 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 08-August 13

Posted 17 August 2013 - 09:35 AM

google code work link: http: // code[dot]google[dot]com/p/cranium-crm/source/browse/private/components/behaviors/SystemLogBehavior.php
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users