We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I’ll do the code for the ability to truncate certain user logging tables in the database; the Manager is changing so much though that I’m not sure where I should do this. Perhaps an addition to the new Backup Manager? Would it be better to remove all but the last X number of records than to simply truncate the whole table? Does the event_log table keep growing as well? If so, I will add that to the list of tables to work with. If I use the existing Backup Manager, I’ll also add the manager_log table.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 25663 MODX Staff
      • 12,272 Posts
      Maybe the Backup Manager needs a companion: Data Manager...

      For now it could just purge old admin, event and user logging data. Later perhaps it could purge things like docement versions and so on... wink

      In all reality, I’m open to just about annything.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        for now I’m just hacking the bkmanager.static.action.php script; that part’s already done. Now I need to create a new processor to truncate the indicated tables (I’m only enabling this on five tables; event_log, log_access, log_hosts, log_visitors and manager_log. Should be done in a couple of hours. Yes, I’m slow, so shoot me; that’ll only make me slower wink

        Line 123-124 becomes
        <?php
        // enable record deletion for certain tables
        // [email protected]
        // 08-2005
        if($db_status['Name'] == $table_prefix."event_log" || $db_status['Name'] == $table_prefix."log_access" || $db_status['Name'] == $table_prefix."log_hosts" || $db_status['Name'] == $table_prefix."log_visitors" || $db_status['Name'] == $table_prefix."manager_log") { 
            echo "<td align='right'>";
            echo "<a href='index.php?a=500&u=".$db_status['Name']."'>".nicesize($db_status['Data_length']+$db_status['Data_free'])."</a>";
            echo "</td>";
        } else { 
            echo "<td align='right'>".nicesize($db_status['Data_length']+$db_status['Data_free'])."</td>";
        } 
        // end record delection mod
        ?>	
        
        			<td align="right"><?php echo $db_status['Data_free']>0 ? "<a href='index.php?a=500&t=".$db_status['Name']."'>".nicesize($db_status['Data_free'])."</a>" : "-" ; ?></td>	
        
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          undecided found a problem with the bkmanager.static.action.php script involving the optimize_table option links. Am working on the issue. Creating a new processor to handle both optimization and trucation for bkmanager.

            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Ok, all done (I think...)

            Three files: Replace manager/actions/static/bkmanager.static.action.php, /manager/index.php, and add userlogs.processor.php to /manager/processors.

            (or patch bkmanger.static.action.php as below, and patch manager/index.php at line 812 as following)

            	case "500" :
            	   include_once "processors/userlogs.processor.php";
                break;

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 4673
              • 577 Posts
              Question, is the data being just moved to another table?


              hmm, I just caught up with what’s happening today and was wondering if to cut down on db size that maybe the data coould moved to a file. You wouldn’t necessarily have to worry about the sql db filling up ...

              errr, maybe this is just a dumb idea ... forget it smiley
                Tangent-Warrior smiley
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                No, the table is being truncated. That is why I modified the bkmanager and not the system info, because you can get a dump of the table before you truncate it if you want to keep the data. You could load the .sql file into a local database for further manipulation or whatever you want with it, while getting it off the remote server. Most hosting plans count database size as part of your hard disk quota, the same as files, so a constantly growing database can cause a big problem.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Has anybody been able to check this and verify that it works? I don’t want to release it "in the wild" until somebody else sees that it’s actually a Good Thing.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 32963
                    • 1,732 Posts
                    Hi Susan,

                    Many thanks.

                    I’ll have a look at it then check it in
                      xWisdom
                      www.xwisdomhtml.com
                      The fear of the Lord is the beginning of wisdom:
                      MODx Co-Founder - Create and do more with less.
                      • 32963
                      • 1,732 Posts
                      Hi Susan,

                      Here’s a link to the TP3.2 updates that contains your truncate fixes. I’ve merged the userlog files to the optimized table.
                      http://modxcms.com/forums/index.php/topic,793.msg4879.html#msg4879
                        xWisdom
                        www.xwisdomhtml.com
                        The fear of the Lord is the beginning of wisdom:
                        MODx Co-Founder - Create and do more with less.