Commit 4f1e572f authored by David Morley's avatar David Morley Committed by GitHub

more time to try, go back to weightedscore (#106)

* more time to try, go back to weightedscore

* forgot one
parent 17e6d253
...@@ -16,7 +16,7 @@ require_once __DIR__ . '/../config.php'; ...@@ -16,7 +16,7 @@ require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error()); $dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT domain,email,token,tokenexpire,weight,podmin_statement FROM pods WHERE domain = $1'; $sql = 'SELECT domain,email,token,tokenexpire,weight,podmin_statement,podmin_notify FROM pods WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$_domain]); $result = pg_query_params($dbh, $sql, [$_domain]);
$result || die('Error in SQL query: ' . pg_last_error()); $result || die('Error in SQL query: ' . pg_last_error());
......
...@@ -55,15 +55,15 @@ while ($row = pg_fetch_assoc($result)) { ...@@ -55,15 +55,15 @@ while ($row = pg_fetch_assoc($result)) {
$chss = curl_init(); $chss = curl_init();
curl_setopt($chss, CURLOPT_URL, 'https://' . $domain . '/nodeinfo/1.0'); curl_setopt($chss, CURLOPT_URL, 'https://' . $domain . '/nodeinfo/1.0');
curl_setopt($chss, CURLOPT_CONNECTTIMEOUT, 9); curl_setopt($chss, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($chss, CURLOPT_TIMEOUT, 9); curl_setopt($chss, CURLOPT_TIMEOUT, 30);
curl_setopt($chss, CURLOPT_RETURNTRANSFER, 1); curl_setopt($chss, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($chss, CURLOPT_CERTINFO, 1); curl_setopt($chss, CURLOPT_CERTINFO, 1);
curl_setopt($chss, CURLOPT_CAINFO, $cafullpath); curl_setopt($chss, CURLOPT_CAINFO, $cafullpath);
$outputssl = curl_exec($chss); $outputssl = curl_exec($chss);
$outputsslerror = curl_error($chss); $outputsslerror = curl_error($chss);
$info = curl_getinfo($chss, CURLINFO_CERTINFO); $info = curl_getinfo($chss, CURLINFO_CERTINFO);
$latency = curl_getinfo($chss, CURLINFO_CONNECT_TIME); $latency = curl_getinfo($chss, CURLINFO_TOTAL_TIME);
$sslexpire = $info[0]['Expire date'] ?? null; $sslexpire = $info[0]['Expire date'] ?? null;
curl_close($chss); curl_close($chss);
...@@ -193,7 +193,8 @@ while ($row = pg_fetch_assoc($result)) { ...@@ -193,7 +193,8 @@ while ($row = pg_fetch_assoc($result)) {
} elseif ($score < 0) { } elseif ($score < 0) {
$score = 0; $score = 0;
} }
$weightedscore = ($uptime + $score + ($active_users_monthly / 19999) - ((10 - $weight) * .12)); $weightedscore = ($uptime + $score - (10 - $weight)) / 2;
_debug('Weighted Score', $weightedscore);
$timenow = date('Y-m-d H:i:s'); $timenow = date('Y-m-d H:i:s');
$sql_set = 'UPDATE pods SET secure = $2, hidden = $3, ip = $4, ipv6 = $5, monthsmonitored = $6, uptime_alltime = $7, status = $8, date_laststats = $9, date_updated = $10, latency = $11, score = $12, adminrating = $13, country = $14, city = $15, state = $16, lat = $17, long = $18, userrating = $19, shortversion = $20, masterversion = $21, signup = $22, total_users = $23, active_users_halfyear = $24, active_users_monthly = $25, local_posts = $26, name = $27, comment_counts = $28, service_facebook = $29, service_tumblr = $30, service_twitter = $31, service_wordpress = $32, weightedscore = $33, service_xmpp = $34, softwarename = $35, sslvalid = $36, dnssec = $37, sslexpire = $38 WHERE domain = $1'; $sql_set = 'UPDATE pods SET secure = $2, hidden = $3, ip = $4, ipv6 = $5, monthsmonitored = $6, uptime_alltime = $7, status = $8, date_laststats = $9, date_updated = $10, latency = $11, score = $12, adminrating = $13, country = $14, city = $15, state = $16, lat = $17, long = $18, userrating = $19, shortversion = $20, masterversion = $21, signup = $22, total_users = $23, active_users_halfyear = $24, active_users_monthly = $25, local_posts = $26, name = $27, comment_counts = $28, service_facebook = $29, service_tumblr = $30, service_twitter = $31, service_wordpress = $32, weightedscore = $33, service_xmpp = $34, softwarename = $35, sslvalid = $36, dnssec = $37, sslexpire = $38 WHERE domain = $1';
......
...@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? ''; ...@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error()); $dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,podmin_statement,score,signup,name,country,city,state,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden AND signup ORDER BY uptime_alltime DESC"; $sql = "SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,podmin_statement,score,signup,name,country,city,state,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden AND signup ORDER BY weightedscore DESC";
$result = pg_query($dbh, $sql); $result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error()); $result || die('Error in SQL query: ' . pg_last_error());
......
...@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? ''; ...@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error()); $dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT domain,dnssec,podmin_statement,sslexpire,masterversion,shortversion,softwarename,monthsmonitored,score,signup,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp,latency,date_updated,ipv6,total_users,local_posts,comment_counts,stats_apikey,userrating FROM pods pods ORDER BY uptime_alltime DESC'; $sql = 'SELECT domain,dnssec,podmin_statement,sslexpire,masterversion,shortversion,softwarename,monthsmonitored,score,signup,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp,latency,date_updated,ipv6,total_users,local_posts,comment_counts,stats_apikey,userrating FROM pods pods ORDER BY weightedscore DESC';
$result = pg_query($dbh, $sql); $result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error()); $result || die('Error in SQL query: ' . pg_last_error());
......
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