We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7231
    • 4,205 Posts
    shamblet, i installed the auditor for testing and for some reason I get several versions for each edit. What I mean is that when I edit a document title, for example, I get several copies of that edit in the auditor database (rather than just one per edit). Any idea why this is happening?
      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

      Something is happening here, but you don't know what it is.
      Do you, Mr. Jones? - [bob dylan]
      • 26903
      • 1,336 Posts
      Interesting,

      I’ve just done a quick test in my dev environment, I cleared the history tables to remove the crud, then re-titled a few docs in my main MODx installation, the history database content was OK i.e. there was only one entry for each document I retitled. I cant say I’ve seen this effect before.

      The only thing I can think of is that the triggers are being fired more than once for some reason, i.e more than one update is taking place, some plugin you have that I’ve not? My test environment is a pretty basic MODx, only a few plugins etc.

      OK, I assume the duplicate entries have the same timestamp. Are they actually exactly equal to each other? How many duplicates do you get? Does it happen with all edits, ie content, published etc. and does it apply to snippets, templates etc.

      I’m wondering if any one else is seeing this.
        Use MODx, or the cat gets it!
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        I was thinking of this very same functionality, hooking into MySQL triggers... it’s a present need, and a good idea to take on. Where I’ve seen the most need for it is in corporate/business environments where MODx can vie as a substitute (or partial substitute) for a dedicated versioning software package (such as Subversion or Perforce). Every biz-developer really likes MODx until it comes to that point... then there is the peanut-gallery question of "how do we roll back changes?" Sigh... the poor man’s solution has been to manually duplicate files before changing them, but that’s a bit juvenile and prone to error. Using the @FILE bindings offers a partial solution as well, but if you’re living in the file structure, then you’re partially missing the point of having a database driven CMS.

        Yes, keep up the good work on this!
          • 26903
          • 1,336 Posts
          Yes, my motivation for doing this was more for the corporate environment.

          As a quick roadmap I’m going to release Auditor V1.1 this week, this is just a tidy up with some extra management functions and the ability to restore content previously marked using the Auditor Analysis tool, nothing too drastic.

          For the future I’m going to expand on the Auditor Analysis tool, recovery is OK but I also find that some corporates need to know ’whos done what and when’. I’m looking at tying in the manager log(which is itself historied) with specific versions of content, this will allow diffs to be done between specific revisions etc.

          Also another area where Auditor is weak is in its initial set up scripts, these are basically hacked versions of the sql scripts that come with the MODX installation. This is OK until an upgrade occurs which adds/removes a column in a table say, then it breaks. We need to be smarter here and use the table prefix to extract meta data from MYSQL, ie all the tables that the installation uses, the we can get the columns, then we can generate the scripts from this data.

          Any other ideas here of course are welcome.
            Use MODx, or the cat gets it!
            • 7231
            • 4,205 Posts
            Quote from: shamblett at Aug 13, 2008, 02:46 AM

            OK, I assume the duplicate entries have the same timestamp. Are they actually exactly equal to each other? How many duplicates do you get? Does it happen with all edits, ie content, published etc. and does it apply to snippets, templates etc.
            When I edit a document it generates two seemingly exact entries. I will test it with some other actions and see. I did install it a few times before I got it right. Could the install process have duplicated the triggers?
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 26903
              • 1,336 Posts
              I believe MYSQL does not permit multiple triggers of the same type i.e. you cant have multiple ’AFTER INSERT ON’ triggers on the same table, so I doubt if its this. If you enter the command SHOW TRIGGERS in a MYSQL session on your MODx database you should get a listing of the triggers as MYSQL sees them. Check this against the file create_triggers.sql in your /working directory of auditor. These should match up.

              Other than that try an edit of a chunk or a snippet and see if its the same, also how do you edit a doc? Do you use quickedit or do it from inside the manager?. Also create a document, this should fire the insert triggers only, so you should get one entry here.
                Use MODx, or the cat gets it!
                • 33337
                • 3,975 Posts
                Zaigham (aka zi) Reply #27, 18 years ago
                In 1.1 release, looks like you forgot to change modx_ on last line (# 1200) to {PREFIX} in create_triggers_tpl.sql file. smiley

                UPDATE modx_system_settings SET setting_value = 3 WHERE setting_name = 'auditor_status';
                


                Corrected:
                UPDATE {PREFIX}system_settings SET setting_value = 3 WHERE setting_name = 'auditor_status';
                
                  Zaigham R - MODX Professional | Skype | Email | Twitter

                  Digging the interwebs for #MODX gems and bringing it to you. modx.link
                  • 26903
                  • 1,336 Posts
                  Yes, well spotted, I’ve corrected this and it will be in V1.2. Thanks for the report
                    Use MODx, or the cat gets it!