Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
asv_tracker
asv_tracker is a plugin to capture who is creating and updating content on your TXP install. It creates a new table and will store the user, date/time, and action they performed. Currently it only tracks articles, images, and files. I’ll be adding more as I go along, but I could use some feedback.
Offline
Re: asv_tracker
Really nice. I got used to this kind of thing with Drupal, but with TXP it’s icing on the cake.
Offline
Re: asv_tracker
- use doSlash on variables before using them in an SQL query.
- instead of datetime, you can probably use a timestamp column so you don’t have to set it to
NOW()
each time. - the ‘case’ statements have a lot of duplicate code. The only thing that is different each time is the $action. Might as well just use ‘case’ to set $action and do the SQL query afterwards. In fact, if you let all those functions return $action, you can do all the inserts in the asv_tracker function. All this makes your plugin a lot smaller, I think.
- sort on ‘id DESC’ (newer dates on top)
- collation utf8_general_ci (similar to what TXP uses) instead of latin1_general_ci
- ‘table create’ is defined in two places. Perhaps better to move it in a separate function and call it where required.
- automatic purging of actions older than, say, 1 month?
- limit the max number of actions pulled from the database to 1000 (?) or paginate.
- offer a ‘filter by $txpuser’ (pulldown select menu would be nice).
- remove ‘The user attempted ‘ from the action strings. Having that in all lines has no extra value and just makes lines break faster.
- instead of ‘event – $event/ step – $step’, I’d use ‘$event $step’ or perhaps even ‘$step $event’, because the terms ‘event’ and ‘step’ are nice for programmers but have less meaning to end-users.
Last edited by ruud (2006-11-12 22:19:59)
Offline
Re: asv_tracker
Ok I’ve made some updates, most in line with ruud’s suggestions.
http://www.amitvaria.com/compile/asv_tracker.php
I would appreciate help in making sure that the plugin is secure and efficient. I decided to break things apart as well so now you have user, timestamp, event, action, id. I haven’t created a pull down yet, but there is sorting and filtering built-in to the table.
Offline
Pages: 1