* remove end of line whitespace
[lhc/web/wiklou.git] / includes / Profiler.php
index 8307690..b1f9b7a 100644 (file)
@@ -40,6 +40,7 @@ if (!function_exists('memory_get_usage')) {
 
 /**
  * @todo document
+ * @addtogroup Profiler
  */
 class Profiler {
        var $mStack = array (), $mWorkStack = array (), $mCollated = array ();
@@ -300,6 +301,9 @@ class Profiler {
         * @static
         */
        function logToDB($name, $timeSum, $eventCount) {
+               # Do not log anything if database is readonly (bug 5375)
+               if( wfReadOnly() ) { return; }
+
                # Warning: $wguname is a live patch, it should be moved to Setup.php
                global $wguname, $wgProfilePerHost;
 
@@ -312,7 +316,7 @@ class Profiler {
 
                $name = substr($name, 0, 255);
                $encname = $dbw->strencode($name);
-               
+
                if ($wgProfilePerHost) {
                        $pfhost = $wguname['nodename'];
                } else {
@@ -343,7 +347,7 @@ class Profiler {
                $elt = end($this->mWorkStack);
                return $elt[0];
        }
-       
+
        static function getCaller( $level ) {
                $backtrace = wfDebugBacktrace();
                if ( isset( $backtrace[$level] ) ) {
@@ -359,5 +363,3 @@ class Profiler {
        }
 
 }
-
-?>