2

I have a Drupal 6 site running with multi language support. When I translate a node and get redirected to the newly translated node only the headline is visible. If I flush the cache using the administration tools I can see the rest of the node.

Why is this happening and I how do I prevent it? I feel like I have tried everything! For example trying:

  drupal_flush_all_caches(); 
  cache_clear_all();
  cache_clear_all('*', 'cache', TRUE);
  cache_clear_all('*', 'cache_content', TRUE);
  cache_clear_all('*', 'cache_page', TRUE);
  cache_clear_all('*', 'cache_menu', TRUE);
  cache_clear_all('*', 'cache_filter', TRUE);
  cache_clear_all('*', 'cache_views', TRUE);
  cache_clear_all('*', 'cache_views_data', TRUE);
  cache_clear_all('*', 'cache_update', TRUE);
  cache_clear_all('*', 'cache_block', TRUE);
  cache_clear_all('*', 'cache_form', TRUE);

Using function mymodule_node_form_submit($form, &$form_state) and function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL). I have verified that both hooks works using Devel.

I have also tried looking into the cache tables to try and figure out which rows change when flushing the caching using the administration tools, but without luck.

UPDATE JULY 18: Even if I turn off the cache I cannot see the translated node before I flush the cache. How is this even possible?

UPDATE JULY 18 PT2: I think I have found the problem. In the table cache_content a row called e.g. content:1269:1270 got the value(data) a:0:{}. If I delete this row the text appears. To me it seems that it does not cache the new translation correctly, and thus saving an empty cache which makes the translated node empty. But how do I solve this? Even with db_query('DELETE FROM cache_content'); in the submit hook the row gets created.

Thanks in advance.

  • Are you positive your browser is not caching the page? – mpdonadio Jul 18 '12 at 10:42
  • Yes. When translating a node and viewing it in another browser or computer the cache still needs to be flushed before the text shows up. – user1855 Jul 18 '12 at 11:05
  • Note in regards to the first update: The cache setting only affects the complete page cache for anon users. Drupal will still cache a lot of things if that setting is disabled and would be unusable slow if it wouldn't. – Berdir Jul 18 '12 at 22:06
1

Run the cache clear in a shutdown function. A little bit of a hack but it should work.

<?php
register_shutdown_function('cache_clear_all', 'content:' . $node->nid . ':', content_cache_tablename(), TRUE);
?>

Taken from content_delete()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy