瀏覽代碼

! Only load a language file if we need it because the first time call_integration_hook is run, the theme paths are not known which means that loadEssentialThemeData has to run which costs an extra DB query we don't actually need to run.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 年之前
父節點
當前提交
935f615011
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      Sources/Subs.php

+ 6 - 2
Sources/Subs.php

@@ -4003,8 +4003,6 @@ function call_integration_hook($hook, $parameters = array())
 	if (!isset($context['instances']))
 		$context['instances'] = array();
 
-	 loadLanguage('Errors');
-
 	$results = array();
 	if (empty($modSettings[$hook]))
 		return $results;
@@ -4041,7 +4039,10 @@ function call_integration_hook($hook, $parameters = array())
 
 				// No? tell the admin about it.
 				else
+				{
+					loadLanguage('Errors');
 					log_error(sprintf($txt['hook_fail_loading_file'], $absPath), 'general');
+				}
 
 				// Check if a new object will be created.
 				if (strpos($call[1], '#') !== false)
@@ -4086,7 +4087,10 @@ function call_integration_hook($hook, $parameters = array())
 
 		// Whatever it was suppose to call, it failed :(
 		elseif (!empty($func) && !empty($absPath))
+		{
+			loadLanguage('Errors');
 			log_error(sprintf($txt['hook_fail_call_to'], $func, $absPath), 'general');
+		}
 	}
 
 	return $results;