Skip to content

Commit

Permalink
Plugins updater load current wp version
Browse files Browse the repository at this point in the history
  • Loading branch information
as247 committed Dec 19, 2023
1 parent a1dd6f5 commit b30f17c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/WpStarter/Wordpress/Plugins/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
class Updater
{
protected $pluginsRepository;
protected $pluginsDir;
public function __construct($pluginsDir)
{
$this->pluginsDir=$pluginsDir;
$this->pluginsRepository=new Repository($pluginsDir);
}

Expand All @@ -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',
Expand Down

0 comments on commit b30f17c

Please sign in to comment.