dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b6f4bb6
)
* Defer message cache initialization, shaving a few ms off file cache hits
author
Brion Vibber
<brion@users.mediawiki.org>
Thu, 9 Dec 2004 05:51:20 +0000
(
05:51
+0000)
committer
Brion Vibber
<brion@users.mediawiki.org>
Thu, 9 Dec 2004 05:51:20 +0000
(
05:51
+0000)
includes/Article.php
patch
|
blob
|
history
includes/MessageCache.php
patch
|
blob
|
history
includes/Parser.php
patch
|
blob
|
history
includes/Setup.php
patch
|
blob
|
history
includes/Skin.php
patch
|
blob
|
history
index.php
patch
|
blob
|
history
languages/Language.php
patch
|
blob
|
history
diff --git
a/includes/Article.php
b/includes/Article.php
index
0ad959c
..
42a368f
100644
(file)
--- a/
includes/Article.php
+++ b/
includes/Article.php
@@
-1956,11
+1956,6
@@
class Article {
$called = true;
if($this->isFileCacheable()) {
$touched = $this->mTouched;
$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;
$cache = new CacheManager( $this->mTitle );
if($cache->isFileCacheGood( $touched )) {
global $wgOut;
diff --git
a/includes/MessageCache.php
b/includes/MessageCache.php
index
8d868ec
..
714f462
100755
(executable)
--- a/
includes/MessageCache.php
+++ b/
includes/MessageCache.php
@@
-23,6
+23,7
@@
class MessageCache
var $mMemcKey, $mKeys, $mParserOptions, $mParser;
var $mExtensionMessages;
var $mInitialised = false;
var $mMemcKey, $mKeys, $mParserOptions, $mParser;
var $mExtensionMessages;
var $mInitialised = false;
+ var $mDeferred = true;
function initialise( &$memCached, $useDB, $expiry, $memcPrefix) {
$fname = 'MessageCache::initialise';
function initialise( &$memCached, $useDB, $expiry, $memcPrefix) {
$fname = 'MessageCache::initialise';
@@
-44,7
+45,12
@@
class MessageCache
$this->mParser = new Parser;
wfProfileOut( $fname.'-parser' );
$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 );
}
@@
-113,6
+119,7
@@
class MessageCache
}
}
wfProfileOut( $fname );
}
}
wfProfileOut( $fname );
+ $this->mDeferred = false;
return $success;
}
return $success;
}
@@
-221,6
+228,10
@@
class MessageCache
if( !$this->mInitialised ) {
return "<$key>";
}
if( !$this->mInitialised ) {
return "<$key>";
}
+ # If cache initialization was deferred, start it now.
+ if( $this->mDeferred ) {
+ $this->load();
+ }
$message = false;
if( !$this->mDisable && $useDB ) {
$message = false;
if( !$this->mDisable && $useDB ) {
diff --git
a/includes/Parser.php
b/includes/Parser.php
index
0e911d6
..
17c52ad
100644
(file)
--- a/
includes/Parser.php
+++ b/
includes/Parser.php
@@
-959,7
+959,9
@@
class Parser
wfProfileIn( $fname );
$sk =& $this->mOptions->getSkin();
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 ) );
$bits = preg_split( EXT_LINK_BRACKETED, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
$s = $this->replaceFreeExternalLinks( array_shift( $bits ) );
diff --git
a/includes/Setup.php
b/includes/Setup.php
index
d609498
..
aa9fa0d
100644
(file)
--- a/
includes/Setup.php
+++ b/
includes/Setup.php
@@
-358,7
+358,7
@@
$wgMsgParserOptions = ParserOptions::newFromUser($wgUser);
wfSeedRandom();
# Placeholders in case of DB error
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' );
$wgArticle = new Article($wgTitle);
wfProfileOut( $fname.'-misc2' );
diff --git
a/includes/Skin.php
b/includes/Skin.php
index
c114af1
..
4978cdb
100644
(file)
--- a/
includes/Skin.php
+++ b/
includes/Skin.php
@@
-83,7
+83,8
@@
class Skin {
/**#@-*/
function Skin() {
/**#@-*/
function Skin() {
- $this->linktrail = wfMsgForContent('linktrail');
+ global $wgContLang;
+ $this->linktrail = $wgContLang->linkTrail();
# Cache option lookups done very frequently
$options = array( 'highlightbroken', 'hover' );
# Cache option lookups done very frequently
$options = array( 'highlightbroken', 'hover' );
diff --git
a/index.php
b/index.php
index
1de2977
..
5486408
100644
(file)
--- a/
index.php
+++ b/
index.php
@@
-31,10
+31,6
@@
OutputPage::setEncodings(); # Not really used yet
$action = $wgRequest->getVal( "action", "view" );
$title = $wgRequest->getVal( "title" );
$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();
$action = strtolower( trim( $action ) );
if ($wgRequest->getVal( "printable" ) == "yes") {
$wgOut->setPrintable();
diff --git
a/languages/Language.php
b/languages/Language.php
index
cf4c1ea
..
87c67c3
100644
(file)
--- a/
languages/Language.php
+++ b/
languages/Language.php
@@
-2230,6
+2230,20
@@
class Language {
function getExtraHashOptions() {
return array();
}
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;
+ }
}
}