From 942afb43a1357b8189f21937fe3abd413a14a21d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 8 Feb 2021 08:49:21 +0300 Subject: sanity checks: use better CLI detection, shorten most of the text --- include/sanity_check.php | 52 ++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/sanity_check.php b/include/sanity_check.php index fddc26295..a7660795b 100755 --- a/include/sanity_check.php +++ b/include/sanity_check.php @@ -1,18 +1,5 @@ $ref_self_url_path)" : ""; - array_push($errors, - "Please set SELF_URL_PATH to the correct value for your server: $hint"); - } + if (SELF_URL_PATH == "http://example.org/tt-rss/") { + $hint = $ref_self_url_path ? "(possible value: $ref_self_url_path)" : ""; + array_push($errors, + "Please set SELF_URL_PATH to the correct value for your server: $hint"); + } - if ($ref_self_url_path && - (!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) && - SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) { - array_push($errors, - "Please set SELF_URL_PATH to the correct value detected for your server: $ref_self_url_path (you're using: " . SELF_URL_PATH . ")"); + if ($ref_self_url_path && + (!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) && + SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) { + array_push($errors, + "Please set SELF_URL_PATH to the correct value detected for your server: $ref_self_url_path (you're using: " . SELF_URL_PATH . ")"); + } } if (!is_writable(ICONS_DIR)) { @@ -207,7 +193,7 @@ } } - if (count($errors) > 0 && $_SERVER['REQUEST_URI']) { ?> + if (count($errors) > 0 && php_sapi_name() != "cli") { ?> @@ -240,7 +226,7 @@ echo "Please fix errors indicated by the following messages:\n\n"; foreach ($errors as $error) { - echo " * $error\n"; + echo " * " . strip_tags($error)."\n"; } echo "\nYou might want to check tt-rss wiki or the forums for more information.\n"; -- cgit v1.2.3