Browse Source

Add debug info for instances $context['debug']['instances']

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
75f73e8790
3 changed files with 8 additions and 0 deletions
  1. 1 0
      Sources/Logging.php
  2. 6 0
      Sources/Subs.php
  3. 1 0
      Themes/default/languages/index.english.php

+ 1 - 0
Sources/Logging.php

@@ -248,6 +248,7 @@ function displayDebug()
 	', $txt['debug_language_files'], count($context['debug']['language_files']), ': <em>', implode('</em>, <em>', $context['debug']['language_files']), '</em>.<br />
 	', $txt['debug_stylesheets'], count($context['debug']['sheets']), ': <em>', implode('</em>, <em>', $context['debug']['sheets']), '</em>.<br />
 	', $txt['debug_hooks'], empty($context['debug']['hooks']) ? 0 : count($context['debug']['hooks']) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_hooks\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_hooks" style="display: none;"><em>' . implode('</em>, <em>', $context['debug']['hooks']), '</em></span>)', '<br />
+	',(isset($context['debug']['instances']) ? ($txt['debug_instances'] . (empty($context['debug']['instances']) ? 0 : count($context['debug']['instances'])) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_instances\').style.display = \'inline\'; this.style.display = \'none\'; return false;">'. $txt['debug_show'] .'</a><span id="debug_instances" style="display: none;"><em>'. implode('</em>, <em>', array_keys($context['debug']['instances'])) .'</em></span>)'. '<br />') : ''),'
 	', $txt['debug_files_included'], count($files), ' - ', round($total_size / 1024), $txt['debug_kb'], ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_include_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_include_info" style="display: none;"><em>', implode('</em>, <em>', $files), '</em></span>)<br />';
 
 	// What tokens are active?

+ 6 - 0
Sources/Subs.php

@@ -4076,8 +4076,14 @@ function call_integration_hook($hook, $parameters = array())
 				{
 					// Don't need to create a new instance for every method.
 					if (empty($context['instances'][$call[0]]) || !($context['instances'][$call[0]] instanceof $call[0]))
+					{
 						$context['instances'][$call[0]] = new $call[0];
 
+						// Add another one to the list.
+						if ($db_show_debug === true)
+							$context['debug']['instances'][$call[0]] = $hook;
+					}
+
 					$call = array($context['instances'][$call[0]], $func);
 				}
 

+ 1 - 0
Themes/default/languages/index.english.php

@@ -818,5 +818,6 @@ $txt['debug_hide_queries'] = '[Hide Queries]';
 $txt['debug_tokens'] = 'Tokens: ';
 $txt['debug_browser'] = 'Browser ID: ';
 $txt['debug_hooks'] = 'Hooks called: ';
+$txt['debug_instances'] = 'Instances created: ';
 $txt['are_sure_mark_read'] = 'Are you sure you want to mark messages as read?';
 ?>