og_views.inc disappearing causing site-wide views cache corruption
| Project: | Organic groups |
| Version: | 5.x-6.0 |
| Component: | og.module |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
I have many views that rely on "OG: Group nid(s)" as the argument, shown on the 'front page' of the site for example. From time to time, og_views.inc simply disappears. The arguments are no longer available, but the view still runs. When the group nid argument disappears, the argument defaults to blank and selects *all* content from *all* groups, causing it to all spill over.
I believe this issue is related to the VotingAPI views problem: http://drupal.org/node/189311
The only way either VotingAPI Views or OG Views has consistently worked for me is including outside of a function completely.
I believe the culprit is the assumption that we do not want to include that file if serving cached pages. This is incorrect as it seems the views cache still may update while serving a cached page. If it updates and that file is not included, all views relying on it are immediately corrupt until the view cache resets again -- even if the file is included.
<?php
function og_init() {
// only bother when we are not serving a cached page. check for which function that only exists afterwards
if (function_exists('drupal_set_content')) {
// we have to perform a load in order to assure that the $user->og_groups bits are present.
global $user;
if ($user->uid) {
$user = user_load(array('uid' => $user->uid));
}
else {
$user->og_groups = array();
}
require dirname(__FILE__). '/og_views.inc';
og_theme();
og_set_locale();
}
}
?>
#1
see http://drupal.org/node/189311#comment-803396