On a past upgrade, I think it was 4.0.x (not 100% sure what version) to 4.3.1 the Editor has not reloaded the JS and images from CKEditor saved in sites/all/libraries. The editor was completely broken (all buttons) as something with the image sprites has changed.
Root cause is that Drupal .htaccess file send a 2 week cache expire header.
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
After the upgrade all CKEditors have been broken for about 2 weeks on client side. I fear this may happen again in future upgrades. I guess that CKEditor is not appending the css_js_query_string
url parameter to all ckeditor files what breaks the re-use of the cache clear feature used in core.
Example code:
$query_string = '?' . variable_get('css_js_query_string', '0');
I mark the case as critical as CKEditor becomes unusable for many weeks - until the client cache expires or users clear their browser cache manually. The problem here is they do not understand this.
Is this fixable in the module/ckeditor code?
Comment | File | Size | Author |
---|---|---|---|
#23 | interdiff_16-17.patch | 1.22 KB | vokiel |
| |||
#23 | ckeditor-cache-bust-2330515-17.patch | 3.33 KB | vokiel |
| |||
#16 | ckeditor-styles-config-cache-bust-2330515-16.patch | 2.49 KB | jwilson3 |
| |||
#13 | ckeditor-styles-config-cache-bust-2330515-13.patch | 2.42 KB | jwilson3 |
#1 | ckeditor-css-cache-buster-string.patch | 817 bytes | alcroito |
Comments
Comment #1
alcroito CreditAttribution: alcroito commentedIt's a bug in the CKEditor module in these lines of codes ckeditor.lib.inc
It shouldn't take only the first character of the cache buster CSS string, but rather the whole string.
Just replace that with.
Also attaching a patch (allthough not rolled against DEV version).
Comment #3
jcisio CreditAttribution: jcisio commentedI committed patch #1 because it is evident. But it won't fix the bigger problem, because all JS/CSS/images files in the CKEditor library don't use this cache buster. There are several issue about it and this one should be marked as duplicated.
I think the proper solution is a/ either introduce a cache buster in CKEditor library b/ use a universal solution such as prefixing the CKEditor library with a cache buster hash (but in this case we need to modify the Libraries module too).
Comment #4
hass CreditAttribution: hass commentedThanks for feedback. I'm not so deep in ckeditor itself, but cannot believe the developers have no solution implemented for this. I hoped you may missed to implement something in the module that allows a cache clear... Maybe there is something we are not aware of yet?
Comment #5
hass CreditAttribution: hass commentedJust found something we may use. See http://stackoverflow.com/questions/14940452/force-ckeditor-to-refresh-co...
And we can use drupal
into this value and we are done...
Comment #6
leymannxThanks #5 for that hint. I wrote a small custom module (Github Link) that sets
CKEDITOR.timestamp = +new Date
and by that forces only the freshest files to be loaded since it appends a unique timestamp query to my custom JS.Comment #7
larskleiner CreditAttribution: larskleiner commentedThanks @leymannx, your module fixes my CKEditor caching issue.
I couldn't get changes to my custom CKEditor plugin appear consistently but now they do.
Comment #9
natukSame here: leymannx's module from #6 fixes the problem.
Comment #10
milos.kroulik CreditAttribution: milos.kroulik commentedPlease note that module mentioned in #6 likely has serious issue: https://github.com/leymannx/drupal-ckeditor-timestamp/issues/2 Can you confirm, that enabling that module blocks Drupal batch operations?
Comment #11
milos.kroulik CreditAttribution: milos.kroulik commentedComment #12
leymannxI can't confirm this https://github.com/leymannx/drupal-ckeditor-timestamp/issues/2 issue. Batch operations, or deleting users work just fine. Anyways, you are supposed to have this module only activated during development.
Comment #13
jwilson3The fundamental error is that as web developers tweaking things, we cannot depend on the
CKEditor.timestamp
from the compiled version of the CKEditor library js file, because that value only changes when the library version is updated. Our configuration files change much more frequently than that, and should not depend on CKEditor's internal cache-busting mechanism, nor should developers need to hack CKEditor's timestamp functionality as proposed in #6, because Drupal has its own robust standard cache-busting system that we can use.The CKEditor module is already using the standard Drupal
css_js_query_string
in a couple of places, but not everywhere, so the patch here just completes the work to ensure that:1) ckeditor.config.js file is always cache-busted when Drupal css/js cache is cleared (instead of checking the file modification time on every page load).
2) ckeditor.styles.js file is always cache-busted when Drupal css/js cache is cleared (instead of depending on the CKEditor.timestamp from the compiled version of the Ckeditor library).
Note that the Drupal cache-busting mechanism used here (which adds
?XXXXX
to the end of the filename on the server side via php) does not interfere with CKEditor's own cache-busting method which adds&t=XXXX
to the end of the filename on client side (via js).Reviews appreciated!
Thanks.
Comment #14
jwilson3Comment #16
jwilson3Reroll to fix relative path so patch can apply.
Comment #17
llslim CreditAttribution: llslim commentedI tried the patch in [#12266257-12238240], and it worked for reloading the editor with new config
Comment #18
dat deaf drupaler CreditAttribution: dat deaf drupaler as a volunteer commentedI can confirm patch from #16 works, thank you!! Drove me insane trying to revise/test customising list of styles in ckeditor and flushing cache repeatedly to update the changes in drop-list.
Hats off to you, @jwilson3 !
Comment #19
trouble.tribbles CreditAttribution: trouble.tribbles as a volunteer commentedPatch #16 didn't have any effect for me but the module did.
Comment #20
TristanTheKnightAway CreditAttribution: TristanTheKnightAway commentedCKeditor Pro Tip:
If you have more than two classes assigned to elements in your ckeditor.styles.js file they need to be in alphabetical order to render.
This will work:
{ name: 'Alert Success', element: 'div', attributes: { 'class': 'alert alert--success' } },
This WILL NOT:
{ name: 'Alert Success', element: 'div', attributes: { 'class': 'alert--success alert' } },
because insanity.
Comment #21
ron_s CreditAttribution: ron_s commentedMight want to try this patch, which has already been committed for the WYSIWYG module, and essentially does the same thing for CKEditor: https://www.drupal.org/project/ckeditor/issues/2679179
It is also the approach used to fix the problem in Drupal 8: https://www.drupal.org/project/drupal/issues/2679903
Comment #22
ron_s CreditAttribution: ron_s commentedComment #23
vokielAttaching a new patch, since the one from #16 couldn't be applied.
Also, attaching interdiff (after changes from #16 applied manually).
Comment #25
vokielComment #26
vokiel