From bd07cf97f54ede6fba53ac593205415afd641c4b Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 24 Nov 2011 19:55:38 +0000 Subject: [PATCH] Added Database::getServerUptime() function to return seconds of uptime --- includes/db/Database.php | 10 ++++++++++ includes/db/DatabaseMysql.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/includes/db/Database.php b/includes/db/Database.php index 70c7973865..1f37c7d47e 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2639,6 +2639,16 @@ abstract class DatabaseBase implements DatabaseType { return "REPLACE({$orig}, {$old}, {$new})"; } + /** + * Determines how long the server has been up + * STUB + * + * @return int + */ + function getServerUptime() { + return 0; + } + /** * Determines if the last failure was due to a deadlock * STUB diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index dd8afd683f..5cc2e83836 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -697,6 +697,16 @@ class DatabaseMysql extends DatabaseBase { return $this->query( $sql, $fname ); } + /** + * Determines how long the server has been up + * + * @return int + */ + function getServerUptime() { + $vars = $this->getMysqlStatus( 'Uptime' ); + return (int)$vars['Uptime']; + } + /** * Determines if the last failure was due to a deadlock * -- 2.20.1