Private self-hosted Wordpress plugin (and theme) repository so your custom plugins (and themes) can be updated automatically. I have released this code so you can start building your solution upon.
This GitHub package contains also a demo plugin called mypluginslug1
. Read the instructions how to configure and deploy it on test server.
I don't know min. requirements, but it runs for me on PHP 7.3. It needs no database and requires access to shell + unzip class (both are not a big deal even on shared web-hosts).
- Fill
Config
class with your data, namely: domain, the path to the repository folder, latest tested WordPress version for all hosted plugins, minimum required WordPress version for all hosted plugins and an array of slugs belonging to plugins hosted within your private repository server - Set web accessible cronjob
https://www.example.com/repositoryfolder/get-info.php?action=cron
to every 6 hours
Repo script supports out of the box plugins with structure: mypluginslug1/mypluginslug1.php
while plugin header looks as follows:
/**
* Plugin Name: Mypluginslug One
* Description: Plugin description.
* Version: 1.3
* Author: Jasom Dotnet
* Author URI: https://www.jasom.net
* Plugin URI: https://www.jasom.net
* License: MIT License
* License URI: http://opensource.org/licenses/MIT
* Text Domain: mypluginslug1
* Domain Path: /languages
*/
Tag versions like 1.1
, 1.2
, 1.3
...
- Create plugin with following structure:
mypluginslug1/mypluginslug1.php
- Zip plugin and upload it to repository folder
- In Config class, add a new plugin slug to the array represented by constant
PLUGINS
- Add 2 banners to the repository folder with the name (and dimensions) like
mypluginslug1-banner-1544x500.jpg
andmypluginslug1-banner-772x250.jpg
- Run cronjob above
- See final jSon under
https://www.example.com/repositoryfolder/get-info.php?slug=mypluginslug1
- Remove old
mypluginslug1.zip
from repositore server - Upload new
mypluginslug1.zip
(with changed version in plugin header) to repository server - Cronjob automatically does the rest
This is sample jSon produces by the script:
{
"status":"ok",
"name":"Myplugin One",
"slug":"mypluginslug1",
"download_link":"https:\/\/www.dobka.tk\/repositoryfolder\/mypluginslug1.zip",
"version":"1.0",
"requires":"5.0",
"tested":"5.3.2",
"last_updated":"2020-02-19 00:02:29",
"upgrade_notice":"Plugin update is available.",
"author":"Jasom Dotnet",
"author_homepage":"https:\/\/www.jasom.net",
"sections":{
"description":"Demonstration plugin.",
"installation":"Upload the plugin to your blog, activate it and that is it!"
},
"banners":{
"low":"https:\/\/www.dobka.tk\/repositoryfolder\/mypluginslug1-banner-772x250.jpg",
"high":"https:\/\/www.dobka.tk\/repositoryfolder\/mypluginslug1-banner-1544x500.jpg"
}
}
I have attached a simple plugin in mypluginslug1.zip
so read the code. It is also explained on script homepage.
Script homepage is here. This code was inspired by @rudrastyh's post Self-Hosted Plugin Update who took inspiration (I guess) from @YahnisElsts's wp-update-server.