[oe-commits] org.oe.dev feed-browser: exit if database cannot be found or created

hrw commit openembedded-commits at lists.openembedded.org
Thu Jul 5 17:06:11 UTC 2007


feed-browser: exit if database cannot be found or created

Author: hrw at openembedded.org
Branch: org.openembedded.dev
Revision: 16946bd9e0b20b355f156a8e15f6b5b24df92f50
ViewMTN: http://monotone.openembedded.org/revision.psp?id=16946bd9e0b20b355f156a8e15f6b5b24df92f50
Files:
1
contrib/feed-browser/includes/functions.inc
contrib/feed-browser/index.php
contrib/feed-browser/update.php
Diffs:

#
# mt diff -r8a3c7a06c42b4765110f73e29f5adcee8821f26d -r16946bd9e0b20b355f156a8e15f6b5b24df92f50
#
# 
# 
# patch "contrib/feed-browser/includes/functions.inc"
#  from [00b38445616cb5505cc4fa1ab8e88eea0447a79d]
#    to [feeea665464114eb7bb23b3206f9065080ae29ff]
# 
# patch "contrib/feed-browser/index.php"
#  from [08c6c70653597fff910d55ac9dc7447ecb7ba9e2]
#    to [a69401785e30ec849bda4c23b9c56ae065f0eab0]
# 
# patch "contrib/feed-browser/update.php"
#  from [0a6696349338576e60018f0f8fbbf645cec91913]
#    to [4398c9038b61a475e06fbb36872a07487552a45b]
# 
============================================================
--- contrib/feed-browser/includes/functions.inc	00b38445616cb5505cc4fa1ab8e88eea0447a79d
+++ contrib/feed-browser/includes/functions.inc	feeea665464114eb7bb23b3206f9065080ae29ff
@@ -422,8 +422,12 @@ function check_database()
 
 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;
 }
 
 
============================================================
--- contrib/feed-browser/index.php	08c6c70653597fff910d55ac9dc7447ecb7ba9e2
+++ contrib/feed-browser/index.php	a69401785e30ec849bda4c23b9c56ae065f0eab0
@@ -33,7 +33,10 @@ require_once 'includes/functions.inc';
 require_once 'includes/config.inc';
 require_once 'includes/functions.inc';
 
-check_database();
+if(!check_database())
+{
+	die("Database not found and cannot be created.");
+}
 
 $name = '';
 
============================================================
--- contrib/feed-browser/update.php	0a6696349338576e60018f0f8fbbf645cec91913
+++ contrib/feed-browser/update.php	4398c9038b61a475e06fbb36872a07487552a45b
@@ -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");
 






More information about the Openembedded-commits mailing list