diff --git a/modules/core/dictionaries/frontpage.definition.json b/modules/core/dictionaries/frontpage.definition.json index ee509f4b53fe35c94d5050a3ba4745eadd7c1982..c470b5ba82bed86ce9c485f8b80fa007fe5b574f 100644 --- a/modules/core/dictionaries/frontpage.definition.json +++ b/modules/core/dictionaries/frontpage.definition.json @@ -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> ]" }, diff --git a/modules/core/dictionaries/frontpage.translation.json b/modules/core/dictionaries/frontpage.translation.json index 767bf766fc5b72fa190c5df32cdd845e2acf7f47..13337fd263ec07c09c334032650f68ef4bc73a41 100644 --- a/modules/core/dictionaries/frontpage.translation.json +++ b/modules/core/dictionaries/frontpage.translation.json @@ -1630,5 +1630,8 @@ "es": "Su instalación de SimpleSAMLphp está desactualizada. Por favor, actualice a la <a href=\"%LATEST_URL%\">última versió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." } } diff --git a/modules/core/locales/en/LC_MESSAGES/core.po b/modules/core/locales/en/LC_MESSAGES/core.po index 9ddd25f62f64f4858ba2ccc18b6c525873f43a2c..38593a5ecbbab02d56d6d70cac9726181e034681 100644 --- a/modules/core/locales/en/LC_MESSAGES/core.po +++ b/modules/core/locales/en/LC_MESSAGES/core.po @@ -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." diff --git a/modules/core/locales/nl/LC_MESSAGES/core.po b/modules/core/locales/nl/LC_MESSAGES/core.po index edeee369edef093ca15dcd484b9a3b67ca2d0c81..95f5aa885451c3ce9f05e0588d63c74cc4e2860d 100644 --- a/modules/core/locales/nl/LC_MESSAGES/core.po +++ b/modules/core/locales/nl/LC_MESSAGES/core.po @@ -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" diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index 26d388b8bda8d8409021c0d53b0474aa235c7b5e..a343b9580fc52953d15643716fe2a2b82932d555 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -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']) ); + } } }