From 50fbbdb83e90403447b95b326ebe825ea325e605 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Thu, 5 Jul 2007 15:37:56 +0000 Subject: feed-browser: exit if database cannot be found or created --- contrib/feed-browser/includes/functions.inc | 8 +++++++- contrib/feed-browser/index.php | 5 ++++- contrib/feed-browser/update.php | 5 ++++- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'contrib') diff --git a/contrib/feed-browser/includes/functions.inc b/contrib/feed-browser/includes/functions.inc index 5549aa578d..ad8e57e93b 100644 --- a/contrib/feed-browser/includes/functions.inc +++ b/contrib/feed-browser/includes/functions.inc @@ -422,8 +422,12 @@ function sectionslist() function check_database() { - if($db = sqlite_open(DB_FILENAME)) + $db_exists = FALSE; + + if(file_exists(DB_FILENAME) AND $db = sqlite_open(DB_FILENAME)) { + $db_exists = TRUE; + //initialize db if (db_table_exists ($db, 'packages') === FALSE) { @@ -461,6 +465,8 @@ function check_database() sqlite_close($db); } + + return $db_exists; } diff --git a/contrib/feed-browser/index.php b/contrib/feed-browser/index.php index afa4c1a36a..a6c9206073 100644 --- a/contrib/feed-browser/index.php +++ b/contrib/feed-browser/index.php @@ -33,7 +33,10 @@ require_once 'includes/config.inc'; require_once 'includes/functions.inc'; -check_database(); +if(!check_database()) +{ + die("Database not found and cannot be created."); +} $name = ''; diff --git a/contrib/feed-browser/update.php b/contrib/feed-browser/update.php index ed67d3b78a..387acf9caa 100644 --- a/contrib/feed-browser/update.php +++ b/contrib/feed-browser/update.php @@ -37,7 +37,10 @@ require_once 'includes/functions.inc'; Description: IPv4 link-local address allocator */ -check_database(); +if(!check_database()) +{ + die("Database not found and cannot be created."); +} $feeds = db_query("SELECT f_id, f_name, f_uri FROM feeds"); -- cgit v1.2.3