From 4e7d8c0a94d0748b4d9df36db3928a4341f5b1c0 Mon Sep 17 00:00:00 2001 From: Ante Primorac Date: Tue, 28 Nov 2023 19:08:15 +0100 Subject: [PATCH] add wp plugin update checker --- wordpress-plugin/composer.json | 3 +- wordpress-plugin/composer.lock | 48 +++++++++++++++++++++++++++++++- wordpress-plugin/medusawp.php | 1 + wordpress-plugin/src/Updater.php | 20 +++++++++++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 wordpress-plugin/src/Updater.php diff --git a/wordpress-plugin/composer.json b/wordpress-plugin/composer.json index de6d2ce..f5f0541 100644 --- a/wordpress-plugin/composer.json +++ b/wordpress-plugin/composer.json @@ -26,7 +26,8 @@ "guzzlehttp/guzzle": "^7.3", "guzzlehttp/psr7": "^1.7 || ^2.0", "illuminate/validation": "^8.83", - "woocommerce/action-scheduler": "^3.7" + "woocommerce/action-scheduler": "^3.7", + "yahnis-elsts/plugin-update-checker": "^5.3" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "*", diff --git a/wordpress-plugin/composer.lock b/wordpress-plugin/composer.lock index e94c626..423950e 100644 --- a/wordpress-plugin/composer.lock +++ b/wordpress-plugin/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d200d77fb46e885a1b431e8a96915e61", + "content-hash": "fde47a6b721b01ad09afebdf31e40d05", "packages": [ { "name": "composer/installers", @@ -2444,6 +2444,52 @@ "reference": "3.7.0" }, "type": "library" + }, + { + "name": "yahnis-elsts/plugin-update-checker", + "version": "v5.3", + "source": { + "type": "git", + "url": "https://github.com/YahnisElsts/plugin-update-checker.git", + "reference": "0b6bd7cd3286688ab680201aa6a7d8572c51ae1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/YahnisElsts/plugin-update-checker/zipball/0b6bd7cd3286688ab680201aa6a7d8572c51ae1f", + "reference": "0b6bd7cd3286688ab680201aa6a7d8572c51ae1f", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.6.20" + }, + "type": "library", + "autoload": { + "files": [ + "load-v5p3.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Yahnis Elsts", + "email": "whiteshadow@w-shadow.com", + "homepage": "https://w-shadow.com/", + "role": "Developer" + } + ], + "description": "A custom update checker for WordPress plugins and themes. Useful if you can't host your plugin in the official WP repository but still want it to support automatic updates.", + "homepage": "https://github.com/YahnisElsts/plugin-update-checker/", + "keywords": [ + "automatic updates", + "plugin updates", + "theme updates", + "wordpress" + ], + "time": "2023-11-09T08:34:00+00:00" } ], "packages-dev": [ diff --git a/wordpress-plugin/medusawp.php b/wordpress-plugin/medusawp.php index cb4bd83..cc66ebc 100755 --- a/wordpress-plugin/medusawp.php +++ b/wordpress-plugin/medusawp.php @@ -43,6 +43,7 @@ require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload.php'; require_once plugin_dir_path( __FILE__ ) . '/functions.php'; +\MedusaWP\Updater::init( __FILE__ ); /** * The code that runs during plugin activation. diff --git a/wordpress-plugin/src/Updater.php b/wordpress-plugin/src/Updater.php new file mode 100644 index 0000000..5c62c15 --- /dev/null +++ b/wordpress-plugin/src/Updater.php @@ -0,0 +1,20 @@ +