A lot of people have been looking for an easy way to make daily backups of their WP Mysql database. Rather than re-inventing the wheel, I modified an existing MySql Backup script to work from inside the admin page in WordPress using the WordPress variables. Click on the link below to download the zip file with the installation instructions. It is very simple to install and lets you download the backup files to your local computer as well. I hope someone finds this useful. Please post comments, questions and suggestions.
Peace.
http://dinki.mine.nu/word/b2-img/wp_backup.zip
This doesn't work for me at all, unfortunately. I tried it on 1.0-alpha-2 (renaming appropriate paths/filenames), and also on .72. Either way I get a blank page and no backup when I run the script.
You get a blank page? no errors? nothing? Can you please email me a link to where your dump.php is located?
No errors, no nothing. Just plain white...the proverbial blank page. :) I've got dump.php in /mydir/wordpress/dump.php. (I'm not sure what link you want...if you went there that's what you'd see, nothing. :)
Cena, did you make the dump.php file executeable? :-) I guess i should have mentioned that. If that is the problem, I will fix that in the tutorials.
Well, er, I'm not sure what you mean by that. I just uploaded it according to the directions. I did play around with the permissions (going all the way up to 777), but that didn't change anything either.
Cena,
It looks like everything inside the php tags dont get executed. You could try putting something like phpinfo(); just before the comments and see if it gets executed. If there was something wrong with the php code, you would get errors, or something. The source of your dump.php pre-processing shows everything upto the start of the php code. I have an inkling that some comment tag (/*) is not getting ended (*/). It could also be related to your .htaccess . I dont know how hard you want to work with getting this to work, but if you are game, I will help you as much as I can.
Well, it's a mystery. phpinfo() generates appropriate page. I don't have an .htaccess. The code looks fine with syntax highlighting (no unending comments.) I'm willing to do whatever you suggest, but I'm at a loss at the moment.
How about this...what should the include paths be if I'm using 1.0? (where b2-includes becomes wp-includes.) I'm wondering if I may have messed that up. I currently have this:
require_once('wp-config.php');
require_once("wp-includes/template.functions.php");
require_once("wp-includes/functions.php");
require_once("wp-includes/vars.php");
include ("dump/lang_en.inc");
Would that be correct?
That looks perfect. All you really need is the wp-config.php. I have added the others in case people want to configure it to their blog template. You said that it does not work for you in 0.72 either, which is really strange. Does anyone else have this problem? Cena, could you please email me the source of dump.php?
Thanks for playing along!
I tried on 0.72 and got nothing at all back, not even a blank page. The server would just hang up :/ Will be a nice hack if it can work tho :)
Sorry, my mistake. Works a treat. Would really like to see it integrated with the admin interface nicely. ie a backup/restore page.
How exactly does one go about restoring the database?
OF COURSE there'e interest! :) (in a restore script.)
Many many props to LL...I emailed him around oh, 1:30 this morning, and he'd responded within *minutes* with the fix. Thanks again, Mark. :)
pezastic
Member
Posted 9 years ago #
A backup/restore thingy in Admin? That sounds waaay cool! That is one of the things that kept me from trying out a dynamic package such as WordPress. I'm sure others are very hesitant about this situation, too. To take away that hesitation would be a great feather in WordPress's cap. I'm all for it!
I will be working on the restore script as soon as I get my workstation upgrade done. :-P
I am also thinking of writing another script which backs up the wordpress folder and provides a link for download of the zipped file for local backup.
yeah something on the line of backups done by the server backends for the WP folder would be so cool!
Thanks for the script, it's working fine, but with one slight anomoly:
After running the script, I get the "dump" page, with all the relevant info:
datasourcename, table counter, filesize, status
When I click the "Download the new Backup Sql file" link, however, I get a page not found error. The URL is exactly correct, and if I FTP into my site I can see the file there in all it's glory and download it that way to my desktop.
Not a big deal, since I can FTP in...but it's strange the server thinks it's not there when it is...
That directory does not have view permissions. When you changed the permissions of the backup folder, did you also assign read permissions to it? I would think that is the problem.
@ Cena, Sisob, Sushubh, Pezastic and others that expressed interest in a restore script:
I have made some changes to the Backup procedure and added the Restore script to it. Now you have the ability to backup your MySql database and download it locally, backup your WordPress folder and download it locally, and restore your MySql database, all from the comfort of a web interface (which can be integerated into the WP admin interface). There is added password protection thrown in as well.
I had the nasty fortune of using my own backup and restore script this morning which forced me to code some bugfixes and finally emerged into a completely different way of backing up and restoring.
Please download the new version from the same link: http://dinki.mine.nu/word/b2-img/wp_backup.zip
This has not been tested on a Windows web server (and I am not sure if the applications that I use are present in a Windows/MySql installation, but I need some feedback)
Please let me know what you think.
Peace
I can take a look on windows at some point.
=d
Thanks for your help David. :=)
jackiefg
Member
Posted 9 years ago #
I've tried using the backup and I get the following error messages, I'll put a link because they're so long. The first one is http://jackiefg.com/blog/errormessage.html. I have the dump file set at 766. Then I changed permissions, on the folders: set the dump folder to 744 and the backup folder to 766 and got the http://jackiefg.com/blog/errormessage2.html.
Anyone know what I'm doing wrong? I wanted to back up everything since the new WP is out.
eleanor
Member
Posted 9 years ago #
thanks laughinglizard - very nearly idiotproof!
here's to hoping the upgrade is the same.
Jackie: Make sure your webserver has write priviledges to that backup directory. If you are using a shell, use chmod -R 766 backupfoldername. Otherwise, make sure these permissions for the folders are being propagated down. Its a permission issue (as im sure you know by now :-) )
Basilisk
Member
Posted 9 years ago #
Is this compatible with WordPress 1.0 Platinum?
jackiefg
Member
Posted 9 years ago #
Why am I the only one who can never get this stuff working? I was still getting the error messages and I made sure the dump.php, dump directory, dump/lang_en.inc, and dump/backup files and directories were all set at 766. Then it told me to include the entire path, so on line 26 of the dump.php, I changed it to
" include ("/hsphere/local/home/jackiefg/jackiefg.com/blog/dump/lang_en.inc");"
However, I'm still getting this:
Warning: main(/hsphere/local/home/jackiefg/jackiefg.com/blog/dump/lang_en.inc): failed to open stream: Permission denied in /hsphere/local/home/jackiefg/jackiefg.com/blog/dump.php on line 26
Warning: main(): Failed opening '/hsphere/local/home/jackiefg/jackiefg.com/blog/dump/lang_en.inc' for inclusion (include_path='.:/usr/local/lib/php') in /hsphere/local/home/jackiefg/jackiefg.com/blog/dump.php on line 26
and a whole page more of this message. What is happening with this and what am I missing? I'm following all the directions exactly, and it works for everybody else.
LL,
I've been using it with WP 1.0 for about a week now and it works great. There aren't any references to b2vars anywhere in the files. It does have a brvars.php file, which calls in wp-config.php.
LOL...thats right...It has been a while since I looked at it! Thanks for the correction MtDewVirus. So there! This is 1.0 compatible! :-)
No problem! Thanks for coding such a great hack!
tvleavitt
Member
Posted 9 years ago #
I was unable to get the password protection to work, had to disable it for the backup scripts (left it on for the restore). The variable simply did not appear to be passed to the php scripts called.