[TF2] Replay Cleaner Redux
Original by DarthNinja : https://forums.allie...ad.php?t=157867
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.
- Plugin version.
- Enable/Disable the plugin.
- Default: 1
- The amount of space in MB that replays must be using before any will be deleted.
- Default: 1024 (aka, 1 GB)
- Files older than this many days will be deleted.
- Default: 4
- The link to the php file via http.
- Eg, <a href=" target="_blank">http://<a href="http://www.yoursite....plays/file.php" target="_blank">www.yoursite.com/tf2/replays/file.php
- Location of your replay files relative to the php script.
- Eg, tf/2/
- Should a log file be saved to CleaningSessions.log on the webserver?
- Default: 1
- The time in hours to attempt to auto-prune replays (for servers that don't have rounds).
- Default: 0 (Disabled)
- Your secret key to keep people from posting to your page.
- Upload the php script to a folder above where the replay files are stored.
- Chmod the folder with php script and the folders that have the replay files to 777.
- Edit the replaycleaner.php file to add in your secret key. You only need to edit the top line.
- Code: //EDIT THIS ONLY
$secret_key = ";
//DO NOT EDIT ANYTHING ELSE
- Install the plugin
- When loaded, the plugin will create a config file at tf/cfg/sourcemod/HTTPReplayCleanup.cfg
Set the above cvars in the config file.
- Restart the server or change maps to reload the config.
- Your replay files are saved to http://yoursite.com/...eplays/server1/.
- You could drop the php file in the /tf2/ folder and name it "cleanup.php".
- You would then set sm_replaycleanup_link to "www.yoursite.com/tf2/cleanup.php".
- You would then set sm_replaycleanup_localpath to "replays/server1/"
- 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
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.
- Initial Release
- 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
- 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 ReplayCleanup.smx (5.0 KB) Get Plugin or Get Source (ReplayCleanup.sp - 3.5 KB) HTTP Replay Cleaner.zip (9.3 KB)
Wyświetl pełny artykuł