From 0688ac9ad88a03f1c56cfcd9e3c475b83301344d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 20 Apr 2012 10:25:04 -0400 Subject: Start comment cleanup of libraries --- system/libraries/Profiler.php | 44 ++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 6320ab50d..1e86f3c61 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -42,23 +42,45 @@ */ class CI_Profiler { + /** + * List of profiler sections available to show + * + * @var array + */ protected $_available_sections = array( - 'benchmarks', - 'get', - 'memory_usage', - 'post', - 'uri_string', - 'controller_info', - 'queries', - 'http_headers', - 'session_data', - 'config' - ); + 'benchmarks', + 'get', + 'memory_usage', + 'post', + 'uri_string', + 'controller_info', + 'queries', + 'http_headers', + 'session_data', + 'config' + ); + /** + * Number of queries to show before making the additional queries togglable + * + * @var int + */ protected $_query_toggle_count = 25; + /** + * Reference to the CodeIgniter singleton + * + * @var object + */ protected $CI; + /** + * Constructor + * + * Initialize Profiler + * + * @param array $config + */ public function __construct($config = array()) { $this->CI =& get_instance(); -- cgit v1.2.3-24-g4f1b From 5645479c622eb36cf9869797896dc0921568c4a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:32:19 +0300 Subject: Clean up the libraries --- system/libraries/Profiler.php | 1 + 1 file changed, 1 insertion(+) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 1e86f3c61..e219d20f2 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -527,6 +527,7 @@ class CI_Profiler { return $output.''; } + } /* End of file Profiler.php */ -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Profiler.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index e219d20f2..aaac0c518 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -219,7 +219,7 @@ class CI_Profiler { $show_hide_js = '('.$this->CI->lang->line('profiler_section_hide').')'; - if ($hide_queries != '') + if ($hide_queries !== '') { $show_hide_js = '('.$this->CI->lang->line('profiler_section_show').')'; } @@ -315,7 +315,7 @@ class CI_Profiler { ."\n" .'  '.$this->CI->lang->line('profiler_post_data')."  \n"; - if (count($_POST) == 0) + if (count($_POST) === 0) { $output .= '
'.$this->CI->lang->line('profiler_no_post').'
'; } @@ -365,7 +365,7 @@ class CI_Profiler { ."\n" .'  '.$this->CI->lang->line('profiler_uri_string')."  \n" .'
' - .($this->CI->uri->uri_string == '' ? $this->CI->lang->line('profiler_no_uri') : $this->CI->uri->uri_string) + .($this->CI->uri->uri_string === '' ? $this->CI->lang->line('profiler_no_uri') : $this->CI->uri->uri_string) .'
'; } @@ -402,7 +402,7 @@ class CI_Profiler { ."\n" .'  '.$this->CI->lang->line('profiler_memory_usage')."  \n" .'
' - .((function_exists('memory_get_usage') && ($usage = memory_get_usage()) != '') ? number_format($usage).' bytes' : $this->CI->lang->line('profiler_no_memory')) + .((function_exists('memory_get_usage') && ($usage = memory_get_usage()) !== '') ? number_format($usage).' bytes' : $this->CI->lang->line('profiler_no_memory')) .'
'; } -- cgit v1.2.3-24-g4f1b From c839d28f4230dce0c658338f267b821cc16490a2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 14:35:27 +0300 Subject: Remove some unnecessary function_exists() checks and some minor improvements --- system/libraries/Profiler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index aaac0c518..d96088c14 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -402,7 +402,7 @@ class CI_Profiler { ."\n" .'  '.$this->CI->lang->line('profiler_memory_usage')."  \n" .'
' - .((function_exists('memory_get_usage') && ($usage = memory_get_usage()) !== '') ? number_format($usage).' bytes' : $this->CI->lang->line('profiler_no_memory')) + .(($usage = memory_get_usage()) != '' ? number_format($usage).' bytes' : $this->CI->lang->line('profiler_no_memory')) .'
'; } -- cgit v1.2.3-24-g4f1b From 0140ddd510edffb901b98de6b80676ece183760c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 16 Jun 2012 01:12:56 +0300 Subject: Fix issue #318 + added a default to the switch() in CI_Output::minify() --- system/libraries/Profiler.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index d96088c14..1e961f6df 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -116,6 +116,12 @@ class CI_Profiler { */ public function set_sections($config) { + if (isset($config['query_toggle_count'])) + { + $this->_query_toggle_count = (int) $config['query_toggle_count']; + unset($config['query_toggle_count']); + } + foreach ($config as $method => $enable) { if (in_array($method, $this->_available_sections)) -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/libraries/Profiler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 1e961f6df..7d7069b95 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -1,4 +1,4 @@ - Date: Tue, 6 Nov 2012 13:31:21 +0200 Subject: Display DB object names in the Profiler and fix issue #1220 --- system/libraries/Profiler.php | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 7d7069b95..1c97e3481 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -75,12 +75,14 @@ class CI_Profiler { */ protected $CI; + // -------------------------------------------------------------------- + /** - * Constructor + * Class constructor * * Initialize Profiler * - * @param array $config + * @param array $config Parameters */ public function __construct($config = array()) { @@ -112,7 +114,7 @@ class CI_Profiler { * * Sets the private _compile_* properties to enable/disable Profiler sections * - * @param mixed + * @param mixed $config * @return void */ public function set_sections($config) @@ -191,11 +193,24 @@ class CI_Profiler { $dbs = array(); // Let's determine which databases are currently connected to - foreach (get_object_vars($this->CI) as $CI_object) + foreach (get_object_vars($this->CI) as $name => $cobject) { - if (is_object($CI_object) && is_subclass_of(get_class($CI_object), 'CI_DB')) + if (is_object($cobject)) { - $dbs[] = $CI_object; + if ($cobject instanceof CI_DB) + { + $dbs[get_class($this->CI).':$'.$name] = $cobject; + } + elseif ($cobject instanceof CI_Model) + { + foreach (get_object_vars($cobject) as $mname => $mobject) + { + if ($mobject instanceof CI_DB) + { + $dbs[get_class($cobject).':$'.$mname] = $mobject; + } + } + } } } @@ -220,7 +235,7 @@ class CI_Profiler { $output = "\n\n"; $count = 0; - foreach ($dbs as $db) + foreach ($dbs as $name => $db) { $hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : ''; @@ -234,7 +249,7 @@ class CI_Profiler { $output .= '
' ."\n" .'  '.$this->CI->lang->line('profiler_database') - .':  '.$db->database.'   '.$this->CI->lang->line('profiler_queries') + .':  '.$db->database.' ('.$name.')   '.$this->CI->lang->line('profiler_queries') .': '.count($db->queries).'  '.$show_hide_js."\n\n\n" .'\n"; -- cgit v1.2.3-24-g4f1b