Index: modules/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator.module,v retrieving revision 1.249 diff -u -F^f -r1.249 aggregator.module --- modules/aggregator.module 23 Aug 2005 05:45:08 -0000 1.249 +++ modules/aggregator.module 25 Aug 2005 12:49:22 -0000 @@ -236,7 +236,7 @@ function aggregator_block($op, $delta = case 'feed': if ($feed = db_fetch_object(db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE fid = %d', $id))) { $block['subject'] = check_plain($feed->title); - $result = db_query_range('SELECT * FROM {aggregator_item} WHERE fid = %d ORDER BY timestamp DESC, iid DESC', $feed->fid, 0, $feed->block); + $result = db_query_range('SELECT * FROM {aggregator_item} WHERE fid = %d AND status > 0 ORDER BY timestamp DESC, iid DESC', $feed->fid, 0, $feed->block); $block['content'] = ''; } break; @@ -244,7 +244,7 @@ function aggregator_block($op, $delta = case 'category': if ($category = db_fetch_object(db_query('SELECT cid, title, block FROM {aggregator_category} WHERE cid = %d', $id))) { $block['subject'] = check_plain($category->title); - $result = db_query_range('SELECT i.* FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE ci.cid = %d ORDER BY i.timestamp DESC, i.iid DESC', $category->cid, 0, $category->block); + $result = db_query_range('SELECT i.* FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE ci.cid = %d AND i.status > 0 ORDER BY i.timestamp DESC, i.iid DESC', $category->cid, 0, $category->block); $block['content'] = ''; } break; @@ -905,7 +905,7 @@ function aggregator_admin_overview() { * Menu callback; displays the most recent items gathered from any feed. */ function aggregator_page_last() { - return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC', arg(1)); + return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid WHERE i.status > 0 ORDER BY i.timestamp DESC, i.iid DESC', arg(1)); } /** @@ -915,7 +915,7 @@ function aggregator_page_source() { $feed = db_fetch_object(db_query('SELECT * FROM {aggregator_feed} WHERE fid = %d', arg(2))); $info = theme('aggregator_feed', $feed); - return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' ORDER BY timestamp DESC, iid DESC', arg(3), "
$info
"); + return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' AND status > 0 ORDER BY timestamp DESC, iid DESC', arg(3), "
$info
"); } /** @@ -924,7 +924,7 @@ function aggregator_page_source() { function aggregator_page_category() { $category = db_fetch_object(db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = %d', arg(2))); - return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = '. $category->cid .' ORDER BY timestamp DESC, iid DESC', arg(3)); + return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = '. $category->cid .' AND i.status > 0 ORDER BY timestamp DESC, iid DESC', arg(3)); } /** @@ -1006,7 +1006,7 @@ function _aggregator_page_list($sql, $op * Menu callback; displays all the feeds used by the aggregator. */ function aggregator_page_sources() { - $result = db_query('SELECT f.fid, f.title, f.description, f.image, MAX(i.timestamp) AS last FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.description, f.image'); + $result = db_query('SELECT f.fid, f.title, f.description, f.image, MAX(i.timestamp) AS last FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid WHERE i.status > 0 GROUP BY f.fid, f.title, f.description, f.image'); $output = "
\n"; while ($feed = db_fetch_object($result)) { $output .= '

'. check_plain($feed->title) ."

\n"; @@ -1014,7 +1014,7 @@ function aggregator_page_sources() { // Most recent items: $list = array(); if (variable_get('aggregator_summary_items', 3)) { - $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get('aggregator_summary_items', 3)); + $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d AND i.status > 0 ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get('aggregator_summary_items', 3)); while ($item = db_fetch_object($items)) { $list[] = theme('aggregator_summary_item', $item); } @@ -1061,14 +1061,14 @@ function aggregator_page_opml($cid = NUL * Menu callback; displays all the categories used by the aggregator. */ function aggregator_page_categories() { - $result = db_query('SELECT c.cid, c.title, c.description FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid LEFT JOIN {aggregator_item} i ON ci.iid = i.iid GROUP BY c.cid, c.title, c.description'); + $result = db_query('SELECT c.cid, c.title, c.description FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE i.status > 0 GROUP BY c.cid, c.title, c.description'); $output = "
\n"; while ($category = db_fetch_object($result)) { $output .= '

'. check_plain($category->title) ."

\n"; if (variable_get('aggregator_summary_items', 3)) { $list = array(); - $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items', 3)); + $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d AND i.status > 0 ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items', 3)); while ($item = db_fetch_object($items)) { $list[] = theme('aggregator_summary_item', $item); } Index: database/database.mysql =================================================================== RCS file: /cvs/drupal/drupal/database/database.mysql,v retrieving revision 1.194 diff -u -F^f -r1.194 database.mysql --- database/database.mysql 16 Aug 2005 18:06:18 -0000 1.194 +++ database/database.mysql 25 Aug 2005 12:49:23 -0000 @@ -98,6 +98,7 @@ author varchar(255) NOT NULL default '', description longtext NOT NULL, timestamp int(11) default NULL, + status int(4) NOT NULL default '1', PRIMARY KEY (iid) ) TYPE=MyISAM; Index: database/database.pgsql =================================================================== RCS file: /cvs/drupal/drupal/database/database.pgsql,v retrieving revision 1.133 diff -u -F^f -r1.133 database.pgsql --- database/database.pgsql 16 Aug 2005 18:06:18 -0000 1.133 +++ database/database.pgsql 25 Aug 2005 12:49:23 -0000 @@ -93,6 +93,7 @@ author varchar(255) NOT NULL default '', description text, timestamp integer default NULL, + status integer NOT NULL default '1', PRIMARY KEY (iid) ); Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.128 diff -u -F^f -r1.128 updates.inc --- database/updates.inc 16 Aug 2005 20:17:54 -0000 1.128 +++ database/updates.inc 25 Aug 2005 12:49:23 -0000 @@ -43,7 +43,8 @@ "2005-07-29" => "update_142", "2005-07-30" => "update_143", "2005-08-08" => "update_144", - "2005-08-15" => "update_145" + "2005-08-15" => "update_145", + "2005-08-24" => "update_146" ); function update_110() { @@ -705,6 +706,19 @@ function update_145() { return $ret; } +function update_146() { + $ret = array(); + if ($GLOBALS['db_type'] == 'mysql') { + $ret[] = update_sql("ALTER TABLE {aggregator_item} ADD status INT(4) DEFAULT '1' NOT NULL"); + } + elseif ($GLOBALS['db_type'] == 'pgsql') { + $ret[] = update_sql("ALTER TABLE {aggregator_item} ADD status integer"); + $ret[] = update_sql("ALTER TABLE {aggregator_item} ALTER COLUMN status SET NOT NULL"); + $ret[] = update_sql("ALTER TABLE {aggregator_item} ALTER COLUMN status SET DEFAULT '1'"); + } + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql);