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";
exit;
case 0:
work($url, $dir);
+ info($pgk, $dir);
exit;
default:
$pids[$pid] = compact("url", "pkg", "ver", "skp", "ext", "dir");
}
}
+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)) {
exit;
case 0:
work($url, $dir);
+ info($pkg, $dir);
exit;
default:
$pids[$pid] = compact("url", "pkg", "ver", "skp", "ext", "dir");
.old-version, #new-toggle {
display: none;
}
+ .package-description {
+ white-space: pre-line;
+ }
</style>
</head>
<body>
</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>
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);