From 81f55e41a73b1e200e47cd8014813c668eef67c0 Mon Sep 17 00:00:00 2001 From: Tim Schroeder Date: Mon, 16 Jul 2018 17:19:40 +0200 Subject: [PATCH] MDL-61351 core: added \core\session\manager\get_handler_class() * This is needed e.g. by the shibboleth logout handler to check which type of sessions are used. --- lib/classes/session/manager.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/classes/session/manager.php b/lib/classes/session/manager.php index 2960b77701a..f617cc2217c 100644 --- a/lib/classes/session/manager.php +++ b/lib/classes/session/manager.php @@ -123,28 +123,34 @@ class manager { } /** - * Create handler instance. + * Get fully qualified name of session handler class. + * + * @return string The name of the handler class */ - protected static function load_handler() { + public static function get_handler_class() { global $CFG, $DB; - if (self::$handler) { - return; - } - - // Find out which handler to use. if (PHPUNIT_TEST) { - $class = '\core\session\file'; - + return '\core\session\file'; } else if (!empty($CFG->session_handler_class)) { - $class = $CFG->session_handler_class; - + return $CFG->session_handler_class; } else if (!empty($CFG->dbsessions) and $DB->session_lock_supported()) { - $class = '\core\session\database'; + return '\core\session\database'; + } - } else { - $class = '\core\session\file'; + return '\core\session\file'; + } + + /** + * Create handler instance. + */ + protected static function load_handler() { + if (self::$handler) { + return; } + + // Find out which handler to use. + $class = self::get_handler_class(); self::$handler = new $class(); } -- 2.11.4.GIT