Index: branches/REL1_4/phase3/index.php |
— | — | @@ -31,10 +31,6 @@ |
32 | 32 | $action = $wgRequest->getVal( "action", "view" ); |
33 | 33 | $title = $wgRequest->getVal( "title" ); |
34 | 34 | |
35 | | -# Placeholders in case of DB error |
36 | | -$wgTitle = Title::newFromText( wfMsgForContent( "badtitle" ) ); |
37 | | -$wgArticle = new Article($wgTitle); |
38 | | - |
39 | 35 | $action = strtolower( trim( $action ) ); |
40 | 36 | if ($wgRequest->getVal( "printable" ) == "yes") { |
41 | 37 | $wgOut->setPrintable(); |
Index: branches/REL1_4/phase3/includes/MessageCache.php |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | var $mMemcKey, $mKeys, $mParserOptions, $mParser; |
25 | 25 | var $mExtensionMessages; |
26 | 26 | var $mInitialised = false; |
| 27 | + var $mDeferred = true; |
27 | 28 | |
28 | 29 | function initialise( &$memCached, $useDB, $expiry, $memcPrefix) { |
29 | 30 | $fname = 'MessageCache::initialise'; |
— | — | @@ -44,7 +45,12 @@ |
45 | 46 | $this->mParser = new Parser; |
46 | 47 | wfProfileOut( $fname.'-parser' ); |
47 | 48 | |
48 | | - $this->load(); |
| 49 | + # When we first get asked for a message, |
| 50 | + # then we'll fill up the cache. If we |
| 51 | + # can return a cache hit, this saves |
| 52 | + # some extra milliseconds |
| 53 | + $this->mDeferred = true; |
| 54 | + |
49 | 55 | wfProfileOut( $fname ); |
50 | 56 | } |
51 | 57 | |
— | — | @@ -113,6 +119,7 @@ |
114 | 120 | } |
115 | 121 | } |
116 | 122 | wfProfileOut( $fname ); |
| 123 | + $this->mDeferred = false; |
117 | 124 | return $success; |
118 | 125 | } |
119 | 126 | |
— | — | @@ -221,6 +228,10 @@ |
222 | 229 | if( !$this->mInitialised ) { |
223 | 230 | return "<$key>"; |
224 | 231 | } |
| 232 | + # If cache initialization was deferred, start it now. |
| 233 | + if( $this->mDeferred ) { |
| 234 | + $this->load(); |
| 235 | + } |
225 | 236 | |
226 | 237 | $message = false; |
227 | 238 | if( !$this->mDisable && $useDB ) { |
Index: branches/REL1_4/phase3/includes/Parser.php |
— | — | @@ -959,7 +959,9 @@ |
960 | 960 | wfProfileIn( $fname ); |
961 | 961 | |
962 | 962 | $sk =& $this->mOptions->getSkin(); |
963 | | - $linktrail = wfMsgForContent('linktrail'); |
| 963 | + global $wgContLang; |
| 964 | + $linktrail = $wgContLang->linkTrail(); |
| 965 | + |
964 | 966 | $bits = preg_split( EXT_LINK_BRACKETED, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); |
965 | 967 | |
966 | 968 | $s = $this->replaceFreeExternalLinks( array_shift( $bits ) ); |
Index: branches/REL1_4/phase3/includes/Setup.php |
— | — | @@ -358,7 +358,7 @@ |
359 | 359 | wfSeedRandom(); |
360 | 360 | |
361 | 361 | # Placeholders in case of DB error |
362 | | -$wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) ); |
| 362 | +$wgTitle = Title::makeTitle( NS_SPECIAL, 'Error' ); |
363 | 363 | $wgArticle = new Article($wgTitle); |
364 | 364 | |
365 | 365 | wfProfileOut( $fname.'-misc2' ); |
Index: branches/REL1_4/phase3/includes/Skin.php |
— | — | @@ -83,7 +83,8 @@ |
84 | 84 | /**#@-*/ |
85 | 85 | |
86 | 86 | function Skin() { |
87 | | - $this->linktrail = wfMsgForContent('linktrail'); |
| 87 | + global $wgContLang; |
| 88 | + $this->linktrail = $wgContLang->linkTrail(); |
88 | 89 | |
89 | 90 | # Cache option lookups done very frequently |
90 | 91 | $options = array( 'highlightbroken', 'hover' ); |
Index: branches/REL1_4/phase3/RELEASE-NOTES |
— | — | @@ -118,6 +118,7 @@ |
119 | 119 | * Allow customization of all UI languages |
120 | 120 | * use $wgForceUIMsgAsContentMsg to make regular UI messages act as content |
121 | 121 | * new user option for zh users to disable language conversion |
| 122 | +* Defer message cache initialization, shaving a few ms off file cache hits |
122 | 123 | |
123 | 124 | === Caveats === |
124 | 125 | |
Index: branches/REL1_4/phase3/languages/Language.php |
— | — | @@ -2229,6 +2229,20 @@ |
2230 | 2230 | function getExtraHashOptions() { |
2231 | 2231 | return array(); |
2232 | 2232 | } |
| 2233 | + |
| 2234 | + /** |
| 2235 | + * A regular expression to match legal word-trailing characters |
| 2236 | + * which should be merged onto a link of the form [[foo]]bar. |
| 2237 | + * FIXME |
| 2238 | + * |
| 2239 | + * @return string |
| 2240 | + * @access public |
| 2241 | + */ |
| 2242 | + function linkTrail() { |
| 2243 | + $trail = $this->getMessage( 'linktrail' ); |
| 2244 | + if( empty( $trail ) ) $trail = Language::linkTrail(); |
| 2245 | + return $trail; |
| 2246 | + } |
2233 | 2247 | } |
2234 | 2248 | |
2235 | 2249 | # This should fail gracefully if there's not a localization available |