Contents


Installation

There are several methods of installing Revisr. This tutorial will cover the most common methods of installation. First, please review the requirements below to make sure that your environment is compatible with Revisr.

Requirements

  • A web server with Git installed
  • The PHP exec() function must be enabled on the server (safe mode off)

Setting Up the Local Repository

The steps taken for setting up the local repository will depend on your environment. This tutorial makes the following assumptions:

  • You have Git installed on your server.
  • The environment path to Git is set on the server (you can do a git status instead of usr/bin/.git status ).

If you’re setting up a new repository based on an existing WordPress install:

  1. Log into WordPress and activate Revisr if necessary
  2. Navigate to the Revisr Dashboard page via the WordPress admin menu
  3. Click the link to create a new repository using the current WordPress install
  4. Confirm any tracking settings on the plugin settings page and make your first commit

If you’re using Revisr with an existing Git repository, simply activate the plugin and it will use your existing settings from Git for pushing to remotes, tracking files, and more. Please note that if installing Revisr on top of an existing repository, Revisr requires that the “.git” directory is in the WordPress document root or directly above it.

Configuring Revisr

Once Revisr has been installed, you will need to configure any necessary settings on the Revisr Settings page in order for the plugin to work properly.

General Settings

  • Username – The username that is to be used for committing changes to the repository. If you’re using a service like Bitbucket or GitHub, this will be the same as your Bitbucket/Github username.
  • EmailThe email address associated with the username above, and is also used for notifications if enabled. If you’re using a service like Bitbucket or GitHub, this will be the same as the email associated with your account.
  • Files/Directories to add to .gitignoreYou can add any files or directories that you don’t want to be tracked in the repository here. Revisr will attempt to save these settings directly to the “.gitignore” file for the repository, so you’ll need to make sure that Revisr has write permissions to that file for this to work correctly.
wp-config.php
.htaccess
wp-content/themes/

Remote Settings

Note: Revisr will attempt to use the settings stored in the “.git/config” file for connecting to a remote repository. You can overwrite the settings in this by updating the settings in this section.

  • Remote Name – This will typically be “origin” by default, although if you have changed the remote name or have more than one remote, you can specify the name of the remote here.
  • Remote URL  – This is what Revisr will use for pushing/pulling changes. This field supports both HTTPS and SSH.
  • Revisr Webhook URL – Revisr will send a POST request to this URL when pushing (see “Automatically pull new commits” below).
  • Automatically push new commits – Whenever you make a new commit with Revisr, Revisr will automatically push that commit to the remote repository. Great if you’re using Revisr for making backups of your website.
  • Automatically pull new commits  – Checking this box will generate a secure webhook that can be added to Bitbucket, GitHub, or other instances of Revisr. When this webhook is triggered, Revisr will pull any pending commits from the remote repository. This is mainly helpful if you have multiple instances of Revisr on the same repository.

Database Settings

  • Database Tables to Track – When set to “All Tables”, Revisr will backup/import all database tables (and any new tables added in the future). If you choose “Let Me Decide”, you can select the specific tables that you want to track in version control, and only these tables will be backed up/imported. If new tables are added to a remote repository and you’re importing changes from that remote, you will be asked if you want to import and track the new tables.
  • Import Database when Changing Branches – If checked, Revisr will backup the database immediately before switching branches, and import the database immediately after. This allows you to keep separate versions of the database on each branch (for example, a new post created on branch “dev” will not show up on branch “master”).
  • Import Database when Pulling Commits – If checked, Revisr will import the most recent version of the database stored in Git when pulling changes. Great for deploying changes to one or more servers from a development environment.
  • Development URL – If provided, Revisr will automatically run a search in the tracked tables for this URL, and replace it with the WordPress “Site URL” of the current site when importing the database.
  • Path to MySQL – This is necessary if the environment path to MySQL hasn’t been set on the server (i.e., you aren’t able to use the command “mysql” from command line/terminal). The example paths for MAMP and WAMP environments may work, but may need to be changed if you have a different version of MAMP/WAMP.

Securing the Environment

Once everything is setup, you’ll want to make sure that the “.git” directory isn’t directly accessible to the public. You can do this with Apache by adding the following .htaccess file to your .git directory:

content: Deny from all

Using Revisr

Once installed and configured, how you use Revisr is up to you. Here are some common scenarios:

  • Backup your entire WordPress site, including both the files and database
  • Create a new branch to test out core and plugin upgrades
  • Install Revisr on a live site, and use Revisr to pull down commits that have already been tested
  • Install Revisr on a development website, and use Revisr to test and commit changes to a remote repository or Bitbucket/GitHub
  • Setup a testing environment with Revisr configured to automatically push new commits, and set a remote installation with Revisr to automatically pull those commits.

It’s always up to you when you commit, so by only committing changes that have been tested and approved, you can greatly increase the stability of your WordPress website.