From a9f7500663694f8c82f06d88571ffe4209a94184 Mon Sep 17 00:00:00 2001 From: Oliver Hader <oliver.hader@typo3.org> Date: Thu, 4 Jun 2009 11:45:57 +0000 Subject: [PATCH] Cleanup: Cleanup iterations in t3lib_timeTrack->printTSlog() git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5554 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + t3lib/class.t3lib_timetrack.php | 21 ++++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 267ca6051384..880ab7a937f6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2009-06-04 Oliver Hader <oliver@typo3.org> * Fixed bug #11257: t3lib_cache_backend_dbbackend->collectGarbage() deletes entries without lifetime (thanks to Fabrizio Branca) + * Cleanup: Cleanup iterations in t3lib_timeTrack->printTSlog() 2009-06-03 Benjamin Mack <benni@typo3.org> diff --git a/t3lib/class.t3lib_timetrack.php b/t3lib/class.t3lib_timetrack.php index a5904e0e2c6a..53b332972deb 100644 --- a/t3lib/class.t3lib_timetrack.php +++ b/t3lib/class.t3lib_timetrack.php @@ -304,27 +304,22 @@ class t3lib_timeTrack { */ function printTSlog() { // Calculate times and keys for the tsStackLog - $preEndtime = 0; - foreach($this->tsStackLog as $uniqueId=>$data) { - $this->tsStackLog[$uniqueId]['endtime'] = $this->convertMicrotime($this->tsStackLog[$uniqueId]['endtime'])-$this->starttime; - $this->tsStackLog[$uniqueId]['starttime'] = $this->convertMicrotime($this->tsStackLog[$uniqueId]['starttime'])-$this->starttime; - $this->tsStackLog[$uniqueId]['deltatime'] = $this->tsStackLog[$uniqueId]['endtime']-$this->tsStackLog[$uniqueId]['starttime']; - $this->tsStackLog[$uniqueId]['key'] = implode($this->tsStackLog[$uniqueId]['stackPointer']?'.':'/', end($data['tsStack'])); - $preEndtime = $this->tsStackLog[$uniqueId]['endtime']; + foreach ($this->tsStackLog as $uniqueId => &$data) { + $data['endtime'] = $this->convertMicrotime($data['endtime']) - $this->starttime; + $data['starttime'] = $this->convertMicrotime($data['starttime']) - $this->starttime; + $data['deltatime'] = $data['endtime'] - $data['starttime']; + $data['key'] = implode($data['stackPointer'] ? '.' : '/', end($data['tsStack'])); } // Create hierarchical array of keys pointing to the stack $arr = array(); - reset($this->tsStackLog); - while(list($uniqueId,$data)=each($this->tsStackLog)) { - $this->createHierarchyArray($arr,$data['level'], $uniqueId); + foreach ($this->tsStackLog as $uniqueId => $data) { + $this->createHierarchyArray($arr, $data['level'], $uniqueId); } // Parsing the registeret content and create icon-html for the tree $this->tsStackLog[$arr['0.'][0]]['content'] = $this->fixContent($arr['0.']['0.'], $this->tsStackLog[$arr['0.'][0]]['content'], '', 0, $arr['0.'][0]); // Displaying the tree: - reset($this->tsStackLog); - $outputArr = array(); $outputArr[] = $this->fw('TypoScript Key'); $outputArr[] = $this->fw('Value'); @@ -357,7 +352,7 @@ class t3lib_timeTrack { $highlight_col = $this->printConf['highlight_col']; $c=0; - while(list($uniqueId,$data)=each($this->tsStackLog)) { + foreach ($this->tsStackLog as $uniqueId => $data) { $bgColor = ' background-color:'.($c%2 ? t3lib_div::modifyHTMLColor($col,$factor,$factor,$factor) : $col).';'; if ($this->highlightLongerThan && intval($data['owntime']) > intval($this->highlightLongerThan)) { $bgColor = ' background-color:'.$highlight_col.';'; -- GitLab