X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=include%2Fsanity_check.php;h=5c631574decf02b8b5f6444cb4d4ae1a578ac965;hb=5b7bd238eeed1aa83fe47f715c79b16b42ab347f;hp=aebe4f89db20be3957ea9b8737e1163186d541b7;hpb=09e8bdfd18f81e432c5f392e398b8c8088168721;p=tt-rss.git diff --git a/include/sanity_check.php b/include/sanity_check.php index aebe4f89..5c631574 100644 --- a/include/sanity_check.php +++ b/include/sanity_check.php @@ -5,12 +5,16 @@ $err_msg = "Configuration file not found. Looks like you forgot to copy config.php-dist to config.php and edit it."; } else { - define('EXPECTED_CONFIG_VERSION', 24); - define('SCHEMA_VERSION', 86); + define('EXPECTED_CONFIG_VERSION', 25); + define('SCHEMA_VERSION', 90); require_once "config.php"; require_once "sanity_config.php"; + if (function_exists('posix_getuid') && posix_getuid() == 0) { + $err_msg = "Please don't run this script as root."; + } + if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) { $err_msg = "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value."; } @@ -21,6 +25,14 @@ $err_msg = "HTMLPurifier cache directory should be writable by anyone (chmod -R 777 $purifier_cache_dir)"; } + if (!is_writable(CACHE_DIR . "/images")) { + $err_msg = "Image cache is not writable (chmod -R 777 ".CACHE_DIR."/images)"; + } + + if (!is_writable(CACHE_DIR . "/export")) { + $err_msg = "Data export cache is not writable (chmod -R 777 ".CACHE_DIR."/export)"; + } + if (GENERATED_CONFIG_CHECK != EXPECTED_CONFIG_VERSION) { $err_msg = "Configuration option checker sanity_config.php is outdated, please recreate it using ./utils/regen_config_checks.sh"; } @@ -63,6 +75,10 @@ $err_msg = "ICONS_DIR defined in config.php is not writable (chmod -R 777 ".ICONS_DIR.").\n"; } + if (!is_writable(LOCK_DIRECTORY)) { + $err_msg = "LOCK_DIRECTORY defined in config.php is not writable (chmod -R 777 ".LOCK_DIRECTORY.").\n"; + } + if (ini_get("open_basedir")) { $err_msg = "PHP configuration option open_basedir is not supported. Please disable this in PHP settings file (php.ini)."; } @@ -104,7 +120,7 @@ } } - if ($err_msg) { ?> + if ($err_msg && defined($_SERVER['REQUEST_URI'])) { ?> Fatal error @@ -130,6 +146,8 @@