First off I want to say thank you to kerphi (and other contributors to this fine project) for your work on this. I just thought that I would post a small script for those who need to trim their chat logs for the sake of disk space but can't delete it because of FTP permissions. I found myself needing to slim down one of my logs and I couldn't overwrite it with a smaller one, so I used a small PHP script to my advantage. This is more for those of you who aren't too good with PHP that need to do this.
- Code: Select all
<?php
//This variable opens the log file that you will be truncating.
//Here is the overall layout of the fopen() function: fopen("<log location>", "w")
//Here is an example: $file=fopen("data/private/logs/4585943uty38h734t8g34t8734ut8g7t/chat.log", "w")
//You need to change this!
$file=fopen("data/private/logs/", "w");
//This fwrite function opens up the file and writes to it.: fwrite($file, "<text to write to file>")
//Here is another example of what could be done: fwrite($file, "Chat Cleared");
fwrite($file, "");
//Then, of course, close the file. No need to change this.
fclose($file);
?>
Save this file as whatever you want with .php at the end and open it in your web browser and it should display NOTHING. If it displays something, you probably received and error and something went wrong.
That's about it. I'm sure there could be a lot more done with this, but I don't feel up to it at the moment. I just hope this will help someone that is searching the forums because this forum has helped me a lot while searching through here.
Keep up the good work!