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