From 9645b1a3d2553e72665fa952b2e8c0a05a891dd9 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 15 Mar 2019 09:03:14 +0100 Subject: [PATCH] show package info --- bin/pecl | 8 ++++++++ bin/pecl+sig | 8 ++++++++ public/html.php | 10 +++++++++- public/index.php | 10 ++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/bin/pecl b/bin/pecl index a696acb..10fb3bd 100755 --- a/bin/pecl +++ b/bin/pecl @@ -41,6 +41,13 @@ function wait(&$pids) { return $pid > 0; }; +function info($pkg, $dir) { + $inf = file_get_contents("https://pecl.php.net/rest/p/$pkg/info.xml"); + if ($inf) { + file_put_contents("$dir/info.xml", $inf); + } +} + function work($url, $dir) { is_dir($dir) || mkdir($dir, 0777, true); require_once __DIR__."/../vendor/autoload.php"; @@ -69,6 +76,7 @@ if (($sxe = simplexml_load_file("http://pecl.php.net/feeds/$what.rss"))) { exit; case 0: work($url, $dir); + info($pgk, $dir); exit; default: $pids[$pid] = compact("url", "pkg", "ver", "skp", "ext", "dir"); diff --git a/bin/pecl+sig b/bin/pecl+sig index e615e5b..dd3de50 100755 --- a/bin/pecl+sig +++ b/bin/pecl+sig @@ -30,6 +30,13 @@ function sign($pkg, $ext) { } } +function info($pkg, $dir) { + $inf = file_get_contents("https://pecl.php.net/rest/p/$pkg/info.xml"); + if ($inf) { + file_put_contents("$dir/info.xml", $inf); + } +} + function wait(&$pids) { $status = null; switch ($pid = pcntl_wait($status)) { @@ -84,6 +91,7 @@ if (($sxe = simplexml_load_file("https://pecl.php.net/feeds/$what.rss"))) { exit; case 0: work($url, $dir); + info($pkg, $dir); exit; default: $pids[$pid] = compact("url", "pkg", "ver", "skp", "ext", "dir"); diff --git a/public/html.php b/public/html.php index 13ed7be..ebda332 100644 --- a/public/html.php +++ b/public/html.php @@ -88,6 +88,9 @@ $res->addHeader("Link", "<".dirname((new http\Env\Url)->path)."concise/css/conci .old-version, #new-toggle { display: none; } + .package-description { + white-space: pre-line; + } @@ -102,9 +105,14 @@ $res->addHeader("Link", "<".dirname((new http\Env\Url)->path)."concise/css/conci
- +

+ +


+ License:

+

+ diff --git a/public/index.php b/public/index.php index c167980..72a97f6 100644 --- a/public/index.php +++ b/public/index.php @@ -66,6 +66,16 @@ function package_versions($package) { return $versions; } +function package_info($package) { + if (($xml = simplexml_load_file("phars/$package/info.xml"))) { + return [ + "title" => (string) $xml->s, + "description" => (string) $xml->d, + "license" => (string) $xml->l + ]; + } +} + $packages = array_map("basename", glob("phars/*", GLOB_NOSORT|GLOB_ONLYDIR)); sort($packages, SORT_NATURAL|SORT_FLAG_CASE); -- 2.30.2