When programatically adjusting fckeditor profiles (for example when using install profiles, or scripting site updates) it is often necessary to save and load fckeditor profiles through code.
Consider this scenario :
1. update hook 1 updates the fckeditor profile to add something to it, it first loads the profile with fckeditor_load_profile.
2. the same hook makes its changes and saves the profile with fckeditor_save_profile
3. A different hook then wishes to update the profile again. It loads the profile with fckeditor_load_profile BUT because this function maintains a static variable (cache) the origional profile is returned (the same profile returned in step1 and not the updated profile we saved in step2).
Suggested solution - add the ability to "reset" the static variable in the profile_load function, and then call this reset in the profile_save function.
Comment | File | Size | Author |
---|---|---|---|
#2 | clearstatic.patch | 2.06 KB | Artur Formella |
Comments
Comment #1
Artur Formella CreditAttribution: Artur Formella commentedComment #2
Artur Formella CreditAttribution: Artur Formella commentedAfter patching some functions will have a new parameter:
function fckeditor_profile_load($name='', $clear = FALSE);
function fckeditor_user_get_profile($user, $clear = FALSE);
function fckeditor_sorted_roles($clear = FALSE);
Idea of this patch:
$profiles = fckeditor_profile_load();
/*
save some profile
*/
$profiles1 = fckeditor_profile_load(); // $profiles1=$profiles
$profiles2 = fckeditor_profile_load('', FALSE); // $profiles2=$profiles
$profiles3 = fckeditor_profile_load('', TRUE); // now $profiles3 is correct
Comment #3
Jorrit CreditAttribution: Jorrit commentedLooks good to me
Comment #4
Jorrit CreditAttribution: Jorrit commentedFixed in 5.x-2.x, 6.x-1.x and 6.x-2.x.