CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CiviCRM & Views Cache
Pages: [1]

Author Topic: CiviCRM & Views Cache  (Read 2228 times)

ericaordinary

  • Guest
CiviCRM & Views Cache
September 09, 2010, 06:35:57 pm
Hi all,

I haven't been able to find an answer to this while searching, but perhaps someone can point me in the right direction if it's already been asked.

I have CiviCRM and Views 2 integration working fine on my Drupal site, but every day or so the custom data fields become unavailable to views and therefore Views filters relying on these custom fields no longer work.  Clearing the views cache fixes the problem and brings back the custom fields and my Civi data displays correctly.

Anyone got any suggestions on how to fix this so I don't have to keep manually clearing the views cache?

Cheers,
Erica.

ericaordinary

  • Guest
Re: CiviCRM & Views Cache
September 16, 2010, 11:22:26 pm
Bumping this thread back up, as I'm still looking for a solution for this issue.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: CiviCRM & Views Cache
September 19, 2010, 08:07:00 am
A possible solution would be to make a small Drupal module which simply clears the Views cache when cron runs. That should solve your problem I would think.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

GinkgoFJG

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 4
    • Ginkgo Street Labs
Re: CiviCRM & Views Cache
September 27, 2010, 07:48:36 am
Are you updating the $db_prefix array in your settings.php file to tell Drupal where your new tables live?  Each custom data group you create results in the creation of a new table in your database.  There's a bit about it in this thread: http://forum.civicrm.org/index.php/topic,14932.0.html.
Are you a CiviVolunteer user? Join the CiviVolunteer 2.0 Matching Grant effort to help the project win $15,000 in grant funding.

jshirkey

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 3.4.6
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
Re: CiviCRM & Views Cache
January 07, 2012, 12:22:27 pm
Hello!

I'm new to the forums; and working with CiviCRM for the first time.  I know this thread is over a year old, but I'm bumping it rather than creating a new topic because this thread is the most closely related to my problem that I can find to date, and was left unresolved.  Other threads mention specific broken Views handlers, but those issues seem to revolve around version specific bugs.  What I'm experiencing is more general, just like the original post in this thread:

  • I build, for instance, a CiviCRM Contacts view and select a combination of CiviCRM core contact fields and custom fields that I've created for the relevant contact types (Views 2.16)
  • Everything looks great and the view performs flawlessly for an indeterminate amount of time (~1 day)
  • Suddenly all CiviCRM custom fields are broken/missing handlers, but the core fields still work fine.  (see attached screenshot)

FWIW - I'm running CiviCRM 3.4.6 in Drupal 6.22 on the Aegir Hosting System, using provision_civicrm to handle install and config file generation, etc.  However, I don't suspect any of that is the source of my problem.  Everything otherwise is working perfectly, and the issue definitely also happens within intervals where no activity or work on the site has occurred.

Furthermore, if I take the query that Views preview generates, paste it in a new page, run it on page load, and print the resulting array structure to the screen; I see the values of my custom data fields, and that page will continue to work even *after* the source view itself becomes degraded again!  So I'm feeling confident that it's not an issue with custom data db table names (the table joins still work on the static test page I just mentioned), or a problem with the CiviCRM config files, or any issues with Aegir tasks, etc.

I tried Hershel's suggestion of creating a cron hook to automate a fix, but surprisingly, calling even cache_clear_all() in a cron hook every hour does not "fix" the problem.  And yet, clearing the views cache on /admin/build/views/tools or running "drush cc all" etc will all fix it temporarily.  It's possible I messed this up somehow, but I am at least confirming the cron hook runs via watchdog entries.

I'm getting pretty confused with this one, and it's becoming a blocking issue.  It's pretty clear that I've hit some corner case (likely non-version-specific) that hardly anyone else has encountered, or there would be more information/discussion at this point.  If anyone has any ideas or could point me in a new direction, I'd be grateful, because this has been difficult to debug.  The Views integration with CiviCRM is awesome; I would really hate to have to abandon it for now if I can't get this figured out.

Thanks in advance to anyone reading this who can take a moment to help!
« Last Edit: January 07, 2012, 12:27:59 pm by jshirkey »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: CiviCRM & Views Cache
January 07, 2012, 01:48:05 pm
Are the custom fields specific to the contact_subtype - it seems likely the problem is there - it's messing up it's caching of fields for contact subtype).

(unfortunately if that is the problem it's an area of the code that I've recently struggled with to fix a  unit test (& gave up))
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jshirkey

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 3.4.6
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
Re: CiviCRM & Views Cache
January 07, 2012, 03:31:21 pm
Hi Eileen -

Thanks for your reply.  I have 3 Organization sub-types defined: Nonprofit, Business, Consultant.  I have 4 Custom Field Sets defined: Organization Details (Type: Any), Nonprofit Details (Type: Nonprofit), Business Details (Type: Business), Consultant Details (Type: Consultant).  There are several custom fields in each set, none are multi-value sets.

In my earlier screenshot, the  selected custom fields from the Any Organization set as well as the Nonprofit Organization set.  All fields from both are broken.  Can you provide any further detail about the code you mentioned (files/line #s, etc)?  Thanks!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: CiviCRM & Views Cache
January 07, 2012, 03:35:08 pm
I'd start by checking this function

http://svn.civicrm.org/civicrm/branches/v3.4/drupal/modules/views/civicrm.views.inc
civicrm_views_custom_data_cache
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jshirkey

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 3.4.6
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
Re: CiviCRM & Views Cache
January 12, 2012, 02:06:00 pm
I never got to the bottom of this.  I had started on version 3.4.5, and upgrading to 3.4.6 did not resolve the issue for me.  Since I posted, I upgraded to 3.4.8 and thankfully, the issue appears to have gone away!  It's been a few days now and the Views cache has not broken my custom field handlers.  :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CiviCRM & Views Cache

This forum was archived on 2017-11-26.