-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.php
More file actions
executable file
·38 lines (32 loc) · 973 Bytes
/
patch.php
File metadata and controls
executable file
·38 lines (32 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
$version = $argv[1];
//$version = '4.4.11';
list($major, $medium, $minor) = explode('.', $version);
echo $major;
$path = $argv[2];
// $json = $argv[2];
// $json = file_get_contents(' https://api.wordpress.org/coreversion-check/1.7/?version='.$version.'&locale=%22fr_FR%22');
// $obj = json_decode($json);
// // var_dump($obj);
// var_dump($version);
// var_dump($path);
function contains($needle, $haystack)
{
return strpos($haystack, $needle) !== false;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://api.wordpress.org/core/version-check/1.7/?version='.$version.'&locale=%22fr_FR%22');
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);
$nextv='';
foreach ($obj->offers as $key => $value) {
$m = $major.'.'.$medium;
if(contains($m,$value->version)){
$nextv = $value->version;
$url = $value->download;
echo $url;
}
}