Does anyone know if Preview mode circumvents cached macros? I am wondering, if I have all my macros set to a cache rate of say, 10 minutes, and I save and preview a page invoking these macros, will brand new content show up on the page in Preview mode?
/// <summary> /// Returns the cached version of this macro either as a string or as a Control /// </summary> /// <param name="macroHtml"></param> /// <param name="macroControl"></param> /// <returns></returns> /// <remarks> /// Depending on the type of macro, this will return the result as a string or as a control. This also /// checks to see if preview mode is activated, if it is then we don't return anything from cache. /// </remarks> private void GetMacroFromCache(out string macroHtml, out Control macroControl) { macroHtml = null; macroControl = null;
if (UmbracoContext.Current.InPreviewMode == false && Model.CacheDuration > 0) {
So... would say that the entire macro cache is bypassed when previewing.
Just found out that although getting a macro from cache is not done in preview mode, the result of the macro is always cached, regardless of preview mode. So if you save and preview a page containing cached macros you will see the result of these macros on the live pages as well. This way non-published content can end up on your live website.
I tested and verified this in the 6.1.6 source code.
@Sandor: had a hard time believing what you wrote. Checked the code. And... looks like you're right. Don't even understand how that's possible. Will check again and create appropriate issue in YouTrack, and fix.
Macro Caching and Preview
Does anyone know if Preview mode circumvents cached macros? I am wondering, if I have all my macros set to a cache rate of say, 10 minutes, and I save and preview a page invoking these macros, will brand new content show up on the page in Preview mode?
Thanks,
Garrett
Hi Garrett,
Excellent question - my immediate guess would be that they are separate - but who knows? I'll try to dig up an answer...
/Chriztian
From the 6.1 source,
So... would say that the entire macro cache is bypassed when previewing.
Stephan
Nice one! The results of my testing indicated the same. Thanks to both you and Chriztian!
Hi,
Just found out that although getting a macro from cache is not done in preview mode, the result of the macro is always cached, regardless of preview mode. So if you save and preview a page containing cached macros you will see the result of these macros on the live pages as well. This way non-published content can end up on your live website.
I tested and verified this in the 6.1.6 source code.
Sandor
@Sandor: had a hard time believing what you wrote. Checked the code. And... looks like you're right. Don't even understand how that's possible. Will check again and create appropriate issue in YouTrack, and fix.
Stephan
This still seems to be an issue in 6.2.4. Here is the link on issues.umbraco.org:
http://issues.umbraco.org/issue/U4-5162
Let's get it voted up. It must be affecting a large number of installations. In the worst case, time-sensitive information may be leaking to live.
It doesn't look like this issue is assigned or due in any version yet.
@Stephen: is there anything you can do to help this gain some traction? It's becoming quite challenging to have to work around it.
This issue is also affecting my sites running 7.2.1. Can we please get a fix for this on the roadmap for next release?
Look like an issue has been reported but doesn't look like anyone is working on fixing it.
http://issues.umbraco.org/issue/U4-5162
thanks.
Fixed in 7.3.0 (see issue tracker).
is working on a reply...