Same for $this->user
[lhc/web/wiklou.git] / includes / Profiler.php
index 8485edb..8e1cd14 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 ();
@@ -287,7 +288,7 @@ class Profiler {
         * @return Integer
         * @private
         */
-       function calltreeCount($stack, $start) {
+       function calltreeCount($stack, $start) {
                $level = $stack[$start][1];
                $count = 0;
                for ($i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i --) {
@@ -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;
 
@@ -360,4 +364,4 @@ class Profiler {
 
 }
 
-?>
+