WordPress.org

Ready to get started?Download WordPress

Plugin Directory

SitePush

Easily move content and code between WordPress sites. Pull your site's DB to a dev site, push new code to a staging site, etc.

Summary of installation steps

  1. check that your setup meets the requirements in the section below
  2. set up different versions of your site on your server
  3. download and unzip the plugin in your plugins directory and activate the plugin
  4. create and upload the config files which hold details of your sites and databases. See Config file sections below for more details.
  5. go to the SitePush settings page (immediately below Dashboard), and fill in settings as required. There is further help and explanation in the plugin.

Details for each step are covered in the sections below.

Requirements

SitePush uses shell commands to do some of its stuff, so there is more chance of things going wrong than with most plugins. Please check that your set up meets these requirements, and even if it does, please test your setup thoroughly before pushing to a live site.

SitePush is currently well tested on:-

  • Linux
  • MacOS X (MAMP)

SitePush should work on Windows systems, but with the following caveats:-

  • backup of files will not work
  • clearing of arbitrary cache files will not work (caches[] option in sites config)
  • it is not as well tested on Windows systems

If you would like to help make SitePush work better on Windows systems please let me know.

SitePush will not work in whole or in part:-

  • if your host has PHP safe mode enabled
  • if your host does not allow PHP to execute shell commands
  • to push files between sites on different servers. Currently, SitePush must have filesystem access to all sites it pushes files to. Your databases can, however, be on different servers as long as they are accessible by the site your are pushing from.

It has experimental support for Multisite installs:- * it will not run if you have WP_ALLOW_MULTISITE or MULTISITE defined as TRUE in your wp-config file unless you also define SITEPUSH_ALLOW_MULTISITE to TRUE in your wp-config file.

In addition to WordPress (3.3 or greater), PHP (5.2.4 or greater) and mySQL (5.0 or greater) your server must have the following installed:-

  • mysql and mysqldump command line utilities (tested on mysql version 5.5, it should work on versions above 5.0)
  • tar (any version should be fine, required for file backups)

Setup different versions of your site

Different versions of your site must be on the same server (filesystem). You can setup different versions either in separate vhosts (normally recommended) or all in one vhost (won't work for multisite installs and may not work if you are using caching plugins).

For full details of how to do this, see the instructions for each method in the Server Setup section.

Download and install SitePush plugin

Download and install SitePush on one version of your site as per normal.

Update wp-config.php

In most cases you will need to update the wp-config.php file for each site you are pushing to. Because you are likely running different versions of sites at different URLs, you need to tell WordPress to override the WordPress Address and Site Address options.

To do this, add definitions for the WP_HOME and WP_SITEURL constants in your wp-config.php file. For more information about this please see the WordPress codex.

Sites config file

In addition to configuring SitePush's settings page, you will also need to create and some settings files as described in this and the following sections. If at all possible upload these files outside of your web root so they are not accessible from a web browser. If that is not possible, make sure the file names end in '.php' and that you include the first line from the sample files.

The sites config file contains information about all the sites you wish to push/pull between. It looks like this:-

; <?php die('Forbidden'); ?> -*- conf -*-

[all]
wp_dir = /wp
wp_content_dir = /wp/wp-content
cache = no
caches[] = /caches/timthumb
caches[] = /caches/something_else

[live]
label = Live Site
domains[] = live.example.com
domains[] = live.example.co.uk
web_path = /var/www/vhosts/mysite-live
db = live
live = yes

[dev]
label = Dev Site
domain = dev.example.com
web_path = /var/www/vhosts/mysite-dev
db = dev
live = no

Each section represents parameters for a web site, with the exception of [all] - parameters in this section apply to all sites. Required parameters are as follows:-

  • [sitename] = a unique name for this site. It's only used internally (or as label if you don't supply the label parameter), and can be anything you like.
  • web_path = the full filesystem path to the web root for the site (not the root of the WordPress install if you have WordPress in a subdirectory).
  • domain = the domain this site is at. If the site uses more than one domain, use the domains[] parameter for each domain instead. Optional if domains[] parameters supplied.
  • domains[] (optional if domain parameter supplied) = if your site can be accessed via multiple domains (e.g. example.com, example.co.uk) then list each domain with the domains[] parameter. Make sure you include the [].
  • db = the SitePush label of the database this site uses, as defined in your databases config file (see below).

