summaryrefslogtreecommitdiffstats
path: root/checkpkgist.php
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-02-07 09:58:09 +0100
committerRemi Collet <remi@php.net>2025-02-07 09:58:09 +0100
commitdca5861e5100c8291342f4cb1ed40aa033dbe060 (patch)
tree19d5dc7cd841a2b28395b1efd6e60ad721c7d3ad /checkpkgist.php
parentdffdd78c37147f6041f65107c23d37cb0f789eb0 (diff)
use packagist v3 endpoint
Diffstat (limited to 'checkpkgist.php')
-rwxr-xr-xcheckpkgist.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/checkpkgist.php b/checkpkgist.php
index 473bf86..b7b1712 100755
--- a/checkpkgist.php
+++ b/checkpkgist.php
@@ -56,7 +56,7 @@ class PkgClient {
}
function getPackage($name) {
- $url = self::URL . "p/$name.json";
+ $url = self::URL . "p2/$name.json";
$rep = $this->cache->get(__METHOD__, $url);
if (!$rep) {
$rep = @file_get_contents($url);
@@ -64,10 +64,6 @@ class PkgClient {
}
if ($rep) {
$rep =json_decode($rep, true);
- if (isset($rep['packages'][$name])) {
- // Higher version first
- uksort($rep['packages'][$name], function($a, $b) { return version_compare($b, $a); });
- }
return $rep;
}
return false;
@@ -183,7 +179,8 @@ function run($name, $rpm) {
$maxdat = false;
$display = false;
- foreach ($pkgs['packages'][$name] as $pkver => $pkg) {
+ foreach ($pkgs['packages'][$name] as $x => $pkg) {
+ $pkver = $pkg['version'];
if (preg_match('/^v[\.0-9]*$/', $pkver)) {
$pkver = substr($pkver, 1);
}