summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-22 13:32:13 +0200
committerErich Eckner <git@eckner.net>2018-06-22 13:48:27 +0200
commit857d7d193c454ff18c4c15089bc465178415a5a8 (patch)
treef5ed8d15da3e0fcbb8438358c187affc33f0fb52
parentd581dfe75d5b4add6dad2af67588f44edae257b9 (diff)
downloadarchweb32-857d7d193c454ff18c4c15089bc465178415a5a8.tar.xz
lib/mysql.php: do not print warning if last ssh_log is less than a minute ago
-rw-r--r--lib/mysql.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/mysql.php b/lib/mysql.php
index 60bfa3a..6d575ad 100644
--- a/lib/mysql.php
+++ b/lib/mysql.php
@@ -20,9 +20,18 @@ function mysql_run_query($query) {
}
function show_warning_on_offline_slave() {
- $result = mysql_run_query("SHOW STATUS LIKE \"Slave_running\"");
+ $result = mysql_run_query(
+ "SHOW STATUS LIKE \"Slave_running\""
+ );
if (($result -> num_rows == 0) ||
($result -> fetch_assoc() ["Value"] != "ON")) {
- print "<div><font color=\"ff0000\">The replication slave is currently not running. The database might be outdated.</font></div>\n";
+ $result = mysql_run_query(
+ "SELECT 1 FROM `ssh_log`" .
+ " WHERE ADDTIME(`ssh_log`.`date`,\"1:00\")>NOW()" .
+ " LIMIT 1"
+ );
+ if ($result -> num_rows == 0) {
+ print "<div><font color=\"ff0000\">The replication slave is currently not running. The database might be outdated.</font></div>\n";
+ }
}
}