Add SSL and availability condition in /servers/surprise (#15)

This commit is contained in:
Hypolite Petovan 2019-02-03 09:36:53 -05:00
parent d0102327c0
commit 1bbe4d3289

View file

@ -27,7 +27,13 @@ class Surprise
{
$redirectUrl = '';
$sql = 'SELECT base_url FROM server WHERE reg_policy = "REGISTER_OPEN" AND health_score > 75 ORDER BY health_score DESC, RAND()';
$sql = 'SELECT `base_url`, server.*
FROM `server`
WHERE `reg_policy` = "REGISTER_OPEN"
AND `health_score` > 75
AND `ssl_state`
AND `available`
ORDER BY `health_score` DESC, RAND()';
$server = $this->atlas->fetchOne($sql);
if ($server) {