mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
fixed up execution time output in debug console
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,6 +1,6 @@
|
||||
- added support for hidden config variables that cannot be read by
|
||||
templates. (Andrei)
|
||||
- added execution time to DEBUG console. (Monte)
|
||||
- added execution time to DEBUG console, total and inserts. (Monte)
|
||||
- fixed bug where DEBUG console would not appear with cached content. (Monte)
|
||||
- added support for postfilter functions that are applied to compiled
|
||||
template right after compilation. (Andrei)
|
||||
|
@@ -27,7 +27,7 @@
|
||||
*
|
||||
* Or, write to:
|
||||
* Monte Ohrt
|
||||
* CTO, ispi
|
||||
* Directory of Technology, ispi
|
||||
* 237 S. 70th suite 220
|
||||
* Lincoln, NE 68510
|
||||
*
|
||||
@@ -682,16 +682,19 @@ function smarty_func_counter() {
|
||||
function smarty_func_assign_debug_info($args, &$smarty_obj) {
|
||||
$assigned_vars = $smarty_obj->_tpl_vars;
|
||||
ksort($assigned_vars);
|
||||
if(is_array($smarty_obj->_config[0])) {
|
||||
$config_vars = $smarty_obj->_config[0];
|
||||
ksort($config_vars);
|
||||
$smarty_obj->assign("_debug_config_keys",array_keys($config_vars));
|
||||
$smarty_obj->assign("_debug_config_vals",array_values($config_vars));
|
||||
}
|
||||
|
||||
$included_templates = $smarty_obj->_included_tpls;
|
||||
|
||||
$smarty_obj->assign("_debug_keys",array_keys($assigned_vars));
|
||||
$smarty_obj->assign("_debug_vals",array_values($assigned_vars));
|
||||
$smarty_obj->assign("_debug_config_keys",array_keys($config_vars));
|
||||
$smarty_obj->assign("_debug_config_vals",array_values($config_vars));
|
||||
$smarty_obj->assign("_debug_times_keys",array_keys($smarty_obj->_smarty_debug_times));
|
||||
$smarty_obj->assign("_debug_times_vals",array_values($smarty_obj->_smarty_debug_times));
|
||||
$smarty_obj->assign("_debug_times_keys",$smarty_obj->_smarty_debug_times['var']);
|
||||
$smarty_obj->assign("_debug_times_vals",$smarty_obj->_smarty_debug_times['val']);
|
||||
|
||||
$smarty_obj->assign("_debug_tpls",$included_templates);
|
||||
return true;
|
||||
|
@@ -530,7 +530,8 @@ class Smarty
|
||||
if ($this->debugging)
|
||||
{
|
||||
// capture time for debugging info
|
||||
$this->_smarty_debug_times["total"] = $this->_get_microtime() - $debug_start_time;
|
||||
$this->_smarty_debug_times['var'][] = 'TOTAL';
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
|
||||
echo $this->_generate_debug_output();
|
||||
}
|
||||
@@ -604,7 +605,8 @@ class Smarty
|
||||
if ($this->debugging)
|
||||
{
|
||||
// capture time for debugging info
|
||||
$this->_smarty_debug_times["TOTAL"] = $this->_get_microtime() - $debug_start_time;
|
||||
$this->_smarty_debug_times['var'][] = 'TOTAL';
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
|
||||
echo $this->_generate_debug_output();
|
||||
}
|
||||
@@ -943,10 +945,12 @@ function _generate_debug_output() {
|
||||
$replace = $function_name($args, $this);
|
||||
|
||||
$results = str_replace($cached_inserts[$i], $replace, $results);
|
||||
if ($this->debugging) {
|
||||
$this->_smarty_debug_times['var'][] = 'insert_'.$name;
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->debugging)
|
||||
{ $this->_smarty_debug_times["insert_".$name] = $this->_get_microtime() - $debug_start_time; }
|
||||
|
||||
return $results;
|
||||
}
|
||||
@@ -967,8 +971,10 @@ function _run_insert_handler($args)
|
||||
} else {
|
||||
$function_name = 'insert_'.$args['name'];
|
||||
$content = $function_name($args, $this);
|
||||
if ($this->debugging)
|
||||
{ $this->_smarty_debug_times["insert_".$args['name']] = $this->_get_microtime() - $debug_start_time; }
|
||||
if ($this->debugging) {
|
||||
$this->_smarty_debug_times['var'][] = 'insert_'.$args['name'];
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* Or, write to:
|
||||
* Monte Ohrt
|
||||
* CTO, ispi
|
||||
* Director of Technology, ispi
|
||||
* 237 S. 70th suite 220
|
||||
* Lincoln, NE 68510
|
||||
*
|
||||
|
@@ -530,7 +530,8 @@ class Smarty
|
||||
if ($this->debugging)
|
||||
{
|
||||
// capture time for debugging info
|
||||
$this->_smarty_debug_times["total"] = $this->_get_microtime() - $debug_start_time;
|
||||
$this->_smarty_debug_times['var'][] = 'TOTAL';
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
|
||||
echo $this->_generate_debug_output();
|
||||
}
|
||||
@@ -604,7 +605,8 @@ class Smarty
|
||||
if ($this->debugging)
|
||||
{
|
||||
// capture time for debugging info
|
||||
$this->_smarty_debug_times["TOTAL"] = $this->_get_microtime() - $debug_start_time;
|
||||
$this->_smarty_debug_times['var'][] = 'TOTAL';
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
|
||||
echo $this->_generate_debug_output();
|
||||
}
|
||||
@@ -943,10 +945,12 @@ function _generate_debug_output() {
|
||||
$replace = $function_name($args, $this);
|
||||
|
||||
$results = str_replace($cached_inserts[$i], $replace, $results);
|
||||
if ($this->debugging) {
|
||||
$this->_smarty_debug_times['var'][] = 'insert_'.$name;
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->debugging)
|
||||
{ $this->_smarty_debug_times["insert_".$name] = $this->_get_microtime() - $debug_start_time; }
|
||||
|
||||
return $results;
|
||||
}
|
||||
@@ -967,8 +971,10 @@ function _run_insert_handler($args)
|
||||
} else {
|
||||
$function_name = 'insert_'.$args['name'];
|
||||
$content = $function_name($args, $this);
|
||||
if ($this->debugging)
|
||||
{ $this->_smarty_debug_times["insert_".$args['name']] = $this->_get_microtime() - $debug_start_time; }
|
||||
if ($this->debugging) {
|
||||
$this->_smarty_debug_times['var'][] = 'insert_'.$args['name'];
|
||||
$this->_smarty_debug_times['val'][] = $this->_get_microtime() - $debug_start_time;
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* Or, write to:
|
||||
* Monte Ohrt
|
||||
* CTO, ispi
|
||||
* Director of Technology, ispi
|
||||
* 237 S. 70th suite 220
|
||||
* Lincoln, NE 68510
|
||||
*
|
||||
|
Reference in New Issue
Block a user