Skip to content

Instantly share code, notes, and snippets.

@petertwise
Last active May 27, 2021 19:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petertwise/6fe0b0ce6db5d670b86149136af41fc5 to your computer and use it in GitHub Desktop.
Save petertwise/6fe0b0ce6db5d670b86149136af41fc5 to your computer and use it in GitHub Desktop.
Upgrade from github-updater 9.x to git-updater 10.x and git-updater-pro
#!/bin/bash
# Upgrade from github-updater 9.x to git-updater 10.x and git-updater-pro
# Instructions:
# 1. make sure you have WP CLI installed
# 2. install this file in /usr/local/bin or the executable path of your choice and make sure it has execute permissions
# 3. make a file called .gitupdater-download-link with the your personal download link and save it to /user/local/bin
# 4. make a file called .gitupdater-license-key with the your pro license key and save it to /user/local/bin
# 5. cd into your website's root dir and run `git-updater-upgrade`
# copy the existing API key
OLD_API_KEY=`wp option get github_updater_api_key`
# remove the old plugin
wp plugin deactivate github-updater
wp plugin delete github-updater
# install the new base plugin
wp plugin install --activate https://github.com/afragen/git-updater/archive/master.zip
# install the new pro plugin
GITUPDATER_DOWNLOAD_LINK=`cat /usr/local/bin/.gitupdater-download-link`
wp plugin install --activate ${GITUPDATER_DOWNLOAD_LINK} --quiet
# install the license key deployment plugin and activate the key
wp plugin install --activate https://github.com/squarecandy/freemius-auto-activation/archive/main.zip
GHU_PRO_LICENSE_KEY=`cat /usr/local/bin/.gitupdater-license-key`
wp config set WP__GUP_FS__LICENSE_KEY $GHU_PRO_LICENSE_KEY --quiet
wp config set FS_SHORTCODES "array( 'gup_fs' )" --raw
wp eval "new Freemius_License_Auto_Activator( 'gup_fs' );"
# then delete the plugin and
wp plugin deactivate freemius-auto-activation --uninstall
wp config set WP__GUP_FS__LICENSE_KEY ''
# migrate the API key
wp option update git_updater_api_key $OLD_API_KEY
wait
echo "✅ Upgrade Complete!
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment