Extension talk:MagicNoCache/Archive

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)

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)

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)