Add support for RC version (#19)

This commit is contained in:
Hypolite Petovan 2018-12-19 04:09:23 -05:00
parent 503c134df6
commit d33fb62e35
6 changed files with 16 additions and 8 deletions

View file

@ -56,6 +56,8 @@ class Servers extends BaseController
$this->simplecache->set('dev_version', $dev_version);
}
$rc_version = str_replace('-dev', '-rc', $dev_version);
$pager = new Pager($this->l10n, $request, 20);
$stmt = 'SELECT *
@ -89,6 +91,7 @@ AND NOT `hidden`';
'servers' => $servers,
'pager' => $pager->renderFull($count),
'stable_version' => $stable_version,
'rc_version' => $rc_version,
'dev_version' => $dev_version,
];

View file

@ -65,6 +65,8 @@ class Statistics extends BaseController
$this->simplecache->set('dev_version', $dev_version);
}
$rc_version = str_replace('-dev', '-rc', $dev_version);
$serverPollQueueCount = $this->connection->fetchValue('SELECT COUNT(*) FROM `server_poll_queue`');
$serverCounts = $this->connection->fetchOne(
@ -74,11 +76,11 @@ class Statistics extends BaseController
SUM(CASE WHEN `available` AND `language` IS NOT NULL THEN 1 ELSE 0 END) AS `language`,
SUM(CASE WHEN `available` AND `reg_policy` = "REGISTER_OPEN" THEN 1 ELSE 0 END) AS `open`,
SUM(CASE WHEN `available` AND `version` IS NOT NULL THEN 1 ELSE 0 END) AS `version`,
SUM(CASE WHEN `available` AND `version` = :dev_version THEN 1 ELSE 0 END) AS `dev_version`,
SUM(CASE WHEN `available` AND (`version` = :dev_version OR `version` = :rc_version) THEN 1 ELSE 0 END) AS `dev_version`,
SUM(CASE WHEN `available` AND `version` = :stable_version THEN 1 ELSE 0 END) AS `stable_version`,
SUM(CASE WHEN `available` AND `version` != :dev_version AND `version` != :stable_version THEN 1 ELSE 0 END) AS `outdated_version`
SUM(CASE WHEN `available` AND `version` != :dev_version AND `version` != :stable_version AND `version` != :rc_version THEN 1 ELSE 0 END) AS `outdated_version`
FROM `server`
WHERE NOT `hidden`', ['dev_version' => $dev_version, 'stable_version' => $stable_version]);
WHERE NOT `hidden`', ['dev_version' => $dev_version, 'rc_version' => $rc_version, 'stable_version' => $stable_version]);
$stmt = 'SELECT LEFT(`language`, 2) AS `language`, COUNT(*) AS `total`, COUNT(*) / :total AS `ratio`
FROM `server`
@ -145,6 +147,7 @@ class Statistics extends BaseController
],
],
'dev_version' => $dev_version,
'rc_version' => $rc_version,
'stable_version' => $stable_version,
];

View file

@ -365,8 +365,10 @@ class Server
$this->simplecache->set('dev_version', $dev_version);
}
if ($version == $dev_version) {
$max_health = 95; //Develop can be unstable
$rc_version = str_replace('-dev', '-rc', $dev_version);
if ($version == $dev_version || $version == $rc_version) {
$max_health = 95; //Develop/RC can be unstable
} elseif ($version !== $stable_version) {
$delta = min($delta, 0) - 10; // Losing score as time passes if node isn't updated
}

View file

@ -5,7 +5,7 @@
<div class="row">
<?php foreach ($servers as $server) : ?>
<div class="col-xl-6">
<?php echo $this->fetch('sub/server.phtml', ['server' => $server, 'stable_version' => $stable_version, 'dev_version' => $dev_version]) ?>
<?php echo $this->fetch('sub/server.phtml', ['server' => $server, 'stable_version' => $stable_version, 'rc_version' => $rc_version, 'dev_version' => $dev_version]) ?>
</div>
<?php endforeach; ?>
</div>

View file

@ -62,7 +62,7 @@ use \Friendica\Directory\Utils\L10n;
(<?php echo L10n::formatNumber($version['ratio'], L10n::PERCENT)?>)
<?php if ($version['version'] == $stable_version):?>
<span class="badge badge-success"><i class="fa fa-smile"></i> <?php echo $this->__('Stable Version')?></span>
<?php elseif ($version['version'] == $dev_version):?>
<?php elseif ($version['version'] == $dev_version || $version['version'] == $rc_version):?>
<span class="badge badge-secondary"><i class="fa fa-poo"></i> <?php echo $this->__('Develop Version')?></span>
<?php endif;?>
</li>

View file

@ -13,7 +13,7 @@ if ($server['health_score'] <= 0) {
if ($server['version'] == $stable_version) {
$version_badge = '<span class="badge badge-success"><i class="fa fa-smile"></i> ' . $this->__('Stable Version') . '</span>';
} elseif ($server['version'] == $dev_version) {
} elseif ($server['version'] == $dev_version || $server['version'] == $rc_version) {
$version_badge = '<span class="badge badge-secondary"><i class="fa fa-poo"></i> ' . $this->__('Develop Version') . '</span>';
} else {
$version_badge = '<span class="badge badge-warning"><i class="fa fa-frown"></i> ' . $this->__('Outdated Version') . '</span>';