-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/add wp plugin update functionality #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kenwilliams-nu
merged 10 commits into
main
from
feature/add-wp-plugin-update-functionality
Aug 13, 2024
Merged
Feature/add wp plugin update functionality #5
kenwilliams-nu
merged 10 commits into
main
from
feature/add-wp-plugin-update-functionality
Aug 13, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raymondkingston
approved these changes
Aug 13, 2024
Contributor
raymondkingston
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CeeRoo
approved these changes
Aug 13, 2024
CeeRoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, Ken!
cam-vanorman
approved these changes
Aug 13, 2024
Contributor
cam-vanorman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


OVERVIEW
These changes enable this WordPress plugin to be updated through WP Admin, when a new version of the plugin is available in this repo. The plugin's code determines if a new version is available by checking a json manifest file, served from GitHub pages and updated when that file is updated in the main branch of this repo.
DETAILS
manifest/info.json- This file contains information about the plugin, including the version and a URL for the associated release zip file. The json file is published to a GitHub page when changes are pushed to the branch. The plugin code checks this GitHub page to determine if a new version is available, to populate information about the update in the WP Admin plugin manager, and perform the update when triggered by the user..nojekyll- The presence of this file in root bypasses Jekyll processing on the GitHub page build, as no theming is needed given that we are just serving a json file.nu_global_elements.php- Added a class to check for plugin updates (by checking theinfo.jsonmanifest file hosted on GitHub pages, as described above), display information about the update in the WP Admin plugin manager, and perform the update when triggered by the user. For a detailed description of how the code works, see this article. I also added two constants, defined at the top of the file, for ease of changing the version number and json manifest URL. Note that the plugin version must be changed both in the comment at the top of the file, and the NU_GLOBAL_ELEMENTS_PLUGIN_VER constant. I also added theif (!defined('ABSPATH')) { exit; }line to keep the plugin from being run outside of WordPress.README.md- Updated information in the readme.I've tested this new update functionality locally and on the BC dev server an it works (you can test by manually reducing the version in the code of the installed plugin). Right now the json manifest file is published to a GitHub page when changes are pushed to this branch, but I will change that to the main branch once these changes are ready to be merged to main.