From: Aaron Schulz Date: Tue, 29 Apr 2008 12:05:25 +0000 (+0000) Subject: update insert X-Git-Tag: 1.31.0-rc.0~48015 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=81f2c610022a4e451e226811f8a98a81e7ef2e76;p=lhc%2Fweb%2Fwiklou.git update insert --- diff --git a/includes/Profiler.php b/includes/Profiler.php index 86b4f45720..6ac42c6687 100644 --- a/includes/Profiler.php +++ b/includes/Profiler.php @@ -300,7 +300,7 @@ class Profiler { /** * @static */ - function logToDB($name, $timeSum, $eventCount, $memory) { + function logToDB($name, $timeSum, $eventCount, $memorySum) { # Do not log anything if database is readonly (bug 5375) if( wfReadOnly() ) { return; } @@ -322,15 +322,20 @@ class Profiler { } else { $pfhost = ''; } + + // Kludge + $timeSum = ($timeSum >= 0) ? $timeSum : 0; + $memorySum = ($memorySum >= 0) ? $memorySum : 0; - $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, pf_time=pf_time+{$timeSum}, pf_memory=pf_memory+{$memory} ". + $sql = "UPDATE $profiling SET pf_count=pf_count+{$eventCount}, pf_time=pf_time+{$timeSum}, pf_memory=pf_memory+{$memorySum} ". "WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'"; $dbw->query($sql); $rc = $dbw->affectedRows(); if ($rc == 0) { $dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount, - 'pf_time' => $timeSum, 'pf_server' => $pfhost ), $fname, array ('IGNORE')); + 'pf_time' => $timeSum, 'pf_memory' => $memorySum, 'pf_server' => $pfhost ), + $fname, array ('IGNORE')); } // When we upgrade to mysql 4.1, the insert+update // can be merged into just a insert with this construct added: