sanity_check.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. define('EXPECTED_CONFIG_VERSION', 3);
  3. if (!file_exists("config.php")) {
  4. print "<b>Fatal Error</b>: You forgot to copy
  5. <b>config.php-dist</b> to <b>config.php</b> and edit it.";
  6. exit;
  7. }
  8. require_once "config.php";
  9. if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
  10. print "<b>Fatal Error</b>: Your configuration file has
  11. wrong version. Please copy new options from <b>config.php-dist</b> and
  12. update CONFIG_VERSION directive.";
  13. exit;
  14. }
  15. if (!defined('RSS_BACKEND_TYPE')) {
  16. print "<b>Fatal error</b>: RSS backend type is not defined
  17. (config variable <b>RSS_BACKEND_TYPE</b>) - please check your
  18. configuration file.";
  19. exit;
  20. }
  21. if (RSS_BACKEND_TYPE == "magpie" && !file_exists("magpierss/rss_fetch.inc")) {
  22. print "<b>Fatal Error</b>: You forgot to place
  23. <a href=\"http://magpierss.sourceforge.net\">MagpieRSS</a>
  24. distribution in <b>magpierss/</b>
  25. subdirectory of TT-RSS tree.";
  26. exit;
  27. }
  28. if (RSS_BACKEND_TYPE == "simplepie" && !file_exists("simplepie/simplepie.inc")) {
  29. print "<b>Fatal Error</b>: You forgot to place
  30. <a href=\"http://simplepie.org\">SimplePie</a>
  31. distribution in <b>simplepie/</b>
  32. subdirectory of TT-RSS tree.";
  33. exit;
  34. }
  35. if (RSS_BACKEND_TYPE != "simplepie" && RSS_BACKEND_TYPE != "magpie") {
  36. print "<b>Fatal Error</b>: Invalid RSS_BACKEND_TYPE";
  37. exit;
  38. }
  39. if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
  40. return "config: your config file version is incorrect. See config.php-dist.";
  41. }
  42. if (file_exists("xml-export.php") || file_exists("xml-import.php")) {
  43. print "<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b>
  44. and <b>xml-import.php</b>) could be used maliciously. Please remove them
  45. from your TT-RSS instance.";
  46. exit;
  47. }
  48. if (RSS_BACKEND_TYPE != "magpie") {
  49. print "<b>Fatal Error</b>: RSS backends other than magpie are not
  50. supported now.";
  51. exit;
  52. }
  53. if (SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) {
  54. print "<b>Fatal Error</b>: Please set DAEMON_UPDATE_LOGIN_LIMIT
  55. to 0 in single user mode.";
  56. exit;
  57. }
  58. ?>