Skip to content
Snippets Groups Projects
Unverified Commit 0965bf14 authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Fix performance issue with the portal module.

When the module tries to build up a menu, it instantiates a new "random" template (from another module, sanitycheck) to get a translator that it can use to translate the menu options. This is awfully wrong, as it forces SSP to load another template, reinit Twig, the translation system, and so on. Instead, a new instance of SimpleSAML\Locale\Translate should be more than enough.
parent 84560d76
No related branches found
No related tags found
No related merge requests found
......@@ -30,15 +30,15 @@ class sspmod_portal_Portal {
return FALSE;
}
function getLoginInfo($t, $thispage) {
$info = array('info' => '', 'template' => $t, 'thispage' => $thispage);
function getLoginInfo($translator, $thispage) {
$info = array('info' => '', 'translator' => $translator, 'thispage' => $thispage);
SimpleSAML\Module::callHooks('portalLoginInfo', $info);
return $info['info'];
}
function getMenu($thispage) {
$config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'sanitycheck:check.tpl.php');
$t = new SimpleSAML\Locale\Translate($config);
$tabset = $this->getTabset($thispage);
$logininfo = $this->getLoginInfo($t, $thispage);
$text = '';
......
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