Commit b2bb8d33 authored by catch's avatar catch

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

Issue #1443308 by cilefen, joseph.olstad, mikeytown2, joelpittet, btopro, alexpott, marcingy, jonhattan, stewsnooze, tstoeckler, penyaskito: Add static cache to module_load_include()
parent d0daeeeb
......@@ -89,6 +89,13 @@ class ModuleHandler implements ModuleHandlerInterface {
*/
protected $root;
/**
* A list of module include file keys.
*
* @var array
*/
protected $includeFileKeys = [];
/**
* Constructs a ModuleHandler object.
*
......@@ -263,14 +270,21 @@ public function loadInclude($module, $type, $name = NULL) {
}
$name = $name ?: $module;
$key = $type . ':' . $module . ':' . $name;
if (isset($this->includeFileKeys[$key])) {
return $this->includeFileKeys[$key];
}
if (isset($this->moduleList[$module])) {
$file = $this->root . '/' . $this->moduleList[$module]->getPath() . "/$name.$type";
if (is_file($file)) {
require_once $file;
$this->includeFileKeys[$key] = $file;
return $file;
}
else {
$this->includeFileKeys[$key] = FALSE;
}
}
return FALSE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment