Skip to content

Updating a Disciple Tools Plugin

corsacca edited this page Feb 27, 2018 · 1 revision

This is the documentation for remote updating of a Disciple Tools Plugin.

Steps for making a new release:

  1. Update version number in two places in disciple-tools-[*plugin-name*].php and commit changes to Github.
    • In the comment at the top
    • The $this->version variable
  2. Download master [.zip] from the plugin Github repo, rename .zip to disciple-tools-[*plugin-name*].zip
  3. Create a new release in GitHub with the new version number (eg: 1.3.1) and release description. The description must have a description section, a 'version required' line, and 'version tested up to' line. (See example)
  4. Attach the plugin .zip file to the new version release.
  5. Final Step (must be last), update the correct disciple-tools-[*plugin-name*]-version-control.json found here. This .json file needs updated in 4 places.
    • at "version"
    • at "download_url"
    • at "tested"
    • at "upgrade_notice"

Mechanics of the updating system:

If a theme is hosted in the Wordpress directory, it has native access to the updating system inside the Wordpress software. But if the theme is not hosted inside the directory, and is therefore remotely hosted, then an additional system must be used to trigger and deliver updates to the native updating system inside the Wordpress software. This is what is required for Disciple Tools, because the requirements for hosting inside the Wordpress Directory to severly limit the implementation of the Disciple Tools system. (For example, not using custom tables for which Disciple Tools requires 6.)

The system for managing the remote update in Disciple Tools uses the library plugin-update-checker, which is found inside disciple-tools-webform/admin/libraries/.

This library is called from a class loaded in the functions.php file.

if ( ! class_exists( 'Puc_v4_Factory' ) ) {
            require( get_template_directory() . '/dt-core/libraries/plugin-update-checker/plugin-update-checker.php' );
        }
        Puc_v4_Factory::buildUpdateChecker(
            'https://raw.githubusercontent.com/DiscipleTools/disciple-tools-version-control/master/disciple-tools-webform-control.json',
            __FILE__,
            'disciple-tools-webform'
        );

When the Disciple_Tools class is loaded it checkes the .json url hosted here to see if there is a version update published. If there is, then the class downloads the .zip file hosted in the releases of Disciple-Tools-Theme and pulls the disciple-tools-webform.zip which should be prepared as part of the release.

This file is downloaded and goes through the native updating process built into the Wordpress software.

Fortunately, Github allows for raw hosting of .json files through its RAW file view, which makes hosting this .json version file here a great option, even thought it could be hosted on any public server.

Updating

Clone this wiki locally