Add unstable builds with a link to display them

parent 011ebf92
This diff is collapsed.
......@@ -27,6 +27,14 @@ function get_binary_files()
{
$files = [];
foreach (get_bintray_files_cache() ?? [] as $file) {
$stability = 'stable';
if (strpos($file->version, 'a') !== false) {
$stability = 'alpha';
} elseif (strpos($file->version, 'b') !== false) {
$stability = 'beta';
}
$file->stability = $stability;
$files[$file->name] = $file;
}
krsort($files, SORT_NATURAL);
......@@ -80,8 +88,14 @@ function get_dl_link($flavor, $version, $file = null)
// Fetch the clean list of binary files.
$files = get_binary_files();
// Get the latest version number, fallback to 1.1.10.
$stable = reset($files)->version ?? '1.1.10';
// Get the latest stable version number, fallback to 1.1.10.
$stable = '1.1.10';
foreach ($files as $file) {
if ($file->stability === 'stable') {
$stable = $file->version;
break;
}
}
// Save binary details of latest stable version to "binaries.json".
save_binaries_json($files, $stable);
......@@ -187,8 +201,8 @@ save_binaries_json($files, $stable);
Yes, but please use <a href="/binaries.json">this JSON representation</a> in stead of this website. Also, please note that excessive polling might get you banned.
</div>
<?php if ($files): ?>
<h2>Archive</h2>
<a href="?show-unstable">(show unstable builds)</a>
<div id="view" class="view-details view-size-20">
<ul id="items" class="clearfix">
<li class="header">
......@@ -196,18 +210,22 @@ save_binaries_json($files, $stable);
<a class="date descending"><span class="l10n-lastModified">Changed</span></a>
<a class="size"><span class="l10n-size">Size</span></a>
</li>
<?php foreach ($files as $f) : ?>
<li class="item file">
<a href="<?php echo get_dl_link(null, null, $f->name); ?>">
<span class="label" title="<?php echo $f->name ?>"><?php echo $f->name ?></span>
<span class="date" data-time="<?php echo $f->created ?>"><?php echo $f->created ?></span>
<span class="size" data-bytes="<?php echo $f->size ?>"><?php echo human_filesize($f->size); ?></span>
<?php foreach ($files as $file) : ?>
<?php
if ($file->stability !== 'stable' && !isset($_GET['show-unstable'])) {
continue;
}
?>
<li class="item file stability-<?php echo $file->stability; ?>">
<a href="<?php echo get_dl_link(null, null, $file->name); ?>">
<span class="label" title="<?php echo $file->name; ?>"><?php echo $file->name; ?></span>
<span class="date" data-time="<?php echo $file->created; ?>"><?php echo $file->created; ?></span>
<span class="size" data-bytes="<?php echo $file->size; ?>"><?php echo human_filesize($file->size); ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment