$called = true;
if($this->isFileCacheable()) {
$touched = $this->mTouched;
- if( $this->mTitle->getPrefixedDBkey() == wfMsg( 'mainpage' ) ) {
- # Expire the main page quicker
- $expire = wfUnix2Timestamp( time() - 3600 );
- $touched = max( $expire, $touched );
- }
$cache = new CacheManager( $this->mTitle );
if($cache->isFileCacheGood( $touched )) {
global $wgOut;
var $mMemcKey, $mKeys, $mParserOptions, $mParser;
var $mExtensionMessages;
var $mInitialised = false;
+ var $mDeferred = true;
function initialise( &$memCached, $useDB, $expiry, $memcPrefix) {
$fname = 'MessageCache::initialise';
$this->mParser = new Parser;
wfProfileOut( $fname.'-parser' );
- $this->load();
+ # When we first get asked for a message,
+ # then we'll fill up the cache. If we
+ # can return a cache hit, this saves
+ # some extra milliseconds
+ $this->mDeferred = true;
+
wfProfileOut( $fname );
}
}
}
wfProfileOut( $fname );
+ $this->mDeferred = false;
return $success;
}
if( !$this->mInitialised ) {
return "<$key>";
}
+ # If cache initialization was deferred, start it now.
+ if( $this->mDeferred ) {
+ $this->load();
+ }
$message = false;
if( !$this->mDisable && $useDB ) {
wfProfileIn( $fname );
$sk =& $this->mOptions->getSkin();
- $linktrail = wfMsgForContent('linktrail');
+ global $wgContLang;
+ $linktrail = $wgContLang->linkTrail();
+
$bits = preg_split( EXT_LINK_BRACKETED, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
$s = $this->replaceFreeExternalLinks( array_shift( $bits ) );
wfSeedRandom();
# Placeholders in case of DB error
-$wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
+$wgTitle = Title::makeTitle( NS_SPECIAL, 'Error' );
$wgArticle = new Article($wgTitle);
wfProfileOut( $fname.'-misc2' );
/**#@-*/
function Skin() {
- $this->linktrail = wfMsgForContent('linktrail');
+ global $wgContLang;
+ $this->linktrail = $wgContLang->linkTrail();
# Cache option lookups done very frequently
$options = array( 'highlightbroken', 'hover' );
$action = $wgRequest->getVal( "action", "view" );
$title = $wgRequest->getVal( "title" );
-# Placeholders in case of DB error
-$wgTitle = Title::newFromText( wfMsgForContent( "badtitle" ) );
-$wgArticle = new Article($wgTitle);
-
$action = strtolower( trim( $action ) );
if ($wgRequest->getVal( "printable" ) == "yes") {
$wgOut->setPrintable();
function getExtraHashOptions() {
return array();
}
+
+ /**
+ * A regular expression to match legal word-trailing characters
+ * which should be merged onto a link of the form [[foo]]bar.
+ * FIXME
+ *
+ * @return string
+ * @access public
+ */
+ function linkTrail() {
+ $trail = $this->getMessage( 'linktrail' );
+ if( empty( $trail ) ) $trail = Language::linkTrail();
+ return $trail;
+ }
}