$wgMsgCacheExpiry
);
}
+
return self::$instance;
}
}
/**
- * @param ObjectCache $memCached A cache instance. If none, fall back to CACHE_NONE.
+ * @param BagOStuff $memCached A cache instance. If none, fall back to CACHE_NONE.
* @param bool $useDB
* @param int $expiry Lifetime for cache. @see $mExpiry.
*/
$this->mParserOptions = new ParserOptions;
$this->mParserOptions->setEditSection( false );
}
+
return $this->mParserOptions;
}
$serialized .= fread( $file, 100000 );
}
fclose( $file );
+
return unserialize( $serialized );
} else {
fclose( $file );
+
return false; // Wrong hash
}
}
if ( !$file ) {
wfDebug( "Unable to open local cache file for writing\n" );
+
return;
}
wfDebug( __METHOD__ . ": disabled\n" );
$shownDisabled = true;
}
+
return true;
}
$info = implode( ', ', $where );
wfDebug( __METHOD__ . ": Loading $code... $info\n" );
wfProfileOut( __METHOD__ );
+
return $success;
}
$cache['VERSION'] = MSG_CACHE_VERSION;
$cache['EXPIRY'] = wfTimestamp( TS_MW, time() + $this->mExpiry );
wfProfileOut( __METHOD__ );
+
return $cache;
}
if ( $this->mDisable ) {
wfProfileOut( __METHOD__ );
+
return;
}
if ( wfTimestampNow() >= $cache['EXPIRY'] ) {
return true;
}
+
return false;
}
}
wfProfileOut( __METHOD__ );
+
return $success;
}
* "msg/lang".
*
* @throws MWException when given an invalid key
- * @return string|bool False if the message doesn't exist, otherwise the message (which can be empty)
+ * @return string|bool False if the message doesn't exist, otherwise the
+ * message (which can be empty)
*/
function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
global $wgContLang;
// Loop through each language in the fallback list until we find something useful
$lang = wfGetLangObj( $langcode );
- $message = $this->getMessageFromFallbackChain( $lang, $lckey, $uckey, !$this->mDisable && $useDB );
+ $message = $this->getMessageFromFallbackChain(
+ $lang,
+ $lckey,
+ $uckey,
+ !$this->mDisable && $useDB
+ );
// If we still have no message, maybe the key was in fact a full key so try that
if ( $message === false ) {
return $message;
}
- list( $fallbackChain, $siteFallbackChain ) = Language::getFallbacksIncludingSiteLanguage( $langcode );
+ list( $fallbackChain, $siteFallbackChain ) =
+ Language::getFallbacksIncludingSiteLanguage( $langcode );
// Next try checking the database for all of the fallback languages of the requested language.
if ( $useDB ) {
if ( $entry ) {
if ( substr( $entry, 0, 1 ) === ' ' ) {
$this->mCache[$code][$title] = $entry;
+
// The message exists, so make sure a string
// is returned.
return (string)substr( $entry, 1 );
} elseif ( $entry === '!NONEXISTENT' ) {
$this->mCache[$code][$title] = '!NONEXISTENT';
+
return false;
} else {
# Corrupt/obsolete entry, delete it
$this->mInParser = false;
$popts->setUserLang( $userlang );
}
+
return $message;
}
$this->mParser = clone $wgParser;
}
}
+
return $this->mParser;
}
$this->mInParser = false;
wfProfileOut( __METHOD__ );
+
return $res;
}
}
$message = implode( '/', $pieces );
+
return array( $message, $lang );
}
unset( $cache['EXPIRY'] );
// Remove any !NONEXISTENT keys
$cache = array_diff( $cache, array( '!NONEXISTENT' ) );
+
// Keys may appear with a capital first letter. lcfirst them.
return array_map( array( $wgContLang, 'lcfirst' ), array_keys( $cache ) );
}