Skip to content

Commit 498aa3b

Browse files
authored
Merge pull request #112 from wpstarter/dev
v1.9.5
2 parents 763723b + b00035b commit 498aa3b

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/WpStarter/Wordpress/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Application extends \WpStarter\Foundation\Application
1111
*
1212
* @var string
1313
*/
14-
const VERSION = '1.9.4';
14+
const VERSION = '1.9.5';
1515

1616
protected $bootstrappedList = [];
1717

src/WpStarter/Wordpress/Plugins/Updater.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
class Updater
99
{
1010
protected $pluginsRepository;
11+
protected $pluginsDir;
1112
public function __construct($pluginsDir)
1213
{
14+
$this->pluginsDir=$pluginsDir;
1315
$this->pluginsRepository=new Repository($pluginsDir);
1416
}
1517

@@ -26,7 +28,16 @@ function getUpdates(){
2628
'locale' => json_encode( [] ),
2729
'all' => json_encode( true ),
2830
);
29-
$userAgent = 'WordPress/6.2.2' . '; ' . 'http://localhost';
31+
if(defined('ABSPATH') && defined('WPINC')){
32+
$versionFile = ABSPATH . WPINC . '/version.php';
33+
}else{
34+
$versionFile = dirname(dirname($this->pluginsDir)) . '/wp-includes/version.php';
35+
}
36+
$wp_version = '6.x';
37+
if ( file_exists( $versionFile ) ) {
38+
include $versionFile;
39+
}
40+
$userAgent = 'WordPress/'.$wp_version . '; ' . 'http://localhost';
3041
$formData=http_build_query($data);
3142
$headers = array(
3243
'Content-Type: application/x-www-form-urlencoded',

0 commit comments

Comments
 (0)