MyBB Community Forums

Full Version: backup filename and compression level
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently backups have random filenames like:

backup_616440c859FIuUArse8TLeTzqVjL8vNA9y51kdOTnHC9junYTVx3XRfHzPO5VdlW.sql.gz

I'd prefer it if the filename could also contain some useful information such as the time it was created, like:

backup-20090427-182733-L8vNA9y5.sql.gz

(the backup was created on 27th of April 2009, at 18:27:33 hours, plus 8 random chars to prevent unauthorized downloading)

It'd be more useful than a random string, since when you download old backup files from a server, the timestamp of the file is usually from when you downloaded, and not from when the file was created, so the only other way to find out the date of a backup file is looking at the contents. Finding the latest backup when all you have is random filenames can be a pain.



When backups are written to a file, gzopen($file, 'w9') is used, setting the gzip level to 9 (best compression). However when downloading a backup directly, no level is set, so chances are that a much lower compression level is being used. I was stumped that when downloading I got a 62MB file, while the backup files on the server were only 25MB. Uncompressed they both amount to the same size though. Strangely enough even the lowest gzip level (1) gives me a smaller file than the 62MB I got from the download. Must be PHP doing something stupid.

It would be nice if the same compression level could be used for both files and downloads. It would be super duper nice if the level of compression could be customized.
I would like to see this. The backup names are stupid imo. They should be named based on the date.
There is a reason behind this, and you guys don't understand. If its based on date, anyone can download it by just doing /forum/admin/backups/name-of-the-backup (which is date).


Not secure at all.


The current way is the best.
right, backup-20090427-182733-randomstring.sql.gz then
Is there something wrong with using the created by attributes that come with every single file? Is there a point to duplicating data that already exists?

As for the compression level, that's todo with your server configuration, not MyBB. I should simply be able to set the compression level to a certain level and have it work - if it doesn't work then it's a bug with the zipping extension
The timestamps are lost when you download (depending on what you use to download them), you have to open the file itself to find out when it was created... I can do it with zgrep and sort, sure, but it would be easier if it was in the filename itself... it'd be a one line change.

Quote:As for the compression level, that's todo with your server configuration, not MyBB.

May be true for download, but for files, MyBB sets the level... it opens the file with w9 hardcoded. Would be nice if it was configurable for both, instead of standard settings.
I guess having a different level of compression for manual backups isn't terribly necessary. If you absolutely need to use a lower level of compression, you just have to edit the file to change a number. Though in most cases, I'd imagine you'd only want to do this to speed up the compression, which, considering PHP's memory limits, probably doesn't take terribly long in most circumstances (unless your host doesn't provide much CPU resources or you've got absurdly high limits in place).

Downloading could be fixed I guess.
It doesn't take terribly long, no, just a couple of seconds (on a 3Ghz machine). A lower compression level reduces that time by more than half, with an end result that is half a meg larger than the level 9 one. Wink

Anyhow, this is just a suggestion, I know I can just modify the file for myself... it's no big deal.