@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | $http = new HttpFactory; |
29 | 29 | $http = $http->getHttp([ |
30 | - 'userAgent' => 'Joomla! Statistics Server v1', |
|
30 | + 'userAgent' => 'Joomla! Statistics Server v1', |
|
31 | 31 | ]); |
32 | 32 | |
33 | 33 | $phpJsonData = []; |
@@ -38,38 +38,38 @@ discard block |
||
38 | 38 | |
39 | 39 | if (!isset($joomlaReleases->releases)) |
40 | 40 | { |
41 | - // Exiting here as it seems the API has issues. |
|
42 | - exit; |
|
41 | + // Exiting here as it seems the API has issues. |
|
42 | + exit; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | foreach ($joomlaReleases->releases as $joomlaRelease) |
46 | 46 | { |
47 | - /** |
|
48 | - * object(stdClass)#8 (4) { |
|
49 | - * ["version"]=> |
|
50 | - * string(6) "3.9.20" |
|
51 | - * ["branch"]=> |
|
52 | - * string(9) "Joomla! 3" |
|
53 | - * ["date"]=> |
|
54 | - * string(25) "2020-07-14T15:00:00+00:00" |
|
55 | - * ["relationships"]=> |
|
56 | - * object(stdClass)#5 (1) { |
|
57 | - * ["signatures"]=> |
|
58 | - * string(57) "https://downloads.joomla.org/api/v1/signatures/cms/3-9-20" |
|
59 | - * } |
|
60 | - * } |
|
61 | - */ |
|
62 | - |
|
63 | - // We only want Joomla 3 and 4 Releases here |
|
64 | - if ($joomlaRelease->branch === 'Joomla! 3' || $joomlaRelease->branch === 'Joomla! 4') |
|
65 | - { |
|
66 | - $joomlaJsonData[] = $joomlaRelease->version; |
|
67 | - } |
|
47 | + /** |
|
48 | + * object(stdClass)#8 (4) { |
|
49 | + * ["version"]=> |
|
50 | + * string(6) "3.9.20" |
|
51 | + * ["branch"]=> |
|
52 | + * string(9) "Joomla! 3" |
|
53 | + * ["date"]=> |
|
54 | + * string(25) "2020-07-14T15:00:00+00:00" |
|
55 | + * ["relationships"]=> |
|
56 | + * object(stdClass)#5 (1) { |
|
57 | + * ["signatures"]=> |
|
58 | + * string(57) "https://downloads.joomla.org/api/v1/signatures/cms/3-9-20" |
|
59 | + * } |
|
60 | + * } |
|
61 | + */ |
|
62 | + |
|
63 | + // We only want Joomla 3 and 4 Releases here |
|
64 | + if ($joomlaRelease->branch === 'Joomla! 3' || $joomlaRelease->branch === 'Joomla! 4') |
|
65 | + { |
|
66 | + $joomlaJsonData[] = $joomlaRelease->version; |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if (!in_array('4.0.0', $joomlaJsonData)) |
71 | 71 | { |
72 | - $joomlaJsonData[] = '4.0.0'; |
|
72 | + $joomlaJsonData[] = '4.0.0'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Make sure the current release +1 is in that JSON |
@@ -78,66 +78,66 @@ discard block |
||
78 | 78 | |
79 | 79 | if (!isset($joomlaLatestReleases->branches)) |
80 | 80 | { |
81 | - // Exiting here as it seems the API has issues. |
|
82 | - exit; |
|
81 | + // Exiting here as it seems the API has issues. |
|
82 | + exit; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | foreach ($joomlaLatestReleases->branches as $joomlaLatestRelease) |
86 | 86 | { |
87 | - // We only want Joomla 3 and 4 Releases here |
|
88 | - if ($joomlaLatestRelease->branch === 'Joomla! 3' || $joomlaLatestRelease->branch === 'Joomla! 4') |
|
89 | - { |
|
90 | - list($major, $minor, $patch) = explode('.', $joomlaLatestRelease->version); |
|
91 | - $major = (int) $major; |
|
92 | - $minor = (int) $minor; |
|
93 | - $patch = (int) $patch; |
|
94 | - $patch++; |
|
95 | - |
|
96 | - $joomlaJsonData[] = $major . '.' . $minor . '.' . $patch; |
|
97 | - } |
|
87 | + // We only want Joomla 3 and 4 Releases here |
|
88 | + if ($joomlaLatestRelease->branch === 'Joomla! 3' || $joomlaLatestRelease->branch === 'Joomla! 4') |
|
89 | + { |
|
90 | + list($major, $minor, $patch) = explode('.', $joomlaLatestRelease->version); |
|
91 | + $major = (int) $major; |
|
92 | + $minor = (int) $minor; |
|
93 | + $patch = (int) $patch; |
|
94 | + $patch++; |
|
95 | + |
|
96 | + $joomlaJsonData[] = $major . '.' . $minor . '.' . $patch; |
|
97 | + } |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $php530found = false; |
101 | 101 | |
102 | 102 | while ($php530found === false) |
103 | 103 | { |
104 | - $page = 0; |
|
105 | - |
|
106 | - // Get all PHP Releases via GitHub Releases |
|
107 | - $phpReleases = json_decode( |
|
108 | - $http->get( |
|
109 | - 'https://api.github.com/repos/php/php-src/tags?page=' . $page, |
|
110 | - [ |
|
111 | - 'Accept' => 'application/vnd.github.v3+json', |
|
112 | - 'token' => $configuration->get('github.gh.token') |
|
113 | - ] |
|
114 | - )->body |
|
115 | - ); |
|
116 | - |
|
117 | - foreach ($phpReleases as $phpRelease) |
|
118 | - { |
|
119 | - |
|
120 | - var_dump($phpRelease); |
|
121 | - exit; |
|
122 | - |
|
123 | - if (substr($phpRelease->name, 0, 4) === 'php-') |
|
124 | - { |
|
125 | - //$phpVersion = preg_replace('/[^0-9.]/', '', $phpRelease->name); |
|
126 | - $phpVersion = str_replace('php-', '', $phpRelease->name); |
|
127 | - |
|
128 | - if (!in_array($phpVersion, $phpJsonData)) |
|
129 | - { |
|
130 | - $phpJsonData[] = $phpVersion; |
|
131 | - } |
|
132 | - |
|
133 | - if ($phpVersion === '5.3.0') |
|
134 | - { |
|
135 | - $php530found = true; |
|
136 | - } |
|
137 | - } |
|
138 | - } |
|
139 | - |
|
140 | - $page++; |
|
104 | + $page = 0; |
|
105 | + |
|
106 | + // Get all PHP Releases via GitHub Releases |
|
107 | + $phpReleases = json_decode( |
|
108 | + $http->get( |
|
109 | + 'https://api.github.com/repos/php/php-src/tags?page=' . $page, |
|
110 | + [ |
|
111 | + 'Accept' => 'application/vnd.github.v3+json', |
|
112 | + 'token' => $configuration->get('github.gh.token') |
|
113 | + ] |
|
114 | + )->body |
|
115 | + ); |
|
116 | + |
|
117 | + foreach ($phpReleases as $phpRelease) |
|
118 | + { |
|
119 | + |
|
120 | + var_dump($phpRelease); |
|
121 | + exit; |
|
122 | + |
|
123 | + if (substr($phpRelease->name, 0, 4) === 'php-') |
|
124 | + { |
|
125 | + //$phpVersion = preg_replace('/[^0-9.]/', '', $phpRelease->name); |
|
126 | + $phpVersion = str_replace('php-', '', $phpRelease->name); |
|
127 | + |
|
128 | + if (!in_array($phpVersion, $phpJsonData)) |
|
129 | + { |
|
130 | + $phpJsonData[] = $phpVersion; |
|
131 | + } |
|
132 | + |
|
133 | + if ($phpVersion === '5.3.0') |
|
134 | + { |
|
135 | + $php530found = true; |
|
136 | + } |
|
137 | + } |
|
138 | + } |
|
139 | + |
|
140 | + $page++; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | \define('APPROOT', \dirname(__DIR__)); |
11 | 11 | |
12 | 12 | // Ensure we've initialized Composer |
13 | -if (!file_exists(APPROOT . '/vendor/autoload.php')) |
|
13 | +if (!file_exists(APPROOT.'/vendor/autoload.php')) |
|
14 | 14 | { |
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -require APPROOT . '/vendor/autoload.php'; |
|
18 | +require APPROOT.'/vendor/autoload.php'; |
|
19 | 19 | |
20 | 20 | |
21 | 21 | use Joomla\Http\HttpFactory; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | // Load the config |
25 | 25 | $configuration = new Registry; |
26 | -$configuration->loadFile(APPROOT . '/etc/config.json'); |
|
26 | +$configuration->loadFile(APPROOT.'/etc/config.json'); |
|
27 | 27 | |
28 | 28 | $http = new HttpFactory; |
29 | 29 | $http = $http->getHttp([ |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $patch = (int) $patch; |
94 | 94 | $patch++; |
95 | 95 | |
96 | - $joomlaJsonData[] = $major . '.' . $minor . '.' . $patch; |
|
96 | + $joomlaJsonData[] = $major.'.'.$minor.'.'.$patch; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // Get all PHP Releases via GitHub Releases |
107 | 107 | $phpReleases = json_decode( |
108 | 108 | $http->get( |
109 | - 'https://api.github.com/repos/php/php-src/tags?page=' . $page, |
|
109 | + 'https://api.github.com/repos/php/php-src/tags?page='.$page, |
|
110 | 110 | [ |
111 | 111 | 'Accept' => 'application/vnd.github.v3+json', |
112 | 112 | 'token' => $configuration->get('github.gh.token') |
@@ -148,5 +148,5 @@ discard block |
||
148 | 148 | |
149 | 149 | |
150 | 150 | // Write JSON to file |
151 | -file_put_contents(APPROOT . '/versions/joomla.json', $joomlaJson); |
|
152 | -file_put_contents(APPROOT . '/versions/php.json', $phpJson); |
|
151 | +file_put_contents(APPROOT.'/versions/joomla.json', $joomlaJson); |
|
152 | +file_put_contents(APPROOT.'/versions/php.json', $phpJson); |