node caching issues

delykj - November 26, 2008 - 00:16
Project:FLV Media Player
Version:6.x-1.0-beta3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

The flvmediaplayer_profile_edit_form_submit function not correctly clears the cache table.
You call this:
cache_clear_all('%'. $form_values['name'], 'cache_flvmediaplayer', true);

But this doesn't do anything, because in the cache_flvmediaplayer table there are items like this:
"flvmp_112_d41d8cd98f00b204e9800998ecf8427e"

I fixed this temporary by this change in flvmediaplayer_profiles.inc:
change:

cache_clear_all('%'. $form_values['name'], 'cache_flvmediaplayer', true);

into:
cache_clear_all('*', 'cache_flvmediaplayer', true);

Need a better solution.

#1

arthurf - March 30, 2009 - 19:57

Actually, in the dev release its:

<?php
cache_clear_all
('flvmp_%'. $data['flvmp_profile_name'], 'cache_flvmediaplayer', true);
?>

which should take care of the issue. I haven't written the migration script to take your current configurations to the dev version configuration options which is the part that is still out standing.

#2

mrfelton - April 2, 2009 - 17:02
Version:5.x-4.x-dev» 6.x-1.0-beta3

I find that no matter what changes I make to my profile, the node outputs the player the same. Looking at the cache_flvmediaplayer, I can see that it has an entry in there for my node, and it is not getting updated when I:

a) alter the player profile
b) edit the node
c) flush all my caches using the devel module.

Infact, I can find no way to clear that cache out at all.

#3

mrfelton - April 2, 2009 - 17:14

It seems that the cache has been stored without the profile_id appended.

The name of my profile is 'default'.
The cache entry has an id of 'flvmp_1_'
I think it should actually be 'flvmp_1_default'

Because in flvmediaplayer_profile_edit_form_submit() you call:

cache_clear_all('flvmp_%'. $data['name'], 'cache_flvmediaplayer', true);

where $data['name'] holds the name of the profile ('default' in my case).

So the question is... why is the cache being saved without the profile id appended?

#4

mrfelton - April 2, 2009 - 17:29
Status:active» needs review

I think the problem was that you were not passing the profile_id to the theming function when embedding the player in hook_nodeapi

on line 131, I changed:

          if ($node->flvmediaplayer_config['player_node_body'] || ($a3 && $node->flvmediaplayer_config['embed_teaser'] )) {
            flvmediaplayer_insert_player($node, theme('flvmediaplayer_display', $node));
          }

to:

          if ($node->flvmediaplayer_config['player_node_body'] || ($a3 && $node->flvmediaplayer_config['embed_teaser'] )) {
            flvmediaplayer_insert_player($node, theme('flvmediaplayer_display', $node, $node->flvmediaplayer_config['embed_profile']));
          }

and all seems good now (with limited testing). Patch attached.

AttachmentSize
flvmediaplayer-clear-cache.patch 782 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.