Raised This Month: $51 Target: $400
 12% 

[TF2] Http Replay Cleaner Redux


Post New Thread Reply   
 
Thread Tools Display Modes
Author
rowedahelicon
Senior Member
Join Date: Feb 2011
Location: The Observatory
Plugin ID:
4484
Plugin Version:
2.0.0
Plugin Category:
Server Management
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Deletes old replay files based on specified settings
    Old 01-09-2015 , 16:50   [TF2] Http Replay Cleaner Redux
    Reply With Quote #1

    [TF2] Replay Cleaner Redux
    Version 2.0.0

    Original by DarthNinja : https://forums.alliedmods.net/showthread.php?t=157867

    Description:
    Replays taking up way too much space on your HTTP server? You need this!

    With this plugin, replay files older then a set number of days are automatically deleted when the replay folder exceeds a set disk usage quota.

    This version was posted with permission by Darth, it has been redesigned to use a Curl post rather than forcing a quiet MOTD on clients, it sends everything via post and now has a security key cvar in order to keep things secure.

    Commands:

    • None
    Cvars:
    • sm_replaycleanup_version
      • Plugin version.
    • sm_replaycleanup_enable
      • Enable/Disable the plugin.
      • Default: 1
    • sm_replaycleanup_cachesize
      • The amount of space in MB that replays must be using before any will be deleted.
      • Default: 1024 (aka, 1 GB)
    • sm_replaycleanup_days
      • Files older than this many days will be deleted.
      • Default: 4
    • sm_replaycleanup_link
    • sm_replaycleanup_localpath
      • Location of your replay files relative to the php script.
      • Eg, tf/2/
    • sm_replaycleanup_save_logfile
      • Should a log file be saved to CleaningSessions.log on the webserver?
      • Default: 1
    • sm_replaycleanup_autoprune
      • The time in hours to attempt to auto-prune replays (for servers that don't have rounds).
      • Default: 0 (Disabled)
    • sm_replaycleanup_secretkey
      • Your secret key to keep people from posting to your page.

    Install Instructions:

    1. Upload the php script to a folder above where the replay files are stored.
    2. Chmod the folder with php script and the folders that have the replay files to 777.
    3. Edit the replaycleaner.php file to add in your secret key. You only need to edit the top line.
    4. Code:
      //EDIT THIS ONLY
      
      $secret_key = "";
      
      //DO NOT EDIT ANYTHING ELSE
    5. Install the plugin
    6. When loaded, the plugin will create a config file at tf/cfg/sourcemod/HTTPReplayCleanup.cfg
      Set the above cvars in the config file.
    7. Restart the server or change maps to reload the config.

    Example Setup:
    1. Your replay files are saved to http://yoursite.com/tf2/replays/server1/.
    2. You could drop the php file in the /tf2/ folder and name it "cleanup.php".
    3. You would then set sm_replaycleanup_link to "www.yoursite.com/tf2/cleanup.php".
    4. You would then set sm_replaycleanup_localpath to "replays/server1/"


    Notes:
    • Files are deleted at the end of each round.
    • Example Logfile:
      Code:
      Session started - Fri, 27 May 2011 19:14:44 CDT
      The total filesize of "teamfortress/server1/" is: 500.89 MB.  Maximum 500 MB allowed 
      Deleting files from more than 1 days ago:
      ---------------------
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_15.block - 83.79KB - Thu, 26 May 2011 19:14:08 CDT
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_11.block - 97.25KB - Thu, 26 May 2011 19:13:08 CDT
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_10.block - 84.62KB - Thu, 26 May 2011 19:12:53 CDT
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_12.block - 83KB - Thu, 26 May 2011 19:13:22 CDT
      -Snip-
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_13.block - 90.48KB - Thu, 26 May 2011 19:13:38 CDT
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_17.block - 84.61KB - Thu, 26 May 2011 19:14:37 CDT
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_16.block - 85.87KB - Thu, 26 May 2011 19:14:23 CDT
      Deleting teamfortress/server1/20110526-201000-ctf_2fort_part_14.block - 98.27KB - Thu, 26 May 2011 19:13:53 CDT
      ---------------------
      Total files deleted: 788 - The NEW total filesize of "teamfortress/server1/" is: 300.2MB.


    Version History:
    • V1.0.0
      • Initial Release
    • V1.1.1
      • Fixed a potential infinite loop if the round ends and there are no human players.
      • Added a cvar to make the plugin prune replays via a timer
    • V2.0.0
      • Resigned to use a Curl post rather than an Motd open
      • Added the cvar sm_replaycleanup_secretkey which needs to be set on both ends in order to maintain security





    Attached Files
    File Type: smx ReplayCleanup.smx (5.0 KB, 280 views)
    File Type: sp Get Plugin or Get Source (ReplayCleanup.sp - 280 views - 3.5 KB)
    File Type: zip HTTP Replay Cleaner.zip (9.3 KB, 170 views)
    __________________
    SCG, A furry community in the stars - https://www.scg.wtf

    Last edited by rowedahelicon; 01-09-2015 at 17:05.
    rowedahelicon is offline
    Send a message via Skype™ to rowedahelicon
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 23:01.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode