[Mediawiki-l] Wiki Markup: Internal/External Link Question

Alistair Johnson JohnsonA at rembrandt.co.nz
Thu May 19 20:35:30 UTC 2005


Thanks Brion, I should have considered that.  Rather than changing the
codebase any more than I have done already I'll use a custom tag to force a
refresh of the few pages where we use {{SERVER}}.

I forget who shared this snippet of code originally, but it's a goodie:

$wgExtensionFunctions[] = "wfForceRefresh";

function wfForceRefresh() {
    global $wgParser;
    $wgParser->setHook( "forcerefresh", "renderForceRefresh" );
}

function renderForceRefresh( $input )
{
  global $wgTitle;
  $ts = mktime();
  $now = gmdate("YmdHis", $ts + 120);
  $ns = $wgTitle->getNamespace();
  $ti = wfStrencode($wgTitle->getDBkey());
  $sql = "UPDATE cur SET cur_touched='$now' WHERE cur_namespace=$ns AND
cur_title='$ti'";
  wfQuery($sql, DB_WRITE, 'wfForceRefresh');
  return "";
}

Al.

-----Original Message-----
From: Brion Vibber [mailto:brion at pobox.com] 
Sent: Thursday, 19 May 2005 7:00 p.m.
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] Wiki Markup: Internal/External Link Question

Alistair Johnson wrote:
> That's brilliant - thanks Rick.  Our wiki is accessible internally via
HTTP
> and externally via HTTPS and this was causing problems for us creating
links
> to functions on the same server but outside the wiki.  {{SERVER}} solves
> that problem nicely :-)

This may cause internal caching problems if the parser cache is on
(default in 1.4 and higher is on), since the rendered HTML will be saved
and served out again to other visitors with the same preferences.

To make sure incorrect pages aren't served, either disable the parser
cache ($wgEnableParserCache = false) or hack up
User::getPageRenderingHash() to include an HTTP vs HTTPS marker.

-- brion vibber (brion @ pobox.com)



More information about the MediaWiki-l mailing list