Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Backup Bug
#1
I cant seem to download a backup
it downloads as a zip file but when i go to open it i receive an error saying it is damaged - i can backup database ok (i hope its ok) but could someone tell me how to fix this bug?


Attached Files Thumbnail(s)
   
[Image: WWCND.jpg]
#2
save the file with extension html and open it in a browser. See if there has been an error, which may be the most probable thing that had happened.

I had this problem too and was due to the configuration of PHP, which in my server it doesn't allow to take more than 8Mb of memory and the backup feature of MyBB uses a lot of more memory (it stores in memory the whole daba base before compressing it and send to donwload). I had to change the code in order to make the backup feature work correctly.
[Image: choli_av.php]
#3
A possible solution it so flush the buffer every so often so for instance we could flush the buffer once it gets near the max memory set by the ini and send it in packets. I'm not sure if it'd work but it might.

Otherwise we'd be better of throwing an error saying you don't have enough memory to complete the operation or something like that.
#4
Try changing the file name from .gz to tar.gz on the extension example.gz -> example.tar.gz and see if it opens.
#5
Tikitiki Wrote:A possible solution it so flush the buffer every so often so for instance we could flush the buffer once it gets near the max memory set by the ini and send it in packets. I'm not sure if it'd work but it might.
What you have to do is flush the buffer every iteration of the loops.

Hoowever there's a problem because you can't do that if you choose the options download and gzip, because in that case the code is written in such way that it first creates the whole data to download and finally compresses it. It couldn't change that, but in the other combinations (download + text plain, or save at the server) i was able to do a workarround. You can find it in the attached file; feel free to use it in MyBB.

What I did is add a new option to do what i called a sequential backup. Then, in the code, each time you add something to the variable $contents you call a new function (seq_backup) which flushes its value it it's possible. In that way, the size of the variable $contents never exceeds a big size. In my board, with a 8 Mb limit, i don't get any error.

BTW, the option "optimise data base" doesn't work (it doesn't do anything at all) in the page of data base bakcup.


Attached Files
.php   dbtools.php (Size: 13.89 KB / Downloads: 273)
[Image: choli_av.php]
#6
Thanks Choli. I've made a few changes to your dbtools.php. Please see if the following file fixes the reported backup bug. It works for me Smile


Attached Files
.php   dbtools.php (Size: 13.97 KB / Downloads: 355)
#7
oh! :O yeah, it works perfectly. I tough that you couldn't concatenate the output of gzencode to create a single gz file, that's why I didn't add the option of sequential backup with download and gzip Smile good work.

Just one suggestion. Change the line
	makeyesnocode('Do a sequential backup?', 'sequential_backup');
so it uses the $lang->whatever, so people can translate it into any language. Wink
[Image: choli_av.php]
#8
I was, I was just too lazy at the moment xD I didn't think you could use gzencode because of the crc32 string generated at the beginning but apparently you can.

Anyway, I'm glad we got this fixed & thanks for the help!
#9
This bug has been fixed in the latest code.

Please note the latest code is not live on the site or for download. An update will be released which contains this fix.
#10
Tikitiki Wrote:I didn't think you could use gzencode because of the crc32 string generated at the beginning but apparently you can.
yeah... you developers should be careful with that, and if someone complais about that remember that the problem may be at the gzencode Toungue
Quote: thanks for the help!
no problem Wink
[Image: choli_av.php]


Forum Jump:


Users browsing this thread: 1 Guest(s)