26use Psr\Log\LoggerAwareInterface;
27use Psr\Log\LoggerInterface;
28use Psr\Log\NullLogger;
57 $this->resourceloader = $rl;
58 $this->logger =
$logger ?:
new NullLogger();
59 $this->wanCache = ObjectCache::getMainWANInstance();
80 return $blobs[$module->
getName()];
98 $cache->makeKey( __CLASS__ )
101 foreach (
$modules as $name => $module ) {
103 $cacheKeys[
$name] = $cacheKey;
105 $checkKeys[$cacheKey][] =
$cache->makeKey( __CLASS__, $name );
108 $result =
$cache->getMulti( array_values( $cacheKeys ), $curTTLs, $checkKeys );
111 foreach (
$modules as $name => $module ) {
112 $key = $cacheKeys[
$name];
113 if ( !isset( $result[$key] ) || $curTTLs[$key] ===
null || $curTTLs[$key] < 0 ) {
117 $blobs[
$name] = $result[$key];
140 return $this->wanCache->makeKey( __CLASS__, $module->
getName(),
$lang,
157 $cache::TTL_WEEK + mt_rand( 0, $cache::TTL_DAY ),
171 foreach ( $moduleNames as $moduleName ) {
173 $this->wanCache->touchCheckKey( $this->wanCache->makeKey( __CLASS__, $moduleName ) );
195 if ( $this->resourceloader ===
null ) {
196 $this->logger->warning( __CLASS__ .
' created without a ResourceLoader instance' );
210 $value = $message->plain();
211 if ( !$message->exists() ) {
212 $this->logger->warning(
'Failed to find {messageKey} ({lang})', [
213 'messageKey' => $key,
233 $json = FormatJson::encode( (
object)
$messages );
235 if ( $json ===
false ) {
236 $this->logger->warning(
'Failed to encode message blob for {module} ({lang})', [
237 'module' => $module->
getName(),
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
This class generates message blobs for use by ResourceLoader modules.
getBlobs(array $modules, $lang)
Get the message blobs for a set of modules.
fetchMessage( $key, $lang)
generateMessageBlob(ResourceLoaderModule $module, $lang)
Generate the message blob for a given module in a given language.
recacheMessageBlob( $cacheKey, ResourceLoaderModule $module, $lang)
getBlob(ResourceLoaderModule $module, $lang)
Get the message blob for a module.
__construct(ResourceLoader $rl=null, LoggerInterface $logger=null)
setLogger(LoggerInterface $logger)
clear()
Invalidate cache keys for all known modules.
updateMessage( $key)
Invalidate cache keys for modules using this message key.
makeCacheKey(ResourceLoaderModule $module, $lang)
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
getMessages()
Get the messages needed for this module.
getName()
Get this module's name.
Dynamic JavaScript and CSS resource loading system.
Multi-datacenter aware caching interface.
touchCheckKey( $key, $holdoff=self::HOLDOFF_TTL)
Purge a "check" key from all datacenters, invalidating keys that use it.
set( $key, $value, $ttl=0, array $opts=[])
Set the value of a key in cache.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
Allows to change the fields on the form that will be generated $name
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext such as when responding to a resource loader request or generating HTML output & $resourceLoader
if(!isset( $args[0])) $lang