From 8af016645fee5c0b22e69d46de9b3401c1bc82d3 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 17 Apr 2018 09:36:08 +0200 Subject: lib/ new --- lib/mysql.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/mysql.php (limited to 'lib/mysql.php') diff --git a/lib/mysql.php b/lib/mysql.php new file mode 100644 index 0000000..a5edbd5 --- /dev/null +++ b/lib/mysql.php @@ -0,0 +1,26 @@ + connect_error ) { + die_500( "Connection failed: " . $mysql -> connect_error ); +} + +function mysql_run_query($query) { + global $mysql; + if ( ! $result = $mysql -> query($query) ) + die_500( "Query failed: " . $mysql -> error ); + return $result; +} +function show_warning_on_offline_slave() { + $result = mysql_run_query("SHOW STATUS LIKE \"Slave_running\""); + if (($result -> num_rows == 0) || + ($result -> fetch_assoc() ["Value"] != "ON")) { + print "
The replication slave is currently not running. The database might be outdated.
"; + } +} -- cgit v1.2.3-70-g09d2