Hi,
Being a bit of an audit trail/version control freak I’ve been experimenting with how to add this to Modx with the minimum of disruption.
To this end I’ve written a series of sql scripts to perform this using the trigger functionality of the MYSQL database(5.0.2 and above) system.
Basically it allows you to see what has changed between versions of content, snippets, chunks plugins etc. Not just who changed something at a certain time. Also because the updates are historied a simple roll-back scheme is available.
This is still work in progress although I have it up and running OK on one of my test systems.
Rather than fill this forum with intricate detail I’ve set up a projects page on my website that contains full details and the scripts etc.
If this is of interest to anyone I’ll gladly refine it and maybe think about putting a front end on it eventually and making it a resource/plugin whatever.
Please go
http://bitez.hobby-site.com/index.php?id=82 here for details.
Or just navigate to the software section of my site and look for the modx_audit project.
http://bitez.hobby-site.com
Use MODx, or the cat gets it!
Wow, this is really interesting.
Going to look at the site now...
-
MODX Staff
- 2,502 Posts
Very cool. I’d love to see if this could be made into a plugin/module as this is something I know that many people are looking for in MODx.
Thanks for the work.
Jay
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
This would be one of the most awesome plugins or modules so far. Good luck with it!
-
MODX Staff
- 2,502 Posts
I’m just thinking out loud here but if this worked well this could open MODx up for use as a Wiki tool as well. Let me know if you need any help on this.
Cheers,
Jay
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
Yes I’ve not thought of other uses for this technique but there probably are more than just auditing.
I’ve done some more testing on my other dev system(linux) and I’m happy we can move this forward now. I’ll need to tweak the history DB a bit
with possibly some extra version columns and get the timestamp column sorted out but in general this works OK.
OK, the first thing to do I think is to put together a module so users can set this up in a more sane way than hacking sql scripts.
I’ll put together a module that has the same look and feel as the initial DB install scripts so users can enter DB name, table prefix etc and any other bells and whistles I need here with appropriate checks etc. This should get users up and running with this.
As far as querying the data is concerned I doubt we will be able to create a module/plugin that fulfills everyones needs here but we may be able to write a general one with basic time lining etc. and supplement this with extra more specific modules/plugins for auditing document content, users, snippets, chunks etc. This allows people to mix and match and also allows them to write their own if needed.
I’ll post progress here and code etc. on my site projects page.
NOTE for the core dev team - I dont know how this sits with 0.9.7, this is aimed squarely at 0.9.6 users for now, I guess not everyone will immediately jump ship here when 0.9.7 comes out but we can address this/port it later if needed.
Use MODx, or the cat gets it!
Thanks for this.... great contribution.
I plan to have my ModX team create a plugin triggered by events for each manager form, first docForm, then chunkForm and snipForm, which will display the history entries as a dated list with a open/close div to show the actual content for comparison and finally a link to do a quick dom scripting copy/paste of the contents into the textarea.
For pages we’ll add a new tab, called History and show the list there. There will be some UI work to discover the best way to present this.... but it sounds very doable.
Anyone else thought about drafts? I’ve always wanted to be able to create a draft of a document that is not published but still have the last version of the document published. I think there should be a new button next to SAVE that says, SAVE DRAFT - and will just add a new entry into History without changing the current published page....
anyways, lots to think about and get code created for.... thanks again, I’ll post my results when they come in.