Skip to content
Snippets Groups Projects
Commit 23957cdf authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch by James: made the aggregator cache less in case of mass-feeds.

parent 6fd73703
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -98,11 +98,10 @@ function aggregator_perm() {
*/
function aggregator_menu($may_cache) {
$items = array();
if ($may_cache) {
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
if ($may_cache) {
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
......@@ -136,9 +135,15 @@ function aggregator_menu($may_cache) {
'callback' => 'aggregator_page_categories', 'access' => $view,
'type' => MENU_ITEM_GROUPING);
// Sources:
$result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title');
while ($feed = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
}
else {
if (arg(0) == 'aggregator' && is_numeric(arg(2))) {
if (arg(1) == 'sources') {
$feed = db_fetch_object(db_query('SELECT title, fid FROM {aggregator_feed} WHERE fid = %d', arg(2)));
if ($feed) {
$items[] = array('path' => 'aggregator/sources/'. $feed->fid, 'title' => $feed->title,
'callback' => 'aggregator_page_source', 'access' => $view);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/view', 'title' => t('view'),
......@@ -151,10 +156,10 @@ function aggregator_menu($may_cache) {
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
// Categories:
$result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
while ($category = db_fetch_object($result)) {
}
else if (arg(1) == 'categories') {
$category = db_fetch_object(db_query('SELECT title, cid FROM {aggregator_category} WHERE cid = %d', arg(2)));
if ($category) {
$items[] = array('path' => 'aggregator/categories/'. $category->cid, 'title' => $category->title,
'callback' => 'aggregator_page_category', 'access' => $view);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/view', 'title' => t('view'),
......@@ -167,10 +172,8 @@ function aggregator_menu($may_cache) {
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
}
}
}
return $items;
......
......@@ -98,11 +98,10 @@ function aggregator_perm() {
*/
function aggregator_menu($may_cache) {
$items = array();
if ($may_cache) {
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
if ($may_cache) {
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
......@@ -136,9 +135,15 @@ function aggregator_menu($may_cache) {
'callback' => 'aggregator_page_categories', 'access' => $view,
'type' => MENU_ITEM_GROUPING);
// Sources:
$result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title');
while ($feed = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
}
else {
if (arg(0) == 'aggregator' && is_numeric(arg(2))) {
if (arg(1) == 'sources') {
$feed = db_fetch_object(db_query('SELECT title, fid FROM {aggregator_feed} WHERE fid = %d', arg(2)));
if ($feed) {
$items[] = array('path' => 'aggregator/sources/'. $feed->fid, 'title' => $feed->title,
'callback' => 'aggregator_page_source', 'access' => $view);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/view', 'title' => t('view'),
......@@ -151,10 +156,10 @@ function aggregator_menu($may_cache) {
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
// Categories:
$result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
while ($category = db_fetch_object($result)) {
}
else if (arg(1) == 'categories') {
$category = db_fetch_object(db_query('SELECT title, cid FROM {aggregator_category} WHERE cid = %d', arg(2)));
if ($category) {
$items[] = array('path' => 'aggregator/categories/'. $category->cid, 'title' => $category->title,
'callback' => 'aggregator_page_category', 'access' => $view);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/view', 'title' => t('view'),
......@@ -167,10 +172,8 @@ function aggregator_menu($may_cache) {
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
}
}
}
return $items;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment