]> git.wh0rd.org - tt-rss.git/blobdiff - sanity_check.php
move HTMLPurifier cache inside CACHE_DIR/htmlpurifier
[tt-rss.git] / sanity_check.php
index 35d5c2a7f89c0f5d9c9ef63ffc71e96ac56626de..ce755f4028b2fe9e0237e067c25496f4b4ecb382 100644 (file)
@@ -1,27 +1,38 @@
 <?php
        require_once "functions.php";
 
-       define('EXPECTED_CONFIG_VERSION', 21);
-       define('SCHEMA_VERSION', 78);
+       define('EXPECTED_CONFIG_VERSION', 22);
+       define('SCHEMA_VERSION', 83);
 
        if (!file_exists("config.php")) {
-               print "<b>Fatal Error</b>: You forgot to copy 
+               print "<b>Fatal Error</b>: You forgot to copy
                <b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
                exit;
        }
 
        require_once "config.php";
+       require_once "sanity_config.php";
 
        if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
                $err_msg = "config: your config file version is incorrect. See config.php-dist.\n";
        }
 
-       $purifier_cache_dir = "lib/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer";
+       $purifier_cache_dir = CACHE_DIR . "/htmlpurifier";
 
        if (!is_writable($purifier_cache_dir)) {
                $err_msg = "config: HTMLPurifier cache directory should be writable by anyone (chmod -R 777 $purifier_cache_dir)";
        }
 
+       if (GENERATED_CONFIG_CHECK != EXPECTED_CONFIG_VERSION) {
+               $err_msg = "config: your sanity_config.php is outdated, please recreate it using ./utils/regen_config_checks.sh";
+       }
+
+       foreach ($requred_defines as $d) {
+               if (!defined($d)) {
+                       $err_msg = "config: required constant $d is not defined. Please check config.php";
+               }
+       }
+
        if (defined('RSS_BACKEND_TYPE')) {
                print "<b>Fatal error</b>: RSS_BACKEND_TYPE is deprecated. Please remove this
                        option from config.php\n";
@@ -30,7 +41,7 @@
 
        if (file_exists("xml-export.php") || file_exists("xml-import.php")) {
                print "<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b>
-               and <b>xml-import.php</b>) could be used maliciously. Please remove them 
+               and <b>xml-import.php</b>) could be used maliciously. Please remove them
                from your TT-RSS instance.\n";
                exit;
        }
                exit;
        }
 
-       if (USE_CURL && ! function_exists("curl_init")) {
-               print "<b>Fatal Error</b>: You have enabled USE_CURL, but your PHP 
-                       doesn't seem to support CURL functions.";
-               exit;
-       } 
-
        if (!defined('SESSION_EXPIRE_TIME')) {
                $err_msg = "config: SESSION_EXPIRE_TIME is undefined";
        }
@@ -78,7 +83,7 @@
                if ($link) {
                        $result = db_query($link, "SELECT id FROM ttrss_users WHERE id = 1");
 
-                       if (db_num_rows($result) != 1) {        
+                       if (db_num_rows($result) != 1) {
                                $err_msg = "config: SINGLE_USER_MODE is enabled but default admin account (UID=1) is not found.";
                        }
                }
 
        if (!defined('DEFAULT_UPDATE_METHOD') || (DEFAULT_UPDATE_METHOD != 0 &&
                        DEFAULT_UPDATE_METHOD != 1)) {
-               $err_msg = "config: DEFAULT_UPDATE_METHOD should be either 0 or 1.";            
+               $err_msg = "config: DEFAULT_UPDATE_METHOD should be either 0 or 1.";
        }
 
        if (!is_writable(ICONS_DIR)) {
                $err_msg = "php.ini: Safe mode is not supported. If you wish to continue, remove this test from sanity_check.php and proceeed at your own risk. Please note that your bug reports will not be accepted or reviewed.";
        }
 
-       if (defined('USE_CURL_FOR_ICONS')) {
-               $err_msg = "config: USE_CURL_FOR_ICONS has been renamed to USE_CURL.";
+       if (PUBSUBHUBBUB_HUB && !function_exists("curl_init")) {
+               $err_msg = "PUBSUBHUBBUB_HUB is defined, but CURL functions are not found. CURL is required for PubSubHubbub support.";
+       }
+
+       if (!class_exists("DOMDocument")) {
+               $err_msg = "PHP: DOMDocument extension not found.";
+       }
+
+       if (!ISCONFIGURED) {
+               $err_msg = "config: please read config.php completely.";
        }
 
        if ($err_msg) {