I am using views module to filter my image nodes by username and taxonomy term. When a new image is added using a freetagging term not previously specified in another node, the views that ultilize taxonomy terms break. By going to the module page and resaving, the views cache is cleared and the views are fixed until the next image is added with a new term.
I do not have taxonomy access control module installed.
Below is an export for one of the views that is affected.
$view = new stdClass();
$view->name = 'photos_user_tags';
$view->description = 'Bring up a list of photos by tag.';
$view->access = array (
0 => '3',
1 => '1',
2 => '2',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Photos tagged with %1';
$view->page_header = "Photos tagged with <em> <b><?php print arg(3); ?></b> </em>:";
$view->page_header_format = '2';
$view->page_footer = "";
$view->page_footer_format = '1';
$view->page_empty = "";
$view->page_empty_format = '1';
$view->page_type = 'bonus_grid';
$view->url = 'photos/$arg/tags/$arg';
$view->use_pager = TRUE;
$view->nodes_per_page = '15';
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'created',
'sortorder' => 'DESC',
'options' => '',
),
);
$view->argument = array (
array (
'type' => 'username',
'argdefault' => '1',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array (
'type' => 'taxletter',
'argdefault' => '1',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
array (
'tablename' => 'image',
'field' => 'nid',
'label' => '',
'handler' => 'image_views_handler_image_img_link',
'options' => 'small',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'image',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, image);
$views[$view->name] = $view;
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | views-cache-1.patch | 3.81 KB | bdragon |
| #4 | views-cache.patch | 3.91 KB | bdragon |
Comments
Comment #1
bdragon commentedIf something causes the "views_with_inline_args:$locale" cache entry to be deleted, this isn't noticed until resubmitting the module page!
(i.e. the cache entry is blindly assumed to be available)
This is due to the code for regenerating the views_with_inline_args being inside the $may_cache block of views_menu().
I would recommend factoring out this part of the hook and calling it if cache_get("views_with_inline_args:$locale") returns 0 in the uncacheable part of the hook.
By copying the relevant part of the $may_cache section to the other section (inside an if($data==0) block) the bug disappears.
Comment #2
bdragon commentedHmm, this probabaly causes other problems too, especially if you use multiple languages...
Comment #3
merlinofchaos commentedIt seems likely that at least a temporary fix would be to force views_invalidate_cache() to also do a menu_rebuild and invalidate the menu cache.
Comment #4
bdragon commentedCame up with this.
This will allow multiple languages to continue working, the first user of each language to trigger a page hit will cause the rebuild for their language.
Comment #5
potential commentedWorked great!
Comment #6
merlinofchaos commentedPlease don't do:
I always always always
I know it's a small thing, and I was going to live with it, but the patch failed (probably because some other changes happened to the menu stuff at some point), so it needs to be rerolled and I'm too tired to deal with that just now.
Comment #7
bdragon commentedSorry about that, still working on breaking old habits.
Anyway, rerolled against DRUPAL-4-7 and fixed the checks to "Allow $arg to work in the first position." (Which the conflict brought to my attention -- thank you CVS.)
Comment #8
merlinofchaos commentedThis is in both Drupal 5 and Drupal 4.7 dev -- could you test it and make sure it's working as expected?
Comment #9
(not verified) commented