mirror of https://github.com/MISP/MISP
chg: [internal] Element file cache
parent
e2a0644111
commit
5aa1e0cb3b
|
@ -1413,4 +1413,14 @@ class AppController extends Controller
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override View class
|
||||||
|
* @return AppView
|
||||||
|
*/
|
||||||
|
protected function _getViewObject()
|
||||||
|
{
|
||||||
|
App::uses('AppView', 'View');
|
||||||
|
return new AppView($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
class AppView extends View
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Negative results of `file_exists` methods are not cached, so we provide our cache
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $elementFileCache = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
|
protected function _getElementFileName($name)
|
||||||
|
{
|
||||||
|
if (isset($this->elementFileCache[$name])) {
|
||||||
|
return $this->elementFileCache[$name];
|
||||||
|
}
|
||||||
|
$result = parent::_getElementFileName($name);
|
||||||
|
$this->elementFileCache[$name] = $result;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue