Skip to content
Snippets Groups Projects
Commit ec1f895a authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Check for presence of cURL extension before performing update check.

Otherwise new installs that do not have this extension get a "white
page" with an exception in the logs, because the check happens before
the page reports on the required modules. This will no doubt lead to
many support questions on the mailing list.
parent 394e1be2
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,9 @@
"warnings": {
"en": "Warnings"
},
"warnings_curlmissing": {
"en": "PHP cURL extension missing. Cannot check for SimpleSAMLphp updates."
},
"warnings_https": {
"en": "<strong>You are not using HTTPS<\/strong> - encrypted communication with the user. HTTP works fine for test purposes, but in a production environment, you should use HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Read more about SimpleSAMLphp maintenance<\/a> ]"
},
......
......@@ -1630,5 +1630,8 @@
"es": "Su instalaci&oacute;n de SimpleSAMLphp est&aacute; desactualizada. Por favor, actualice a la <a href=\"%LATEST_URL%\">&uacute;ltima versi&oacute;n</a> lo antes posible.",
"zh-tw": "\u60a8\u6b63\u5728\u4f7f\u7528\u5df2\u904e\u6642\u7684 SimpleSAMLphp \u7248\u672c\uff0c\u8acb\u76e1\u5feb\u66f4\u65b0\u81f3<a href=\"%LATEST_URL%\">\u6700\u65b0\u7248\u672c</a>\u3002",
"nl": "Deze installatie van SimpleSAMLphp is verouderd. Het is aan te raden zo snel mogelijk te upgraden naar <a href=\"%LATEST_URL%\">de meest recente versie</a>."
},
"warnings_curlmissing": {
"nl": "PHP cURL-extensie ontbreekt. Kan niet controleren op updates voor simpleSAMLphp."
}
}
......@@ -360,6 +360,9 @@ msgstr "Configure Shibboleth 1.3 SP to work with SimpleSAMLphp IdP"
msgid "Using the back and forward buttons in the web browser."
msgstr "Using the back and forward buttons in the web browser."
msgid "PHP cURL extension missing. Cannot check for SimpleSAMLphp updates."
msgstr "PHP cURL extension missing. Cannot check for SimpleSAMLphp updates."
msgid ""
"You are running an outdated version of SimpleSAMLphp. Please update to <a"
" href=\"%LATEST_URL%\">the latest version</a> as soon as possible."
......
......@@ -137,6 +137,9 @@ msgstr ""
"snel mogelijk te upgraden naar <a href=\"%LATEST_URL%\">de meest recente "
"versie</a>."
msgid "{core:frontpage:warnings_curlmissing}"
msgstr "PHP cURL-extensie ontbreekt. Kan niet controleren op updates voor SimpleSAMLphp."
msgid "{core:frontpage:loggedin_as_admin}"
msgstr "Je bent ingelogd als beheerder"
......
......@@ -58,9 +58,12 @@ $allLinks = array(
// don't need to fetch it on every access to this page.
$current = $config->getVersion();
if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master') {
$latest = $session->getData("core:latest_simplesamlphp_version", "version");
if (!function_exists('curl_init')) {
$warnings[] = [ '{core:frontpage:warnings_curlmissing}' ];
} else {
$latest = $session->getData("core:latest_simplesamlphp_version", "version");
if (!$latest) {
if (!$latest) {
$api_url = 'https://api.github.com/repos/simplesamlphp/simplesamlphp/releases';
$ch = curl_init($api_url.'/latest');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
......@@ -75,14 +78,15 @@ if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master')
$session->setData("core:latest_simplesamlphp_version", "version", $latest);
}
curl_close($ch);
}
}
if ($latest && version_compare($current, ltrim($latest['tag_name'], 'v'), 'lt')) {
if ($latest && version_compare($current, ltrim($latest['tag_name'], 'v'), 'lt')) {
$outdated = true;
$warnings[] = array(
'{core:frontpage:warnings_outdated}',
array('%LATEST_URL%' => $latest['html_url'])
);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment