summaryrefslogtreecommitdiff
path: root/sanity_check.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-06-10 14:29:55 +0400
committerAndrew Dolgov <[email protected]>2010-06-10 14:29:55 +0400
commit50e7dd7d01de742006ebbac9322bc775d0f564a3 (patch)
treebf5e03e13d9c7bab52fdb4c5a803ef0da0efd456 /sanity_check.php
parent76e3b28010bf3ab9867d882c1c8b312e79b5500b (diff)
prevent default admin user from being removed; properly fail on startup if single user mode is enabled but default admin user is missing from the database
Diffstat (limited to 'sanity_check.php')
-rw-r--r--sanity_check.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/sanity_check.php b/sanity_check.php
index d112896e0..d2f0e3177 100644
--- a/sanity_check.php
+++ b/sanity_check.php
@@ -66,6 +66,18 @@
$err_msg = "config: DATABASE_BACKED_SESSIONS are currently broken with MySQL";
}
+ if (SINGLE_USER_MODE) {
+ $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+
+ if ($link) {
+ $result = db_query($link, "SELECT id FROM ttrss_users WHERE id = 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('MAIL_FROM')) {
$err_msg = "config: MAIL_FROM has been split into DIGEST_FROM_NAME and DIGEST_FROM_ADDRESS";
}