mirror of
https://github.com/processwire/processwire.git
synced 2025-08-11 01:04:16 +02:00
Fix issue processwire/processwire-issues#316 - legacy db API variable class and debug timers in PHP7 producing unnecessary notice
This commit is contained in:
@@ -104,7 +104,7 @@ class Database extends \mysqli implements WireDatabase {
|
|||||||
|
|
||||||
if($this->debug) {
|
if($this->debug) {
|
||||||
$timerKey = Debug::timer();
|
$timerKey = Debug::timer();
|
||||||
if(!$timerFirstStartTime) $timerFirstStartTime = $timerKey;
|
if(!$timerFirstStartTime) $timerFirstStartTime = (float) $timerKey;
|
||||||
} else $timerKey = null;
|
} else $timerKey = null;
|
||||||
|
|
||||||
$result = @parent::query($sql, $resultmode);
|
$result = @parent::query($sql, $resultmode);
|
||||||
@@ -113,9 +113,9 @@ class Database extends \mysqli implements WireDatabase {
|
|||||||
if($this->debug) {
|
if($this->debug) {
|
||||||
if(isset($result->num_rows)) $sql .= " [" . $result->num_rows . " rows]";
|
if(isset($result->num_rows)) $sql .= " [" . $result->num_rows . " rows]";
|
||||||
if(!is_null($timerKey)) {
|
if(!is_null($timerKey)) {
|
||||||
$elapsed = Debug::timer($timerKey);
|
$elapsed = (float) Debug::timer($timerKey);
|
||||||
$timerTotalQueryTime += $elapsed;
|
$timerTotalQueryTime += $elapsed;
|
||||||
$timerTotalSinceStart = Debug::timer() - $timerFirstStartTime;
|
$timerTotalSinceStart = ((float) Debug::timer()) - $timerFirstStartTime;
|
||||||
$sql .= " [{$elapsed}s, {$timerTotalQueryTime}s, {$timerTotalSinceStart}s]";
|
$sql .= " [{$elapsed}s, {$timerTotalQueryTime}s, {$timerTotalSinceStart}s]";
|
||||||
}
|
}
|
||||||
$this->queryLog($sql);
|
$this->queryLog($sql);
|
||||||
|
@@ -66,7 +66,7 @@ class Debug {
|
|||||||
$startTime = -microtime(true);
|
$startTime = -microtime(true);
|
||||||
if(!$key) {
|
if(!$key) {
|
||||||
$key = (string) $startTime;
|
$key = (string) $startTime;
|
||||||
while(isset(self::$timers[$key])) $key .= ".";
|
while(isset(self::$timers[$key])) $key .= "0";
|
||||||
}
|
}
|
||||||
self::$timers[(string) $key] = $startTime;
|
self::$timers[(string) $key] = $startTime;
|
||||||
$value = $key;
|
$value = $key;
|
||||||
|
Reference in New Issue
Block a user