$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.";
}
$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";
}
}
}
- if ($err_msg) { ?>
+ if ($err_msg && defined($_SERVER['REQUEST_URI'])) { ?>
<html>
<head>
<title>Fatal error</title>
<?php
die;
+ } else if ($err_msg) {
+ die("[sanity_check] $err_msg\n");
}
?>