X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fstats-functions.php;h=44256ff3dbb444876695c733154cf16ad56e0cfc;hp=baa0b130b1f0f24714685c12fa1bc650fba7308a;hb=3e2db2082694ee086a26408080dd9eee5f39b81a;hpb=258bb8c82f21617f7f90bff8023602a11b986f7e diff --git a/inc/stats-functions.php b/inc/stats-functions.php index baa0b130b1..44256ff3db 100644 --- a/inc/stats-functions.php +++ b/inc/stats-functions.php @@ -99,6 +99,9 @@ function setStatsEntry ($entry, $value) { // Loads stats table function loadStatsTable () { + // Check if the link is up + if (!SQL_IS_LINK_UP()) return false; + // Do we have it there for today? if (!isStatsTableCreated()) { // Then create a default one @@ -120,6 +123,9 @@ function loadStatsTable () { // Checks if the the statistics table is created function isStatsTableCreated () { + // Check if the link is up + if (!SQL_IS_LINK_UP()) return false; + // Ask for it $result = SQL_QUERY_ESC("SHOW TABLES LIKE '{?_MYSQL_PREFIX?}_stats_%s'", array(date('Ymd', time())), __FUNCTION__, __LINE__); @@ -130,6 +136,9 @@ function isStatsTableCreated () { // Create the dummy table function createStatsTable () { + // Check if the link is up + if (!SQL_IS_LINK_UP()) return false; + // Create it here $result = SQL_QUERY_ESC("CREATE TABLE IF NOT EXISTS `{?_MYSQL_PREFIX?}_stats_%s` ( `stats_entry` VARCHAR(100) NOT NULL DEFAULT '', @@ -141,6 +150,9 @@ PRIMARY KEY (`stats_entry`) // Write all entries to the table function writeStatsTable () { + // Check if the link is up + if (!SQL_IS_LINK_UP()) return false; + // Empty the table first SQL_QUERY_ESC("TRUNCATE `{?_MYSQL_PREFIX?}_stats_%s`", array(date('Ymd', time())), __FUNCTION__, __LINE__);