Skip to content

Commit

Permalink
Merge pull request #4 from mariano/i3
Browse files Browse the repository at this point in the history
Fixing issue where Data::append is not really appending. Fixes #3
  • Loading branch information
tmaiaroto committed Jan 10, 2012
2 parents a306cbe + cafcf42 commit 8d23a27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions extensions/util/Data.php
Expand Up @@ -7,13 +7,13 @@
namespace li3_perf\extensions\util;

class Data extends \lithium\core\StaticObject {

static $data = array(
'view_vars' => array(),
'queries' => array(),
'timers' => array()
);

/**
* Sets data.
*/
Expand All @@ -24,23 +24,23 @@ static public function set($key=null, $value=null) {
}
return false;
}

/**
* Appends data.
*/
static public function append($key=null, $value=null) {
if(!empty($key)) {
static::$data[$key] += $value;
static::$data[$key] = array_merge(static::$data[$key], $value);
return true;
}
return false;
}

/**
* Gets data.
*/
static public function get($key=null) {
return (isset(static::$data[$key])) ? static::$data[$key]:false;
}
}
?>
?>
4 changes: 3 additions & 1 deletion views/elements/queries.html.php
Expand Up @@ -2,7 +2,9 @@
$total_queries = count($queries);
$total_query_time = 0;
foreach($queries as $query) {
$total_query_time += $query['explain']['millis'];
$total_query_time += !empty($query['explain']['millis']) ?
$query['explain']['millis'] :
0;
}
?>
<h2>Queries</h2>
Expand Down

0 comments on commit 8d23a27

Please sign in to comment.