show package info
authorMichael Wallner <root@s201809.m6w6.name>
Fri, 15 Mar 2019 08:03:14 +0000 (09:03 +0100)
committerMichael Wallner <root@s201809.m6w6.name>
Fri, 15 Mar 2019 08:03:14 +0000 (09:03 +0100)
bin/pecl
bin/pecl+sig
public/html.php
public/index.php

index a696acb7c7620156e4485ccdf40d72d226209e7f..10fb3bdd8850acb9d81c7bf8be9d6dabf06d957c 100755 (executable)
--- 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");
index e615e5bf2b8d5c55bc072efd809a3a9fc6bd5bae..dd3de50e7ef534598c06798e1e26d0e0524ba911 100755 (executable)
@@ -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");
index 13ed7be8e2a6fef63f8eadf5fed15c4ce023e6ea..ebda332ffcee3cfcb9d82d96f526b0d9d618e8fc 100644 (file)
@@ -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;
+                       }
                </style>
        </head>
        <body>
@@ -102,9 +105,14 @@ $res->addHeader("Link", "<".dirname((new http\Env\Url)->path)."concise/css/conci
                </div>
                <div class="container">
 
-                       <?php if (!empty($package)) : $versions = package_versions($package); ?>
+                       <?php if (!empty($package)) : $versions = package_versions($package); $info = package_info($package); ?>
 
                        <h2><?= htmlspecialchars($package) ?></h2>
+                       <?php if ($info) : ?>
+                               <h3><?= htmlspecialchars($info["title"]) ?><br>
+                                       <small>License: <?= htmlspecialchars($info["license"]) ?></small></h3>
+                               <p class="package-description"><?= htmlspecialchars($info["description"]) ?></p>
+                       <?php endif; ?>
                        <table class="table table-full versions">
                                <thead>
                                        <tr>
index c1679805116d98cbe270fd0deac31b8c5a02df2d..72a97f62542632c2f024f43c8c2999339859cbfb 100644 (file)
@@ -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);