Added Database::getServerUptime() function to return seconds of uptime
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 24 Nov 2011 19:55:38 +0000 (19:55 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 24 Nov 2011 19:55:38 +0000 (19:55 +0000)
includes/db/Database.php
includes/db/DatabaseMysql.php

index 70c7973..1f37c7d 100644 (file)
@@ -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
index dd8afd6..5cc2e83 100644 (file)
@@ -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
         *