Skip to content
Snippets Groups Projects
Commit f0d59102 authored by David Rothstein's avatar David Rothstein
Browse files

Issue #1443308 by cilefen, joseph.olstad, mikeytown2, joelpittet, btopro,...

Issue #1443308 by cilefen, joseph.olstad, mikeytown2, joelpittet, btopro, alexpott, jonhattan, marcingy, stewsnooze, Fabianx, pounard, tstoeckler, penyaskito: Add static cache to module_load_include()
parent 50c9b281
No related branches found
No related tags found
No related merge requests found
Drupal 7.42, xxxx-xx-xx (development version)
-----------------------
- Added static caching to module_load_include() to improve performance.
- Fixed double-encoding bugs in select field widgets provided by the Options
module. The fix deprecates the 'strip_tags' property on option widgets and
replaces it with a new 'strip_tags_and_unescape' property (minor data
......
......@@ -320,16 +320,27 @@ function module_load_install($module) {
* The name of the included file, if successful; FALSE otherwise.
*/
function module_load_include($type, $module, $name = NULL) {
static $files = array();
if (!isset($name)) {
$name = $module;
}
$key = $type . ':' . $module . ':' . $name;
if (isset($files[$key])) {
return $files[$key];
}
if (function_exists('drupal_get_path')) {
$file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$name.$type";
if (is_file($file)) {
require_once $file;
$files[$key] = $file;
return $file;
}
else {
$files[$key] = FALSE;
}
}
return FALSE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment