[Mediawiki-l] Caching is making me crazy...

Jan Steinman Jan at Bytesmiths.com
Fri Feb 18 04:34:28 UTC 2005

I'm playing with extensions, but am having trouble seeing the results.

How can I mark an article as "dirty" in an extension, so it will 
refresh every time?

Here's my extension, using the Unix fortune(6) command, which returns a 
random fortune each time, but when refreshed in a browser, I get the 
same one back each time. When I click "edit," I get new results, but 
when I refresh my browser, I do not. I even turned debugging on in the 
browser and made sure the browser cache was cleared. (It's taking 
enough time; it's obviously doing SOMETHING on the server.)

Another odd thing happens: if I use system() or passthru(), the fortune 
DOES refresh, but it prints at the top of the window, rather than 
inside the content area. When I tried shell_exec(), it puts the same 
old fortune in the content area each time!

$wgExtensionFunctions[] = 'wfFortune';

function wfFortune() {
      global $wgParser;
      $wgParser->setHook('fortune', 'renderFortune');

function renderFortune($input) {
     $output = "<p><i>";
     $output .= shell_exec('/sw/bin/fortune');
     $output .= '</i></p>';
     return $output;

:::: We in America today are nearer to the final triumph over poverty 
than ever before in the history of any land. -- Herbert Hoover, 1928
:::: Jan Steinman <http://www.Bytesmiths.com>

More information about the MediaWiki-l mailing list