Extension talk:MagicNoCache/Archive

problem with templates
Hi there! Great extension. I was wondering, is it possible to call somehow fix it to work through a template? Right now if I try to use __NOCACHE__ on a template it doesn't work. Instead, it just shows the text "__NOCACHE__". Is there a way around this? Thank you!

Acook 17:23, 10 December 2007 (UTC)

Part Solution
Hello,

I thought I fixed your problem but this is what I know so far...

It seems the text is checked before the template is processed, so only magic words on the main page is detected and not in the template. I used a different hook that will read the page after the templates has been processed.

So instead of using

use

then modify the function at the end too

The problem is that because everything has already been processed it is too late to disable the cache :(

I hope that helps. Feel free to fix, amend or improve my solution!


 * Awesome! That seemed to fix it.  Thanks for all of the help!  Acook 21:07, 10 December 2007 (UTC)


 * Doesn't work here (MW 1.15). I have a __NOCACHE__ in my template and the magic word is rendered in the output. Better use ParserBeforeTidy instead of InternalParseBeforeLinks
 * --Danwe 12:12, 7 October 2009 (UTC)

Undefined variable: action, on line 67 FIX
If you run PHP with out global variables on, you get the "Undefined variable" error.

In the function checkForMagicWord add $action to global: function checkForMagicWord(&$parser, &$text, &$strip_state) { global $wgOut, $action; $mw = MagicWord::get('MAG_NOCACHE'); #woohoo! we do! - now remove the word from the text if (!in_array($action, array('edit', 'submit')) && $mw->matchAndRemove($text)) { $parser->disableCache; $wgOut->enableClientCache(false); }   return true; } /Ubernissen 22:33, 13 February 2008 (UTC)

What about work on 1.12.0?
subj.

Unexpectet behavior in templates
Nice extension. I use it in 1.13 and it seems like it works! But I want to use it in templates. When I use it in themplates, it works for the template itself but then in the pages who use the template i see the magic word IN THE TEXT as "__NOCACHE__" and it has no effect. I think the right bevior should be that it works for the pages who includes the template so that it works like it is used directly in the pages. I also tried it with  __NOCACHE__  in the template but I got the same effect on the page. Hope you will fix that soon. Would be very nice! Thanks --77.191.214.151 20:25, 18 October 2008 (UTC)

Does not work on 1.13.2
But thanks for the effort..80.81.168.98 14:23, 16 January 2009 (UTC)


 * Is it still not working on 1.13.2? Has anyone tried it?  --Robinson Weijman 13:02, 28 July 2009 (UTC)
 * Well, I just have and it works. But - you need to put the __NOCACHE__ magic word in a hidden comment otherwise it appears on the screen.  --Robinson Weijman 14:22, 28 July 2009 (UTC)
 * Um, or maybe not. Without __NOCACHE__ it also "works"... --Robinson Weijman 14:35, 28 July 2009 (UTC)
 * Using Fix for 14.x below this does work. --Robinson Weijman 09:10, 29 July 2009 (UTC)

Doesn't work on 1.15
This extension doesn't work on mediawiki svn head as of this date. --67.172.156.33 22:04, 14 February 2009 (UTC)

FIX for MediaWiki 1.14.x
Apparently $wgRequest is no longer invoked after editing on MW 1.14.x. I tested this on MW 1.14.0 and it works as intended (all I did was change $wgRequest to $wgAction):

I hope this helps. Anyone wants to try this on 1.15.x ? (I don't have time to play around with the SVN version)
 * Works in 1.15 for me --Danwe 12:13, 7 October 2009 (UTC)

I made the same change at it works for MediaWiki 1.13.4 Wolcott 18:03, 7 April 2009 (UTC)

I made that change too and it worked for MediaWiki 1.12.0. --83.34.73.184 17:23, 6 July 2009 (UTC)

Works for 1.13.2 --Robinson Weijman 09:10, 29 July 2009 (UTC)

I've merged these changes into the code on this page. GreenReaper 20:49, 17 October 2009 (UTC)

SVN
put the newest version into my Wikis SVN

https://wecowi.svn.sourceforge.net/svnroot/wecowi/trunk/extensions/MagicNoCache

--DaSch 15:40, 2 October 2009 (UTC)


 * Why don't you add a version number to this new version and also add the code discussed above under Part Solution? --Danwe 12:21, 7 October 2009 (UTC)