diff options
author | Marcin Juszkiewicz <hrw@openembedded.org> | 2006-08-25 10:45:56 +0000 |
---|---|---|
committer | Marcin Juszkiewicz <hrw@openembedded.org> | 2006-08-25 10:45:56 +0000 |
commit | 15fe10f53b83794d42ff5d59b9006e21cc3f7652 (patch) | |
tree | 9f879830c8fc601df2ffbb2f5ba01ae77e64d8b5 | |
parent | 219969bfd684be1d202d581830107b98dd1c9165 (diff) |
feed-browser: FIX: feed structure was changed - database NEED to be rebuilt
- package.p_feed is now int -> feeds.f_id
-rw-r--r-- | contrib/feed-browser/includes/config.inc | 2 | ||||
-rw-r--r-- | contrib/feed-browser/includes/functions.inc | 9 | ||||
-rw-r--r-- | contrib/feed-browser/update.php | 12 |
3 files changed, 14 insertions, 9 deletions
diff --git a/contrib/feed-browser/includes/config.inc b/contrib/feed-browser/includes/config.inc index 1397d2c947..0a270a8eb0 100644 --- a/contrib/feed-browser/includes/config.inc +++ b/contrib/feed-browser/includes/config.inc @@ -1,6 +1,6 @@ <?php -define('DB_FILENAME', './feeds2.db'); +define('DB_FILENAME', './feeds.db'); $feeds = array( array( diff --git a/contrib/feed-browser/includes/functions.inc b/contrib/feed-browser/includes/functions.inc index 4edf3f4369..77afca6f5e 100644 --- a/contrib/feed-browser/includes/functions.inc +++ b/contrib/feed-browser/includes/functions.inc @@ -79,15 +79,20 @@ function insert_feeds ($db) if(isset($feeds)) { + $id = 1; + foreach($feeds as $distro) { foreach($distro['feeds'] as $feed) { - sqlite_query($db, "INSERT INTO feeds (f_name, f_uri) VALUES + sqlite_query($db, "INSERT INTO feeds (f_id, f_name, f_uri) VALUES ( + {$id}, '{$distro['distro_name']} {$distro['distro_version']} {$feed['name']}', '{$distro['feed_base_url']}{$feed['url']}' )"); + + $id++; } } } @@ -166,7 +171,7 @@ function pkgdetails ($package) { $result = db_query("SELECT * FROM packages,feeds WHERE (packages.p_name='$package' OR packages.p_provides='$package') - AND feeds.f_name = packages.p_feed + AND feeds.f_id = packages.p_feed ORDER BY packages.p_version DESC, feeds.f_name ASC, packages.p_arch DESC "); // display first result diff --git a/contrib/feed-browser/update.php b/contrib/feed-browser/update.php index 94c8608616..786e898494 100644 --- a/contrib/feed-browser/update.php +++ b/contrib/feed-browser/update.php @@ -42,7 +42,7 @@ check_database(); $start = time(); $p_count = 0; -$feeds = db_query("SELECT f_name, f_uri FROM feeds"); +$feeds = db_query("SELECT f_id, f_name, f_uri FROM feeds"); foreach($feeds as $feed) { @@ -59,8 +59,8 @@ foreach($feeds as $feed) 'name'=>'', 'version'=>'', 'arch'=>'', 'depends'=>'', 'maintainer'=>'', 'homepage'=>'', 'section'=>'', 'replaces'=>'', 'provides'=>'', 'recommends'=>'', 'conflicts'=>'', 'size'=>'', - 'md5sum'=>'', 'source'=>'', 'feed'=>'', 'file'=>'', 'desc'=>'' - ); + 'md5sum'=>'', 'source'=>'', 'feed'=>$feed['f_id'], 'file'=>'', 'desc'=>'' + ); while (!feof($packagesgz_h)) { @@ -75,7 +75,7 @@ foreach($feeds as $feed) 'name'=>'', 'version'=>'', 'arch'=>'', 'depends'=>'', 'maintainer'=>'', 'homepage'=>'', 'section'=>'', 'replaces'=>'', 'provides'=>'', 'recommends'=>'', 'conflicts'=>'', 'size'=>'', - 'md5sum'=>'', 'source'=>'', 'feed'=>'', 'file'=>'', 'desc'=>'' + 'md5sum'=>'', 'source'=>'', 'feed'=>$feed['f_id'], 'file'=>'', 'desc'=>'' ); } @@ -161,7 +161,7 @@ function insert_ipkgs(&$package_info) { db_query_n("INSERT INTO packages VALUES ( '{$package_info['name']}', '{$package_info['version']}', - '{$package_info['arch']}', '{$package_info['depends']}', + '{$package_info['arch']}', '{$package_info['depends']}', '{$package_info['maintainer']}', '{$package_info['homepage']}', '{$package_info['section']}', '{$package_info['replaces']}', '{$package_info['provides']}', '{$package_info['recommends']}', @@ -169,7 +169,7 @@ function insert_ipkgs(&$package_info) '{$package_info['md5sum']}', '{$package_info['source']}', '{$package_info['feed']}', '{$package_info['file']}', '{$package_info['desc']}' - )"); + )"); } ?> |