Specifications
mgibbs189 opened this issue · comments
I'll update this comment with feedback from subsequent comments.
Goals
This is a drop-in library, allowing plugins to register both required and optional dependencies.
Registering Dependencies
- A plugin can register dependencies via a
wp-dependencies.json
file in the same directory - A plugin can register dependencies programmatically (TBA)
Dependency Config
- slug (required, e.g. "github-updater")
- label (required, e.g. "GitHub Updater")
- path (required, e.g. "github-updater/github-updater.php")
- uri (required, e.g. "https://github.com/afragen/github-updater")
- optional (optional, default = true)
- branch (optional, default = "master")
- token (optional, default = null)
Required Dependencies
Let core handle permissions.
Check file permissionsIf writable, each dependency will be automatically installed and activatedIf not writable, treat each dependency as an Optional dependency (e.g. display dependencies on the Plugins page, show a "Download ZIP" link beside each plugin)
Optional Dependencies
Check file permissions- Display each dependency below a plugin's listing on the Plugins page.
- Won't work for themes adding plugin dependencies
- If writable, the "Install Now" link should automatically install the plugin and return the user to the Plugins page.
- If not writable, show a "Download ZIP" link, so user can install manually
Nag Screen
- The Plugins page itself serves as the nag screen. If a dependency needs to be installed, the parent plugin will appear with a red background, exactly like other "Updates Available" plugins.
Miscellaneous
- Prevent display of plugin install feedback from automatically installed plugins, cosmetic.
Need to update for new json format, with first line as dependent plugin's slug.
Matt, this is pretty extensive.
Nag screen - check 28d62d7
Comment out https://github.com/afragen/wp-install-dependencies/blob/master/install-dependencies/wp-install-dependencies.php#L169 to see nag screen.
FYI - I've written a temporary drop-in specifically for GitHub Updater: https://github.com/mgibbs189/install-github-updater
As WP Install Dependencies gets further along, it'll make my code unnecessary 😉
Matt,
That looks great! I'd really appreciate a PR or when I have time I'll try to incorporate your methods.
Andy
List cleaned up as we should let core handle file permissions.