Commit 1ad5fb90 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1579285: Checking that we have a connection to a memcache server

As simplesamlphp has issues with relying on phpsession.
Show the error on page where we set up plugin


Change-Id: I5503552ec17360986a2607d141a5a0efad10e288
Signed-off-by: Robert Lyon's avatarRobert Lyon <>
parent 643ce809
......@@ -27,6 +27,7 @@ $string['errnosamluser'] = 'No user found';
$string['errorssphpsetup'] = 'SAML not set up correctly. Need to first run "make ssphp" from the commandline';
$string['errorbadlib'] = 'SimpleSAMLPHP library\'s "autoloader" file not found at %s.<br>Make sure you install SimpleSAMLphp via "make ssphp" and the file is readable.';
$string['errornomcrypt'] = 'PHP library "mcrypt" must be installed for auth/saml. Make sure you install and activate mcrypt eg:<br>sudo apt-get install php5-mcrypt<br>sudo php5enmod mcrypt<br>Then restart webserver.';
$string['errornomemcache'] = 'A memcache server is needed for auth/saml. Either list the paths to your memcache servers in the $cfg->memcacheservers config variable or install memcache locally.<br>To install the PHP library "memcache" locally:<br>sudo apt-get install php5-memcache<br>sudo php5enmod memcache<br>Then restart webserver.';
$string['errorbadconfig'] = 'SimpleSAMLPHP config directory %s is incorrect.';
$string['errorbadcombo'] = 'You can only choose user auto-creation if you have not selected remoteuser.';
$string['errorbadmetadata'] = 'Badly formed SAML metadata. Ensure XML contains one valid IdP.';
......@@ -441,11 +441,17 @@ class PluginAuthSaml extends PluginAuth {
// check extensions are loaded
$libchecks = '';
// Make sure mcrypt exists
if (!extension_loaded('mcrypt')) {
$libchecks .= '<li>' . get_string('errornomcrypt','auth.saml') . '</li>';
$libchecks .= '<li>' . get_string('errornomcrypt', 'auth.saml') . '</li>';
// Make sure the simplesamlphp files have been installed via 'make ssphp'
if (!file_exists(get_config('docroot') .'auth/saml/extlib/simplesamlphp/vendor/autoload.php')) {
$libchecks .= '<li>' . get_string('errorbadlib','auth.saml', get_config('docroot') .'auth/saml/extlib/simplesamlphp/vendor/autoload.php') . '</li>';
$libchecks .= '<li>' . get_string('errorbadlib', 'auth.saml', get_config('docroot') .'auth/saml/extlib/simplesamlphp/vendor/autoload.php') . '</li>';
// Make sure we can use 'memcache' with simplesamlphp as 'phpsession' doesn't work correctly in many situations
if (empty(get_config('memcacheservers')) && !extension_loaded('memcache')) {
$libchecks .= '<li>' . get_string('errornomemcache', 'auth.saml') . '</li>';
if (!empty($libchecks)) {
$libcheckstr = '<div class="alert alert-danger"><ul class="unstyled">' . $libchecks . '</ul></div>';
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