From b30f17c23e3dcf457078ae02ff01f0cfde130600 Mon Sep 17 00:00:00 2001 From: as247 Date: Tue, 19 Dec 2023 23:45:37 +0700 Subject: [PATCH 1/2] Plugins updater load current wp version --- src/WpStarter/Wordpress/Plugins/Updater.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/WpStarter/Wordpress/Plugins/Updater.php b/src/WpStarter/Wordpress/Plugins/Updater.php index 0d97b0f..4a2e561 100644 --- a/src/WpStarter/Wordpress/Plugins/Updater.php +++ b/src/WpStarter/Wordpress/Plugins/Updater.php @@ -8,8 +8,10 @@ class Updater { protected $pluginsRepository; + protected $pluginsDir; public function __construct($pluginsDir) { + $this->pluginsDir=$pluginsDir; $this->pluginsRepository=new Repository($pluginsDir); } @@ -26,7 +28,16 @@ function getUpdates(){ 'locale' => json_encode( [] ), 'all' => json_encode( true ), ); - $userAgent = 'WordPress/6.2.2' . '; ' . 'http://localhost'; + if(defined('ABSPATH') && defined('WPINC')){ + $versionFile = ABSPATH . WPINC . '/version.php'; + }else{ + $versionFile = dirname(dirname($this->pluginsDir)) . '/wp-includes/version.php'; + } + $wp_version = '6.x'; + if ( file_exists( $versionFile ) ) { + include $versionFile; + } + $userAgent = 'WordPress/'.$wp_version . '; ' . 'http://localhost'; $formData=http_build_query($data); $headers = array( 'Content-Type: application/x-www-form-urlencoded', From b00035b592bfb22cb2c4e0c5cfda4b4253c6189f Mon Sep 17 00:00:00 2001 From: as247 Date: Tue, 19 Dec 2023 23:46:09 +0700 Subject: [PATCH 2/2] v1.9.5 --- src/WpStarter/Wordpress/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WpStarter/Wordpress/Application.php b/src/WpStarter/Wordpress/Application.php index ad73de5..737b87f 100644 --- a/src/WpStarter/Wordpress/Application.php +++ b/src/WpStarter/Wordpress/Application.php @@ -11,7 +11,7 @@ class Application extends \WpStarter\Foundation\Application * * @var string */ - const VERSION = '1.9.4'; + const VERSION = '1.9.5'; protected $bootstrappedList = [];