From a1f6c259ead62e175f42bc19441fcd659d4f1691 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Fri, 12 Jan 2024 10:44:15 +0100 Subject: [PATCH] Add update details for Pro --- .../Admin/Updaters/Pro_Plugin_Updater.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/includes/Admin/Updaters/Pro_Plugin_Updater.php b/includes/Admin/Updaters/Pro_Plugin_Updater.php index 5ffb777..f0ee563 100644 --- a/includes/Admin/Updaters/Pro_Plugin_Updater.php +++ b/includes/Admin/Updaters/Pro_Plugin_Updater.php @@ -128,6 +128,46 @@ public function check_pro_plugin_status() { } } + /** + * This is a hack to manually trigger Pro update for version < 1.4.0 + * TODO: remove this after 1.4.0 is released for a while + */ + if ( $status['version'] && version_compare( $status['version'], '1.4.0', '<' ) ) { + // Manually the update_plugins transient + $update_plugins = get_site_transient( 'update_plugins' ); + if ( ! is_object( $update_plugins ) ) { + $update_plugins = new stdClass(); + } + + $license_settings = $this->get_license_settings(); + + $update = array( + 'id' => 'https://updates.wcpos.com', + 'slug' => 'woocommerce-pos-pro', + 'plugin' => $this->pro_plugin_path, + 'new_version' => '1.4.1', + 'url' => 'https://wcpos.com/pro', + 'package' => add_query_arg( + array( + 'key' => isset( $license_settings['key'] ) ? $license_settings['key'] : '', + 'instance' => isset( $license_settings['instance'] ) ? $license_settings['instance'] : '', + ), + 'https://updates.wcpos.com/pro/download/1.4.1' + ), + 'requires' => '5.6', + 'tested' => '6.5', + 'requires_php' => '7.4', + 'icons' => array( + '1x' => 'https://wcpos.com/wp-content/uploads/2014/06/woopos-pro.png', + ), + 'upgrade_notice' => $this->maybe_add_upgrade_notice(), + ); + + $update_plugins->response[ $this->pro_plugin_path ] = (object) $update; + + set_site_transient( 'update_plugins', $update_plugins ); + } + return $status; }