Преглед изворни кода

Add the new instance class to the debug info in Sources/Admin::AdminMain()

Signed-off-by: Suki <[email protected]>
Suki пре 10 година
родитељ
комит
e7b4fce5e8
2 измењених фајлова са 10 додато и 3 уклоњено
  1. 8 1
      Sources/Admin.php
  2. 2 2
      Sources/Subs.php

+ 8 - 1
Sources/Admin.php

@@ -24,7 +24,8 @@ if (!defined('SMF'))
  */
 function AdminMain()
 {
-	global $txt, $context, $scripturl, $modSettings, $settings, $sourcedir, $options, $boarddir;
+	global $txt, $context, $scripturl, $modSettings, $settings;
+	global $sourcedir, $options, $boarddir, $db_show_debug;
 
 	// Load the language and templates....
 	loadLanguage('Admin');
@@ -489,8 +490,14 @@ function AdminMain()
 	{
 		// Is there an instance already? nope? then create it!
 		if (empty($context['instances'][$admin_include_data['class']]) || !($context['instances'][$admin_include_data['class']] instanceof $admin_include_data['class']))
+		{
 			$context['instances'][$admin_include_data['class']] = new $admin_include_data['class'];
 
+			// Add another one to the list.
+			if ($db_show_debug === true)
+				$context['debug']['instances'][$admin_include_data['class']] = $admin_include_data['class'];
+		}
+
 		$call = array($context['instances'][$admin_include_data['class']], $admin_include_data['function']);
 	}
 

+ 2 - 2
Sources/Subs.php

@@ -4203,7 +4203,7 @@ function remove_integration_function($hook, $function, $file = '', $object = fal
 /**
  * Receives a string and tries to figure it out if its a method or a function.
  * If a method is found, it looks for a "#" which indicates SMF should create a new instance of the given class.
- * Prepare and returns callable depending on the type of method/function found.
+ * Prepare and returns a callable depending on the type of method/function found.
  *
  * @param string $string The string containing a function name
  * @return string|array Either a string or an array that contains a callable function name or an array with a class and method to call
@@ -4245,7 +4245,7 @@ function call_hook_helper($string)
 			return array($class, $method);
 	}
 
-	// Nope! just a plain regular function
+	// Nope! just a plain regular function.
 	else
 		return $string;
 }