dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Made some FileBackendMultiWrite docs more accurate"
[lhc/web/wiklou.git]
/
languages
/
LanguageConverter.php
diff --git
a/languages/LanguageConverter.php
b/languages/LanguageConverter.php
index
43d6063
..
7879309
100644
(file)
--- a/
languages/LanguageConverter.php
+++ b/
languages/LanguageConverter.php
@@
-355,12
+355,7
@@
class LanguageConverter {
2. HTML entities
3. placeholders created by the parser
*/
2. HTML entities
3. placeholders created by the parser
*/
- global $wgParser;
- if ( isset( $wgParser ) && $wgParser->UniqPrefix() != '' ) {
- $marker = '|' . $wgParser->UniqPrefix() . '[\-a-zA-Z0-9]+';
- } else {
- $marker = '';
- }
+ $marker = '|' . Parser::MARKER_PREFIX . '[\-a-zA-Z0-9]+';
// this one is needed when the text is inside an HTML markup
$htmlfix = '|<[^>]+$|^[^<>]*>';
// this one is needed when the text is inside an HTML markup
$htmlfix = '|<[^>]+$|^[^<>]*>';
@@
-507,13
+502,9
@@
class LanguageConverter {
}
if ( $action == 'add' ) {
}
if ( $action == 'add' ) {
+ // More efficient than array_merge(), about 2.5 times.
foreach ( $pair as $from => $to ) {
foreach ( $pair as $from => $to ) {
- // to ensure that $from and $to not be left blank
- // so $this->translate() could always return a string
- if ( $from || $to ) {
- // more efficient than array_merge(), about 2.5 times.
- $this->mTables[$variant]->setPair( $from, $to );
- }
+ $this->mTables[$variant]->setPair( $from, $to );
}
} elseif ( $action == 'remove' ) {
$this->mTables[$variant]->removeArray( $pair );
}
} elseif ( $action == 'remove' ) {
$this->mTables[$variant]->removeArray( $pair );
@@
-842,7
+833,7
@@
class LanguageConverter {
* @param bool $fromCache Load from memcached? Defaults to true.
*/
function loadTables( $fromCache = true ) {
* @param bool $fromCache Load from memcached? Defaults to true.
*/
function loadTables( $fromCache = true ) {
- global $wgLang
ConvMemc
;
+ global $wgLang
uageConverterCacheType
;
if ( $this->mTablesLoaded ) {
return;
if ( $this->mTablesLoaded ) {
return;
@@
-850,9
+841,10
@@
class LanguageConverter {
$this->mTablesLoaded = true;
$this->mTables = false;
$this->mTablesLoaded = true;
$this->mTables = false;
+ $cache = ObjectCache::getInstance( $wgLanguageConverterCacheType );
if ( $fromCache ) {
wfProfileIn( __METHOD__ . '-cache' );
if ( $fromCache ) {
wfProfileIn( __METHOD__ . '-cache' );
- $this->mTables = $
wgLangConvMemc
->get( $this->mCacheKey );
+ $this->mTables = $
cache
->get( $this->mCacheKey );
wfProfileOut( __METHOD__ . '-cache' );
}
if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) {
wfProfileOut( __METHOD__ . '-cache' );
}
if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) {
@@
-869,7
+861,7
@@
class LanguageConverter {
$this->postLoadTables();
$this->mTables[self::CACHE_VERSION_KEY] = true;
$this->postLoadTables();
$this->mTables[self::CACHE_VERSION_KEY] = true;
- $
wgLangConvMemc
->set( $this->mCacheKey, $this->mTables, 43200 );
+ $
cache
->set( $this->mCacheKey, $this->mTables, 43200 );
wfProfileOut( __METHOD__ . '-recache' );
}
}
wfProfileOut( __METHOD__ . '-recache' );
}
}
@@
-1000,7
+992,7
@@
class LanguageConverter {
if ( $recursive ) {
foreach ( $sublinks as $link ) {
$s = $this->parseCachedTable( $code, $link, $recursive );
if ( $recursive ) {
foreach ( $sublinks as $link ) {
$s = $this->parseCachedTable( $code, $link, $recursive );
- $ret =
array_merge( $ret, $s )
;
+ $ret =
$s + $ret
;
}
}
}
}