From: Aaron Schulz Date: Thu, 24 Nov 2011 19:55:38 +0000 (+0000) Subject: Added Database::getServerUptime() function to return seconds of uptime X-Git-Tag: 1.31.0-rc.0~26303 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=bd07cf97f54ede6fba53ac593205415afd641c4b;p=lhc%2Fweb%2Fwiklou.git Added Database::getServerUptime() function to return seconds of uptime --- 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 *