From 0965bf141fd240cbf7cb4d58764d64c13579c3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pe=CC=81rez=20Crespo?= <jaime.perez@uninett.no> Date: Fri, 30 Jun 2017 13:58:19 +0200 Subject: [PATCH] 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. --- modules/portal/lib/Portal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/portal/lib/Portal.php b/modules/portal/lib/Portal.php index 72effb636..6b9ce045a 100644 --- a/modules/portal/lib/Portal.php +++ b/modules/portal/lib/Portal.php @@ -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 = ''; -- GitLab