I have had a request from a user of the WordPress backup script to provide more information about the usage of the script. As a result, I have expanded the content of the README file included in the tarball. However, I don’t want to post a new version of the script because I am working on some new features and it is not ready yet.
Therefore, I am posting the content of the README file:
WP_BACKUP
=============================
Backup your WordPress installation/site with one script.This script can be used to perform backup and restores of
a WordPress installation. The script can backup the WP
installation under the webserver Document Root directory,
preserving any modification that might have been made to
the source code. It also can backup the WP database,
preserving any WP content that is already there.INSTALLATION
=============================
The script does not need any installation. It can be run
from anywhere, as long as the machine where it is being run
can find the WordPress installation and contact the MySQL
server where the WordPress database is hosted.Of course, for the database backup to work, the WordPress
user has to have access capability to the MySQL server from
the machine where the script is being run.USAGE
==============================
Currently, the script only works if you can run it on the machine
which has your WordPress installation (your webserver). Future
version will support backing up over FTP.In order to use the script, you will need read and write access
to the directory where the WordPress files are installed. The
write access is used to correctly record the ownership and
permissions of all the files. Since, in most case ther users
using this script are the users who installed the WordPress
blog to begin with, that shouldn’t be a problem.
If you want to backup the database, you’ll need access to the
database and the ‘mysql’ and ‘mysqldump’ executables. They
usually come installed on any system on which MySQL is installed.The script has three modes of operation: backup, restore,
and query.BackUp
——
During a backup, the script will read all the WordPress files
(including any themes, plugins, and media that you might have
installed and/or uploaded). The advantage of using this script
is that it just saves the state of the files at the time of the
backup.If you’d like to backup the WordPress database, the script will
dump the entire database, including statements for recreating
all the needed tables and the data contained in them.Performing a backup with which includes the WordPress files and
database should result in a nice, completely contained snapshot
of the WordPress site.Restore
——-
A restore will unpack the BackUp file, replicating the saved
WordPress directory structure and either a database SQL file or
a new database directly imported to the MySQL server.The database SQL file is a flat text file containing all the
SQL statements needed to replicate the database.To import the database directly to the MySQL server, you’ll
need access to the server and permissions to create the database
and all the tables in it.Query
—–
The query mode is used to get information about the different
BackUp files. It could be used to look through all the saved
BackUp files to determine which one to restore from.How To Use
———-
As mentioned above, the script operates in one of the three
modes. Therefore, one of the three options (–backup, –restore,
or –query) must be supplied on the command line. If none of
the options are present, the script will report an error and
exit.The script supports a “Backup Archive” directory – a directory
where BackupFiles are to be stored and found. The location of
that directory can be specified with the ‘–backupdir’ option. By
default, the script will look in the current directory.
The “Backup Archive” directory is where the script will look for
BackupFile to query or restore from (if –restore or –query are
given) or where the script will write BackupFiles to (if
–backup is used).When backing up a WordPress instance, the –wordpress option is
required. It tells the script where to find the WordPress files
which are to be backed up.
To add the WordPress database to the backup file, add the
‘–db’ option.The reason why the script requires the WordPress path but does
not require the ‘–db’ option is that there are a lot of WP
plugins that can help you backup your database. The purpose
of this script is to allow you backup your WP files.
If users really want to be able to backup the database
independently, I will change this.To restore a WordPress instance, use the ‘–restore’ option.
There are two ways to restore a WordPress instance:
1. Let the script find the most recent
backup file in the “Backup Archive” directory
2. Point the script to a specific backup file by
using the ‘–restore_file’ option.
You can also tell the script whether you want it to restore the
MySQL database (dropping any existing database) or whether you
want it to extract the SQL statements to a file.
If the ‘–db_to_mysql’ option is used, the script will restore the
database directly to the MySQL server. Otherwise, it will be
writen in the form of a text file containing all necessary SQL
statements in the current directory.Querying a BackupFile will return information about what the
BackupFile contains and how the BackupFile was created. The
‘–query’ option will return the following information:
BackupFile name, timestamp, command line used
to create the BackupFile, size of the file archive,
does the BackupFile contain a backup of the database,
size of database backup (if present).Examples
——–
To create a backup file in the current directory of only the
WordPress files use:
wp_backup –backup –wordpress <path to WP files>To create a backup file in a “Backup Archive” directory containing
both the WP file and the database, use:
wp_backup –backup –wordpress <path to WP files> \
–db –backupdir <path to archive>To create a backup file containing the database from a different
hostname:
wp_backup –backup –wordpress <path to WP files> \
–db –hostname <MySQL hostname>To query the latest backup file in the “Backup Archive” directory,
use:
wp_backup –query –backupdir <path to archive>To query a specific backup file, use:
wp_backup –query –query_file <path to backup file>To restore from the latest backup file in the “Backup Archive” into
the currect directory, creating an SQL statement file, use:
wp_backup –restore –backupdir <path to archive>To restore the WP files to a specific location but only create a
SQL statement file in the current directory, use:
wp_backup –restore –target <directory to restore to>More Information
—————-
For a complete list of supported command line options, run the
script with the ”-help’ option (wp_backup –help)If you have any questions, feature suggestions, and/or bug reports,
please visit http://www.voidtrance.net/
