summaryrefslogtreecommitdiff
path: root/modules/aggregator.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-04-26 16:29:31 +0000
committerDries Buytaert <dries@buytaert.net>2005-04-26 16:29:31 +0000
commit23957cdfdd9df56402a06c4008cab13758c32c9b (patch)
tree0667f3009b2e0373d0e278a2a983aecbd3a11188 /modules/aggregator.module
parent6fd73703d9c958de86baafb98e2f8b705220d556 (diff)
downloadbrdo-23957cdfdd9df56402a06c4008cab13758c32c9b.tar.gz
brdo-23957cdfdd9df56402a06c4008cab13758c32c9b.tar.bz2
- Patch by James: made the aggregator cache less in case of mass-feeds.
Diffstat (limited to 'modules/aggregator.module')
-rw-r--r--modules/aggregator.module73
1 files changed, 38 insertions, 35 deletions
diff --git a/modules/aggregator.module b/modules/aggregator.module
index 98cd05be9..6f5dc378f 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -98,11 +98,10 @@ function aggregator_perm() {
*/
function aggregator_menu($may_cache) {
$items = array();
+ $edit = user_access('administer news feeds');
+ $view = user_access('access news feeds');
if ($may_cache) {
- $edit = user_access('administer news feeds');
- $view = user_access('access news feeds');
-
$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,42 +135,46 @@ 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/sources/'. $feed->fid, 'title' => $feed->title,
- 'callback' => 'aggregator_page_source', 'access' => $view);
- $items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/view', 'title' => t('view'),
- 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
- $items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/categorize', 'title' => t('categorize'),
- 'callback' => 'aggregator_page_source', 'access' => $edit,
- 'type' => MENU_LOCAL_TASK);
- $items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/configure', 'title' => t('configure'),
- 'callback' => 'aggregator_edit', 'access' => $edit,
- '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)) {
- $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'),
- 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
- $items[] = array('path' => 'aggregator/categories/'. $category->cid .'/categorize', 'title' => t('categorize'),
- 'callback' => 'aggregator_page_category', 'access' => $edit,
- 'type' => MENU_LOCAL_TASK);
- $items[] = array('path' => 'aggregator/categories/'. $category->cid .'/configure', 'title' => t('configure'),
- 'callback' => 'aggregator_edit', 'access' => $edit,
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 1);
- }
-
$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'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
+ $items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/categorize', 'title' => t('categorize'),
+ 'callback' => 'aggregator_page_source', 'access' => $edit,
+ 'type' => MENU_LOCAL_TASK);
+ $items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/configure', 'title' => t('configure'),
+ 'callback' => 'aggregator_edit', 'access' => $edit,
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 1);
+ }
+ }
+ 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'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
+ $items[] = array('path' => 'aggregator/categories/'. $category->cid .'/categorize', 'title' => t('categorize'),
+ 'callback' => 'aggregator_page_category', 'access' => $edit,
+ 'type' => MENU_LOCAL_TASK);
+ $items[] = array('path' => 'aggregator/categories/'. $category->cid .'/configure', 'title' => t('configure'),
+ 'callback' => 'aggregator_edit', 'access' => $edit,
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 1);
+ }
+ }
+ }
+ }
return $items;
}