I use panel module to create my frontpage, on which I insert some views into the grids.

After upgrading from 5.7 to 5.10, those views on the frontpage can't display unless I empty the cache_views table before refresh.

Does anyone know what the problem is? Because I can't empty the table every time before refreshing the page.

thanks!

Comments

okday’s picture

Hi,

I have the same problem.

subscribing

kamleshpatidar’s picture

Subscribing

kamleshpatidar’s picture

Hi soyo,
i think you have solved your problem?

Because I can't empty the table every time before refreshing the page.

if you solved this in drupal 5.10 please guide me, or if you have not success till now, please give me any guidance to rid out this problem.

What i have done,
i had problem in views_fusion, both views were cacheable, it shouldn't be. so i changed is_cacheable value of primary view from 1 to 0 manually, then it's working fine.

or you can add some line in views.module line no. 2143


  function views_form_alter($form_id, &$form) {
  if ($form_id == 'profile_field_form') {
     
    views_invalidate_cache();
  }
+  if ($form_id == 'search_theme_form') {
 + views_invalidate_cache();
 + }
}

 

Kamlesh Patidar

soyo’s picture

Hi, Kamlesh Patidar

I changed the cache.inc file.

function cache_set($cid, $table = 'cache', $data, $expire = CACHE_PERMANENT, $headers = NULL) {

  + $serialized = 0;
  + if (is_object($data) || is_array($data)) {
  +   $data = serialize($data);
  +  $serialized = 1;
  + }

  db_lock_table($table);
  db_query("UPDATE {". $table. "} SET data = %b, created = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", $data, time(), $expire, $headers, $serialized, $cid);
  if (!db_affected_rows()) {
    @db_query("INSERT INTO {". $table. "} (cid, data, created, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', '%d')", $cid, $data, time(), $expire, $headers, $serialized);
  }
  db_unlock_tables();
}
function cache_get($key, $table = 'cache') {
  global $user;

  // Garbage collection necessary when enforcing a minimum cache lifetime
  $cache_flush = variable_get('cache_flush', 0);
  if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) {
    // Reset the variable immediately to prevent a meltdown in heavy load situations.
    variable_set('cache_flush', 0);
    // Time to flush old cache data
    db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush);
  }

  $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {". $table ."} WHERE cid = '%s'", $key));
  if (isset($cache->data)) {
    // If the data is permanent or we're not enforcing a minimum cache lifetime
    // always return the cached data.
    if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime', 0)) {
      $cache->data = db_decode_blob($cache->data);

      + if ($cache->serialized) {
      + $cache->data = unserialize($cache->data);
      + }

    }
    // If enforcing a minimum cache lifetime, validate that the data is
    // currently valid for this user before we return it by making sure the
    // cache entry was created before the timestamp in the current session's
    // cache timer. The cache variable is loaded into the $user object by
    // sess_read() in session.inc.
    else {
      if ($user->cache > $cache->created) {
        // This cache data is too old and thus not valid for us, ignore it.
        return 0;
      }
      else {
        $cache->data = db_decode_blob($cache->data);
      }
    }
    return $cache;
  }
  return 0;
}

All my problems were caused by that the serialize and unserialize functions were missed in some place, what I did was add them back.
I hope this can help you!

kamleshpatidar’s picture

hi soyo,

Thanks for reply. you suggest that i did it before , but it was not clicked for me, so i changed according to my previous comment, & cache page was not working just because of token authentication module's init() function, so i change that function & now my Website on Drupal 5.10 is working fine without issue till now . once again Thanks

Kamlesh Patidar