The following parameters are optional:-

  • label = label for your site used in menus, error messages etc. The label doesn't have to be unique, but it will be rather confusing if it's not.
  • wp_dir = the path from your webroot to this sites WordPress install. You shouldn't need to set this unless
  • wp_content_dir = the path from your webroot to the site's wp-content directory. You shouldn't need to set this.
  • wp_plugin_dir = the path from your webroot to the site's plugins directory. You shouldn't need to set this.
  • live = is this a live/production site (yes), or not (no). SitePush will show some warnings when you select a live site to push to, can prevent users logging into live sites and can activate/deactivate specific plugins on live sites. Defaults to no.
  • default = if set to yes, SitePush will use settings for this site if it can't figure out what config to use for a site. This should be set at most for one site. Defaults to no.
  • cache = is caching turned on for this site (yes or no). If you have set WP_CACHE to TRUE in your wp-config for this site, you should set this to yes. Defaults to no.
  • caches[] = if your site has any cache directories which should be cleared when you update the site, enter the full filesystem path to those directories here, and SitePush will empty those directories whenever you push if the Clear cache on destination option is set when you push.
  • admin_only = if only admins should be able to push to/pull from this site, then set to yes. Defaults to no.
  • source_only = if set to yes, non-admins will not be able to push to this site. Defaults to no.
  • destination_only = if set to yes, non-admins will not be able to push from this site. Defaults to no.

Don't include a trailing slash on any paths.

Databases config file

The databases config file contains information about your sites' databases.

; <?php die('Forbidden'); ?> -*- conf -*-
; Do not remove the above line, it is all that prevents this file from being downloaded.

[all]
prefix = wp_

[live]
name = live_database
user = db_user
pw = live_db_password

[dev]
name = dev_database
user = db_user
pw = dev_db_password

Each section represents parameters for a WordPress database, with the exception of [all] - parameters in this section apply to all sites. Required parameters are as follows:-

  • [dblabel] = a unique label for this database. This label is used for the db parameter in the sites config file.
  • name = the name of the database (same as DB_NAME in wp-config).
  • user = the user name for accessing the database (same as DB_USER in wp-config).
  • pw = the database password (same as DB_PASSWORD in wp-config).

The following parameters are optional:-

  • host = the database host. Defaults to DB_HOST.

NOTE All databases you are pushing to/from must use the same prefix.

Domain map config file

If you are running a Multisite installation, you will also need to create a domain map file so that SitePush knows which domains apply to which sites. The file should have as many sections as you have SitePush sites defined in your sites config file, and each section should contain one entry for each blog in your multisite setup. If your multisite installation is set up as a subdomain install, then you should list the full domains for each site, for example:-

; <?php die('Forbidden'); ?> -*- conf -*-
; Do not remove the above line, it is all that prevents this file from being downloaded.

[live]
1 = site1.example.com
2 = site2.example.com
3 = site3.example.com

[dev]
1 = dev1.example.com
2 = dev2.example.com
3 = dev3.example.com
  • [sitename] = the name you have given this site. It should be exactly the same as [sitename] in your sites config file.
  • blogid = domain = define the primary domain for each blogid in your network. If you are using a sub-directory set up, then the domain would be the same for each blog, but you still need to enter it for each one.

If, on the other hand, your installation is set up as a subdirectory install, then the domains in each section will be the same, for example:-

; <?php die('Forbidden'); ?> -*- conf -*-
; Do not remove the above line, it is all that prevents this file from being downloaded.

[live]
1 = live.example.com
2 = live.example.com
3 = live.example.com

[dev]
1 = dev.example.com
2 = dev.example.com
3 = dev.example.com

** do not include the subdirectory path for each site **

If you do not configure this correctly, you will not be able to access blogs where you have pushed multisite tables (or if you pushed the whole database) and may have problems accessing individual blogs where you pushed options for that blog. If this does happen, you will need to manually edit the wp_blogs, wp_site, wp_sitemeta and options tables, or restore from a backup.

Other Important Notes for Multisite Setups

  1. Support for Multisite is experimental and to enable it you will need to define SITEPUSH_ALLOW_MULTISITE as TRUE in wp-config. There may be some rough edges and note that SitePush has not been thoroughly tested on Multisite configurations, so make sure you have appropriate backups.
  2. SitePush settings for each blog are independent, so you will need to configure each blog separately. Each blog will probably need its own sites config file (as domains and/or subdirectories will be different for each blog), but can and should share a common database config file. The domain map config file should also be common amongst all sites.
  3. SitePush uses the term site to distinguish between different versions of a site - e.g. live, staging, development. A SitePush site is not the same as a Multisite site (which is actually a network of blogs). A standard Multisite setup normally only has one site but many blogs (so really it should be called a Multiblog setup...).
  4. If you have a large Multisite network, you should probably avoid pushing all tables... if it takes too long the script may time out and you may be left with an incomplete database.
  5. In Multisite setups, only Super Admins can administer SitePush.

Requires: 3.3.1 or higher
Compatible up to: 3.6.1
Last Updated: 2013-9-9
Downloads: 5,324

Ratings

5 stars
5 out of 5 stars

Support

1 of 2 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
100,1,1
100,1,1