Added timer capabilities to the profiler, refactored a bunch of the sanity checks associated with the profiler.

This commit is contained in:
Josh Sherman 2010-10-22 22:26:45 -04:00
parent 92e4b0391a
commit 9a4fe84b9b
4 changed files with 145 additions and 27 deletions

View file

@ -115,11 +115,26 @@ class Config extends Object
}
// Defaults profiler to true if it doesn't match an option exactly
if (isset($this->data['pickles']['profiler'])
&& $this->data['pickles']['profiler'] != ''
&& !in_array($this->data['pickles']['profiler'], array('objects', 'module', 'queries', 'explains', 'display')))
if (isset($this->data['pickles']['profiler']))
{
$this->data['pickles']['profiler'] = true;
if ($this->data['pickles']['profiler'] !== true)
{
// If we have an array convert to a string
if (is_array($this->data['pickles']['profiler']))
{
$this->data['pickles']['profiler'] = implode(',', $this->data['pickles']['profiler']);
}
// Checks that one of our known values exists, if not, force true
if (preg_match('/(objects|timers|queries|explains)/', $this->data['pickles']['profiler'] == false))
{
$this->data['pickles']['profiler'] = true;
}
}
}
else
{
$this->data['pickles']['profiler'] = false;
}
return true;