summaryrefslogtreecommitdiff
path: root/include/sanity_check.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/sanity_check.php')
-rwxr-xr-xinclude/sanity_check.php54
1 files changed, 18 insertions, 36 deletions
diff --git a/include/sanity_check.php b/include/sanity_check.php
index 2786f012f..5efd23d98 100755
--- a/include/sanity_check.php
+++ b/include/sanity_check.php
@@ -21,7 +21,7 @@
$sth = $pdo->prepare("SELECT engine, table_name FROM information_schema.tables WHERE
table_schema = ? AND table_name LIKE 'ttrss_%' AND engine != 'InnoDB'");
- $sth->execute([DB_NAME]);
+ $sth->execute([Config::get(Config::DB_NAME)]);
$bad_tables = [];
@@ -44,8 +44,8 @@
array_push($errors, "Please copy config.php-dist to config.php");
}
- if (strpos(PLUGINS, "auth_") === false) {
- array_push($errors, "Please enable at least one authentication module via PLUGINS constant in config.php");
+ if (strpos(Config::get(Config::PLUGINS), "auth_") === false) {
+ array_push($errors, "Please enable at least one authentication module via Config::get(Config::PLUGINS) constant in config.php");
}
if (function_exists('posix_getuid') && posix_getuid() == 0) {
@@ -60,43 +60,25 @@
array_push($errors, "PHP UConverter class is missing, it's provided by the Internationalization (intl) module.");
}
- if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
- array_push($errors, "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value.");
+ if (!is_writable(Config::get(Config::CACHE_DIR) . "/images")) {
+ array_push($errors, "Image cache is not writable (chmod -R 777 ".Config::get(Config::CACHE_DIR)."/images)");
}
- if (!is_writable(CACHE_DIR . "/images")) {
- array_push($errors, "Image cache is not writable (chmod -R 777 ".CACHE_DIR."/images)");
+ if (!is_writable(Config::get(Config::CACHE_DIR) . "/upload")) {
+ array_push($errors, "Upload cache is not writable (chmod -R 777 ".Config::get(Config::CACHE_DIR)."/upload)");
}
- if (!is_writable(CACHE_DIR . "/upload")) {
- array_push($errors, "Upload cache is not writable (chmod -R 777 ".CACHE_DIR."/upload)");
+ if (!is_writable(Config::get(Config::CACHE_DIR) . "/export")) {
+ array_push($errors, "Data export cache is not writable (chmod -R 777 ".Config::get(Config::CACHE_DIR)."/export)");
}
- if (!is_writable(CACHE_DIR . "/export")) {
- array_push($errors, "Data export cache is not writable (chmod -R 777 ".CACHE_DIR."/export)");
- }
-
- require_once "sanity_config.php";
-
- if (GENERATED_CONFIG_CHECK != EXPECTED_CONFIG_VERSION) {
- array_push($errors,
- "Configuration option checker sanity_config.php is outdated, please recreate it using ./utils/regen_config_checks.sh");
- }
-
- foreach (get_required_defines() as $d) {
- if (!defined($d)) {
- array_push($errors,
- "Required configuration file parameter $d is not defined in config.php. You might need to copy it from config.php-dist.");
- }
- }
-
- if (SINGLE_USER_MODE && class_exists("PDO")) {
+ if (Config::get(Config::SINGLE_USER_MODE) && class_exists("PDO")) {
$pdo = Db::pdo();
$res = $pdo->query("SELECT id FROM ttrss_users WHERE id = 1");
if (!$res->fetch()) {
- array_push($errors, "SINGLE_USER_MODE is enabled in config.php but default admin account is not found.");
+ array_push($errors, "Config::get(Config::SINGLE_USER_MODE) is enabled in config.php but default admin account is not found.");
}
}
@@ -107,17 +89,17 @@
$ref_self_url_path = preg_replace("/\w+\.php$/", "", $ref_self_url_path);
}
- if (SELF_URL_PATH == "http://example.org/tt-rss/") {
+ if (Config::get(Config::SELF_URL_PATH) == "http://example.org/tt-rss/") {
$hint = $ref_self_url_path ? "(possible value: <b>$ref_self_url_path</b>)" : "";
array_push($errors,
- "Please set SELF_URL_PATH to the correct value for your server: $hint");
+ "Please set Config::get(Config::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)) {
+ Config::get(Config::SELF_URL_PATH) != $ref_self_url_path && Config::get(Config::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: <b>$ref_self_url_path</b> (you're using: <b>" . SELF_URL_PATH . "</b>)");
+ "Please set Config::get(Config::SELF_URL_PATH) to the correct value detected for your server: <b>$ref_self_url_path</b> (you're using: <b>" . Config::get(Config::SELF_URL_PATH) . "</b>)");
}
}
@@ -125,8 +107,8 @@
array_push($errors, "ICONS_DIR defined in config.php is not writable (chmod -R 777 ".ICONS_DIR.").\n");
}
- if (!is_writable(LOCK_DIRECTORY)) {
- array_push($errors, "LOCK_DIRECTORY defined in config.php is not writable (chmod -R 777 ".LOCK_DIRECTORY.").\n");
+ if (!is_writable(Config::get(Config::LOCK_DIRECTORY))) {
+ array_push($errors, "Config::get(Config::LOCK_DIRECTORY) defined in config.php is not writable (chmod -R 777 ".Config::get(Config::LOCK_DIRECTORY).").\n");
}
if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
@@ -161,7 +143,7 @@
array_push($errors, "PHP support for DOMDocument is required, but was not found.");
}
- if (DB_TYPE == "mysql") {
+ if (Config::get(Config::DB_TYPE) == "mysql") {
$bad_tables = check_mysql_tables();
if (count($bad_tables) > 0) {