<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
+ padding-bottom: 4em;
+ padding-top: 10em;
}
.header {
- background: rgba(0,128,196,0.5);
+ top: 0;
+ width: 100%;
+ }
+ .footer {
+ bottom: 0;
+ width: 100%;
+ text-align: center;
+ }
+ .header, .footer {
+ position: fixed;
+ box-shadow: 0px 0px 1em .4em #89a;
+ background: #62B3E7;
padding: 1em 0;
}
.header h1 {
font-weight: bold;
}
- .header h1 a {
+ .header h1 a, .footer a:hover {
text-decoration: none;
}
+ .header h1 a:hover {
+ text-decoration: underline;
+ }
.header h1 big {
+ /* normalize browser difference */
+ font-size: 1.8em;
+ }
+ .header h1 big, .footer, .footer a {
color: #fdfdfd;
text-shadow: grey 0 0 .1em;
}
<a href="?"><big>Replicator</big></a><br>
<small>Replicating PECL releases as pharext packages since 2015</small>
</h1>
+ <a href="https://github.com/m6w6/replicator"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
</header>
</div>
<div class="container">
- <?php $packages = array_map("basename", glob("phars/*")); ?>
+ <?php
+
+ $packages = array_map("basename", glob("phars/*", GLOB_NOSORT|GLOB_ONLYDIR));
+ sort($packages, SORT_NATURAL|SORT_FLAG_CASE);
+
+ ?>
<?php if ($_SERVER["QUERY_STRING"] && in_array($_SERVER["QUERY_STRING"], $packages, true)) : ?>
<table class="table table-full">
<thead>
<tr>
- <th class="text-left">Package</th>
+ <th class="text-left" colspan="4">Package</th>
<th class="text-left">Date</th>
- <th class="text-right">Size</th>
+ <th class="text-right">Pharext</th>
</tr>
</thead>
<tbody>
- <?php foreach (array_reverse(glob("phars/$package/*.ext.phar*")) as $phar) : ?>
+
+ <?php
+
+ $versions = [];
+ foreach (glob("phars/$package/*.ext.phar*") as $phar) {
+ list($name, $enc) = explode(".ext.phar", basename($phar));
+ $data = new Phar($phar);
+ $meta = $data->getMetadata();
+ if ($meta) {
+ $release = $meta["release"];
+ } else {
+ $release = substr($name, strlen($package)+1);
+ }
+ $versions[$release][$enc] = [$phar, $meta];
+ uksort($versions[$release], function($a, $b) {
+ $al = strlen($a);
+ $bl = strlen($b);
+ if ($al < $bl) return -1;
+ if ($al > $bl) return 1;
+ return 0;
+ });
+ }
+ uksort($versions, "version_compare");
+
+ ?>
+ <?php foreach (array_reverse($versions) as $version => $phars) : ?>
+
<tr>
- <td class="text-left"><a href="<?= htmlspecialchars($phar) ?>"
- ><?= htmlspecialchars(basename($phar)) ?></a>
+ <td class="text-left">
+ <?= htmlspecialchars($package) ?>
+ <?= htmlspecialchars($version) ?>
+ </td>
+
+ <?php foreach ($phars as $ext => list($phar, $meta)) : ?>
+ <td class="text-left">
+ <a href="<?= htmlspecialchars($phar) ?>"
+ >ext.phar<?= htmlspecialchars($ext) ?></a><br>
+ <small><?php
+
+ $u = ["Bytes", "KB", "MB"];
+ $s = filesize($phar);
+ $l = floor(log10($s));
+ printf("⤋ %1.1F %s", $s/pow(10,$l-($l%3)), $u[$l/3]);
+
+ ?></small>
</td>
+ <?php endforeach; ?>
+ <?php for($i = 0; $i < 3-count($phars); ++$i) : ?>
+
+ <td></td>
+ <?php endfor; ?>
+
<td class="text-left">
<?php
} while (false);
?>
+
</td>
<td class="text-right">
<?php
-
- $u = ["Bytes", "KB", "MB"];
- $s = filesize($phar);
- $l = floor(log10($s));
- printf("%1.1F %s\n", $s/pow(10,$l-($l%3)), $u[$l/3]);
-
+ if ($meta) {
+ printf("v%s\n", $meta["version"]);
+ } else {
+ print "v2.0.1\n";
+ }
?>
</td>
</tr>
<?php endforeach; ?>
+
</tbody>
</table>
<?php else: ?>
</ul>
<?php endif; ?>
-
+ </div>
+ <div class="footer">
+ <footer>
+ © 2015 m6w6, Michael Wallner — Powered by <a href="//github.com/m6w6/pharext">pharext
+ <?php
+ require_once "../vendor/autoload.php";
+ printf("v%s\n", pharext\Metadata::version());
+ ?>
+ </a>
+ </footer>
</div>
</body>
</html>