MediaWiki  master
ResourceLoaderModule.php
Go to the documentation of this file.
1 <?php
31 
35 abstract class ResourceLoaderModule implements LoggerAwareInterface {
36  # Type of resource
37  const TYPE_SCRIPTS = 'scripts';
38  const TYPE_STYLES = 'styles';
39  const TYPE_COMBINED = 'combined';
40 
41  # Desired load type
42  // Module only has styles (loaded via <style> or <link rel=stylesheet>)
43  const LOAD_STYLES = 'styles';
44  // Module may have other resources (loaded via mw.loader from a script)
45  const LOAD_GENERAL = 'general';
46 
47  # sitewide core module like a skin file or jQuery component
49 
50  # per-user module generated by the software
52 
53  # sitewide module generated from user-editable files, like MediaWiki:Common.js, or
54  # modules accessible to multiple users, such as those generated by the Gadgets extension.
56 
57  # per-user module generated from user-editable files, like User:Me/vector.js
59 
60  # an access constant; make sure this is kept as the largest number in this group
61  const ORIGIN_ALL = 10;
62 
63  # script and style modules form a hierarchy of trustworthiness, with core modules like
64  # skins and jQuery as most trustworthy, and user scripts as least trustworthy. We can
65  # limit the types of scripts and styles we allow to load on, say, sensitive special
66  # pages like Special:UserLogin and Special:Preferences
67  protected $origin = self::ORIGIN_CORE_SITEWIDE;
68 
69  protected $name = null;
70  protected $targets = [ 'desktop' ];
71 
72  // In-object cache for file dependencies
73  protected $fileDeps = [];
74  // In-object cache for message blob (keyed by language)
75  protected $msgBlobs = [];
76  // In-object cache for version hash
77  protected $versionHash = [];
78  // In-object cache for module content
79  protected $contents = [];
80 
84  protected $config;
85 
89  protected $deprecated = false;
90 
94  protected $logger;
95 
102  public function getName() {
103  return $this->name;
104  }
105 
112  public function setName( $name ) {
113  $this->name = $name;
114  }
115 
123  public function getOrigin() {
124  return $this->origin;
125  }
126 
131  public function getFlip( $context ) {
132  return MediaWikiServices::getInstance()->getContentLanguage()->getDir() !==
133  $context->getDirection();
134  }
135 
141  public function getDeprecationInformation() {
142  $deprecationInfo = $this->deprecated;
143  if ( $deprecationInfo ) {
144  $name = $this->getName();
145  $warning = 'This page is using the deprecated ResourceLoader module "' . $name . '".';
146  if ( is_string( $deprecationInfo ) ) {
147  $warning .= "\n" . $deprecationInfo;
148  }
149  return Xml::encodeJsCall(
150  'mw.log.warn',
151  [ $warning ]
152  );
153  } else {
154  return '';
155  }
156  }
157 
178  // Stub, override expected
179  return '';
180  }
181 
187  public function getTemplates() {
188  // Stub, override expected.
189  return [];
190  }
191 
196  public function getConfig() {
197  if ( $this->config === null ) {
198  // Ugh, fall back to default
199  $this->config = MediaWikiServices::getInstance()->getMainConfig();
200  }
201 
202  return $this->config;
203  }
204 
209  public function setConfig( Config $config ) {
210  $this->config = $config;
211  }
212 
218  public function setLogger( LoggerInterface $logger ) {
219  $this->logger = $logger;
220  }
221 
226  protected function getLogger() {
227  if ( !$this->logger ) {
228  $this->logger = new NullLogger();
229  }
230  return $this->logger;
231  }
232 
248  $resourceLoader = $context->getResourceLoader();
249  $derivative = new DerivativeResourceLoaderContext( $context );
250  $derivative->setModules( [ $this->getName() ] );
251  $derivative->setOnly( 'scripts' );
252  $derivative->setDebug( true );
253 
254  $url = $resourceLoader->createLoaderURL(
255  $this->getSource(),
256  $derivative
257  );
258 
259  return [ $url ];
260  }
261 
268  public function supportsURLLoading() {
269  return true;
270  }
271 
281  // Stub, override expected
282  return [];
283  }
284 
295  $resourceLoader = $context->getResourceLoader();
296  $derivative = new DerivativeResourceLoaderContext( $context );
297  $derivative->setModules( [ $this->getName() ] );
298  $derivative->setOnly( 'styles' );
299  $derivative->setDebug( true );
300 
301  $url = $resourceLoader->createLoaderURL(
302  $this->getSource(),
303  $derivative
304  );
305 
306  return [ 'all' => [ $url ] ];
307  }
308 
316  public function getMessages() {
317  // Stub, override expected
318  return [];
319  }
320 
326  public function getGroup() {
327  // Stub, override expected
328  return null;
329  }
330 
336  public function getSource() {
337  // Stub, override expected
338  return 'local';
339  }
340 
348  public function isRaw() {
349  return false;
350  }
351 
365  // Stub, override expected
366  return [];
367  }
368 
374  public function getTargets() {
375  return $this->targets;
376  }
377 
384  public function getType() {
385  return self::LOAD_GENERAL;
386  }
387 
402  public function getSkipFunction() {
403  return null;
404  }
405 
415  $vary = $context->getSkin() . '|' . $context->getLanguage();
416 
417  // Try in-object cache first
418  if ( !isset( $this->fileDeps[$vary] ) ) {
419  $dbr = wfGetDB( DB_REPLICA );
420  $deps = $dbr->selectField( 'module_deps',
421  'md_deps',
422  [
423  'md_module' => $this->getName(),
424  'md_skin' => $vary,
425  ],
426  __METHOD__
427  );
428 
429  if ( !is_null( $deps ) ) {
430  $this->fileDeps[$vary] = self::expandRelativePaths(
431  (array)json_decode( $deps, true )
432  );
433  } else {
434  $this->fileDeps[$vary] = [];
435  }
436  }
437  return $this->fileDeps[$vary];
438  }
439 
450  $vary = $context->getSkin() . '|' . $context->getLanguage();
451  $this->fileDeps[$vary] = $files;
452  }
453 
461  protected function saveFileDependencies( ResourceLoaderContext $context, $localFileRefs ) {
462  try {
463  // Related bugs and performance considerations:
464  // 1. Don't needlessly change the database value with the same list in a
465  // different order or with duplicates.
466  // 2. Use relative paths to avoid ghost entries when $IP changes. (T111481)
467  // 3. Don't needlessly replace the database with the same value
468  // just because $IP changed (e.g. when upgrading a wiki).
469  // 4. Don't create an endless replace loop on every request for this
470  // module when '../' is used anywhere. Even though both are expanded
471  // (one expanded by getFileDependencies from the DB, the other is
472  // still raw as originally read by RL), the latter has not
473  // been normalized yet.
474 
475  // Normalise
476  $localFileRefs = array_values( array_unique( $localFileRefs ) );
477  sort( $localFileRefs );
478  $localPaths = self::getRelativePaths( $localFileRefs );
479  $storedPaths = self::getRelativePaths( $this->getFileDependencies( $context ) );
480 
481  if ( $localPaths === $storedPaths ) {
482  // Unchanged. Avoid needless database query (especially master conn!).
483  return;
484  }
485 
486  // The file deps list has changed, we want to update it.
487  $vary = $context->getSkin() . '|' . $context->getLanguage();
489  $key = $cache->makeKey( __METHOD__, $this->getName(), $vary );
490  $scopeLock = $cache->getScopedLock( $key, 0 );
491  if ( !$scopeLock ) {
492  // Another request appears to be doing this update already.
493  // Avoid write slams (T124649).
494  return;
495  }
496 
497  // No needless escaping as this isn't HTML output.
498  // Only stored in the database and parsed in PHP.
499  $deps = json_encode( $localPaths, JSON_UNESCAPED_SLASHES );
500  $dbw = wfGetDB( DB_MASTER );
501  $dbw->upsert( 'module_deps',
502  [
503  'md_module' => $this->getName(),
504  'md_skin' => $vary,
505  'md_deps' => $deps,
506  ],
507  [ [ 'md_module', 'md_skin' ] ],
508  [
509  'md_deps' => $deps,
510  ],
511  __METHOD__
512  );
513 
514  if ( $dbw->trxLevel() ) {
515  $dbw->onTransactionResolution(
516  function () use ( &$scopeLock ) {
517  ScopedCallback::consume( $scopeLock ); // release after commit
518  },
519  __METHOD__
520  );
521  }
522  } catch ( Exception $e ) {
523  // Probably a DB failure. Either the read query from getFileDependencies(),
524  // or the write query above.
525  wfDebugLog( 'resourceloader', __METHOD__ . ": failed to update DB: $e" );
526  }
527  }
528 
539  public static function getRelativePaths( array $filePaths ) {
540  global $IP;
541  return array_map( function ( $path ) use ( $IP ) {
542  return RelPath::getRelativePath( $path, $IP );
543  }, $filePaths );
544  }
545 
553  public static function expandRelativePaths( array $filePaths ) {
554  global $IP;
555  return array_map( function ( $path ) use ( $IP ) {
556  return RelPath::joinPath( $IP, $path );
557  }, $filePaths );
558  }
559 
568  if ( !$this->getMessages() ) {
569  // Don't bother consulting MessageBlobStore
570  return null;
571  }
572  // Message blobs may only vary language, not by context keys
573  $lang = $context->getLanguage();
574  if ( !isset( $this->msgBlobs[$lang] ) ) {
575  $this->getLogger()->warning( 'Message blob for {module} should have been preloaded', [
576  'module' => $this->getName(),
577  ] );
578  $store = $context->getResourceLoader()->getMessageBlobStore();
579  $this->msgBlobs[$lang] = $store->getBlob( $this, $lang );
580  }
581  return $this->msgBlobs[$lang];
582  }
583 
593  public function setMessageBlob( $blob, $lang ) {
594  $this->msgBlobs[$lang] = $blob;
595  }
596 
611  final public function getHeaders( ResourceLoaderContext $context ) {
612  $headers = [];
613 
614  $formattedLinks = [];
615  foreach ( $this->getPreloadLinks( $context ) as $url => $attribs ) {
616  $link = "<{$url}>;rel=preload";
617  foreach ( $attribs as $key => $val ) {
618  $link .= ";{$key}={$val}";
619  }
620  $formattedLinks[] = $link;
621  }
622  if ( $formattedLinks ) {
623  $headers[] = 'Link: ' . implode( ',', $formattedLinks );
624  }
625 
626  return $headers;
627  }
628 
669  return [];
670  }
671 
680  return [];
681  }
682 
691  $contextHash = $context->getHash();
692  // Cache this expensive operation. This calls builds the scripts, styles, and messages
693  // content which typically involves filesystem and/or database access.
694  if ( !array_key_exists( $contextHash, $this->contents ) ) {
695  $this->contents[$contextHash] = $this->buildContent( $context );
696  }
697  return $this->contents[$contextHash];
698  }
699 
707  final protected function buildContent( ResourceLoaderContext $context ) {
708  $rl = $context->getResourceLoader();
709  $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
710  $statStart = microtime( true );
711 
712  // This MUST build both scripts and styles, regardless of whether $context->getOnly()
713  // is 'scripts' or 'styles' because the result is used by getVersionHash which
714  // must be consistent regardless of the 'only' filter on the current request.
715  // Also, when introducing new module content resources (e.g. templates, headers),
716  // these should only be included in the array when they are non-empty so that
717  // existing modules not using them do not get their cache invalidated.
718  $content = [];
719 
720  // Scripts
721  // If we are in debug mode, we'll want to return an array of URLs if possible
722  // However, we can't do this if the module doesn't support it.
723  // We also can't do this if there is an only= parameter, because we have to give
724  // the module a way to return a load.php URL without causing an infinite loop
725  if ( $context->getDebug() && !$context->getOnly() && $this->supportsURLLoading() ) {
726  $scripts = $this->getScriptURLsForDebug( $context );
727  } else {
728  $scripts = $this->getScript( $context );
729  // Make the script safe to concatenate by making sure there is at least one
730  // trailing new line at the end of the content. Previously, this looked for
731  // a semi-colon instead, but that breaks concatenation if the semicolon
732  // is inside a comment like "// foo();". Instead, simply use a
733  // line break as separator which matches JavaScript native logic for implicitly
734  // ending statements even if a semi-colon is missing.
735  // Bugs: T29054, T162719.
736  if ( is_string( $scripts )
737  && strlen( $scripts )
738  && substr( $scripts, -1 ) !== "\n"
739  ) {
740  $scripts .= "\n";
741  }
742  }
743  $content['scripts'] = $scripts;
744 
745  $styles = [];
746  // Don't create empty stylesheets like [ '' => '' ] for modules
747  // that don't *have* any stylesheets (T40024).
748  $stylePairs = $this->getStyles( $context );
749  if ( count( $stylePairs ) ) {
750  // If we are in debug mode without &only= set, we'll want to return an array of URLs
751  // See comment near shouldIncludeScripts() for more details
752  if ( $context->getDebug() && !$context->getOnly() && $this->supportsURLLoading() ) {
753  $styles = [
754  'url' => $this->getStyleURLsForDebug( $context )
755  ];
756  } else {
757  // Minify CSS before embedding in mw.loader.implement call
758  // (unless in debug mode)
759  if ( !$context->getDebug() ) {
760  foreach ( $stylePairs as $media => $style ) {
761  // Can be either a string or an array of strings.
762  if ( is_array( $style ) ) {
763  $stylePairs[$media] = [];
764  foreach ( $style as $cssText ) {
765  if ( is_string( $cssText ) ) {
766  $stylePairs[$media][] =
767  ResourceLoader::filter( 'minify-css', $cssText );
768  }
769  }
770  } elseif ( is_string( $style ) ) {
771  $stylePairs[$media] = ResourceLoader::filter( 'minify-css', $style );
772  }
773  }
774  }
775  // Wrap styles into @media groups as needed and flatten into a numerical array
776  $styles = [
777  'css' => $rl->makeCombinedStyles( $stylePairs )
778  ];
779  }
780  }
781  $content['styles'] = $styles;
782 
783  // Messages
784  $blob = $this->getMessageBlob( $context );
785  if ( $blob ) {
786  $content['messagesBlob'] = $blob;
787  }
788 
789  $templates = $this->getTemplates();
790  if ( $templates ) {
791  $content['templates'] = $templates;
792  }
793 
794  $headers = $this->getHeaders( $context );
795  if ( $headers ) {
796  $content['headers'] = $headers;
797  }
798 
799  $statTiming = microtime( true ) - $statStart;
800  $statName = strtr( $this->getName(), '.', '_' );
801  $stats->timing( "resourceloader_build.all", 1000 * $statTiming );
802  $stats->timing( "resourceloader_build.$statName", 1000 * $statTiming );
803 
804  return $content;
805  }
806 
825  // Cache this somewhat expensive operation. Especially because some classes
826  // (e.g. startup module) iterate more than once over all modules to get versions.
827  $contextHash = $context->getHash();
828  if ( !array_key_exists( $contextHash, $this->versionHash ) ) {
829  if ( $this->enableModuleContentVersion() ) {
830  // Detect changes directly by hashing the module contents.
831  $str = json_encode( $this->getModuleContent( $context ) );
832  } else {
833  // Infer changes based on definition and other metrics
834  $summary = $this->getDefinitionSummary( $context );
835  if ( !isset( $summary['_class'] ) ) {
836  throw new LogicException( 'getDefinitionSummary must call parent method' );
837  }
838  $str = json_encode( $summary );
839  }
840 
841  $this->versionHash[$contextHash] = ResourceLoader::makeHash( $str );
842  }
843  return $this->versionHash[$contextHash];
844  }
845 
855  public function enableModuleContentVersion() {
856  return false;
857  }
858 
903  return [
904  '_class' => static::class,
905  // Make sure that when filter cache for minification is invalidated,
906  // we also change the HTTP urls and mw.loader.store keys (T176884).
907  '_cacheVersion' => ResourceLoader::CACHE_VERSION,
908  ];
909  }
910 
921  return false;
922  }
923 
935  return $this->getGroup() === 'private';
936  }
937 
939  private static $jsParser;
940  private static $parseCacheVersion = 1;
941 
950  protected function validateScriptFile( $fileName, $contents ) {
951  if ( !$this->getConfig()->get( 'ResourceLoaderValidateJS' ) ) {
952  return $contents;
953  }
954  $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
955  return $cache->getWithSetCallback(
956  $cache->makeGlobalKey(
957  'resourceloader-jsparse',
958  self::$parseCacheVersion,
959  md5( $contents ),
960  $fileName
961  ),
962  $cache::TTL_WEEK,
963  function () use ( $contents, $fileName ) {
964  $parser = self::javaScriptParser();
965  $err = null;
966  try {
967  Wikimedia\suppressWarnings();
968  $parser->parse( $contents, $fileName, 1 );
969  } catch ( Exception $e ) {
970  $err = $e;
971  } finally {
972  Wikimedia\restoreWarnings();
973  }
974  if ( $err ) {
975  // Send the error to the browser console client-side.
976  // By returning this as replacement for the actual script,
977  // we ensure modules are safe to load in a batch request,
978  // without causing other unrelated modules to break.
979  return 'mw.log.error(' .
980  Xml::encodeJsVar( 'JavaScript parse error: ' . $err->getMessage() ) .
981  ');';
982  }
983  return $contents;
984  }
985  );
986  }
987 
991  protected static function javaScriptParser() {
992  if ( !self::$jsParser ) {
993  self::$jsParser = new JSParser();
994  }
995  return self::$jsParser;
996  }
997 
1005  protected static function safeFilemtime( $filePath ) {
1006  Wikimedia\suppressWarnings();
1007  $mtime = filemtime( $filePath ) ?: 1;
1008  Wikimedia\restoreWarnings();
1009  return $mtime;
1010  }
1011 
1020  protected static function safeFileHash( $filePath ) {
1021  return FileContentsHasher::getFileContentsHash( $filePath );
1022  }
1023 }
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
isRaw()
Whether this module&#39;s JS expects to work without the client-side ResourceLoader module.
static filter( $filter, $data, array $options=[])
Run JavaScript or CSS data through a filter, caching the filtered result for future calls...
getMessages()
Get the messages needed for this module.
getDeprecationInformation()
Get JS representing deprecation information for the current module if available.
static safeFileHash( $filePath)
Compute a non-cryptographic string hash of a file&#39;s contents.
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
$IP
Definition: WebStart.php:41
static getFileContentsHash( $filePaths, $algo='md4')
Get a hash of the combined contents of one or more files, either by retrieving a previously-computed ...
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
Definition: hooks.txt:2633
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:2159
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their contents
Definition: database.txt:2
if(!isset( $args[0])) $lang
buildContent(ResourceLoaderContext $context)
Bundle all resources attached to this module into an array.
getMessageBlob(ResourceLoaderContext $context)
Get the hash of the message blob.
getStyleURLsForDebug(ResourceLoaderContext $context)
Get the URL or URLs to load for this module&#39;s CSS in debug mode.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
setFileDependencies(ResourceLoaderContext $context, $files)
Set in-object cache for file dependencies.
getPreloadLinks(ResourceLoaderContext $context)
Get a list of resources that web browsers may preload.
static getLocalClusterInstance()
Get the main cluster-local cache object.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
static encodeJsVar( $value, $pretty=false)
Encode a variable of arbitrary type to JavaScript.
Definition: Xml.php:659
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition: hooks.txt:1799
const DB_MASTER
Definition: defines.php:26
setMessageBlob( $blob, $lang)
Set in-object cache for message blobs.
and how to run hooks for an and one after Each event has a name
Definition: hooks.txt:6
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:3050
Allows changing specific properties of a context object, without changing the main one...
getLessVars(ResourceLoaderContext $context)
Get module-specific LESS variables, if any.
static expandRelativePaths(array $filePaths)
Expand directories relative to $IP.
getFileDependencies(ResourceLoaderContext $context)
Get the files this module depends on indirectly for a given skin.
getVersionHash(ResourceLoaderContext $context)
Get a string identifying the current version of this module in a given context.
static makeHash( $value)
Interface for configuration instances.
Definition: Config.php:28
getSkipFunction()
Get the skip function.
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:677
getSource()
Get the source of this module.
getTemplates()
Takes named templates by the module and returns an array mapping.
enableModuleContentVersion()
Whether to generate version hash based on module content.
$cache
Definition: mcc.php:33
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Definition: hooks.txt:1982
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:780
static getRelativePaths(array $filePaths)
Make file paths relative to MediaWiki directory.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
getTargets()
Get target(s) for the module, eg [&#39;desktop&#39;] or [&#39;desktop&#39;, &#39;mobile&#39;].
setName( $name)
Set this module&#39;s name.
static JSParser $jsParser
Lazy-initialized; use self::javaScriptParser()
validateScriptFile( $fileName, $contents)
Validate a given script file; if valid returns the original source.
shouldEmbedModule(ResourceLoaderContext $context)
Check whether this module should be embeded rather than linked.
getDefinitionSummary(ResourceLoaderContext $context)
Get the definition summary for this module.
getType()
Get the module&#39;s load type.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
isKnownEmpty(ResourceLoaderContext $context)
Check whether this module is known to be empty.
getScript(ResourceLoaderContext $context)
Get all JS for this module for a given language and skin.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
getHeaders(ResourceLoaderContext $context)
Get headers to send as part of a module web response.
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 $context
Definition: hooks.txt:2633
getGroup()
Get the group this module is in.
getStyles(ResourceLoaderContext $context)
Get all CSS for this module for a given skin.
getHash()
All factors that uniquely identify this request, except &#39;modules&#39;.
const DB_REPLICA
Definition: defines.php:25
static safeFilemtime( $filePath)
Safe version of filemtime(), which doesn&#39;t throw a PHP warning if the file doesn&#39;t exist...
getDependencies(ResourceLoaderContext $context=null)
Get a list of modules this module depends on.
setLogger(LoggerInterface $logger)
saveFileDependencies(ResourceLoaderContext $context, $localFileRefs)
Set the files this module depends on indirectly for a given skin.
$content
Definition: pageupdater.txt:72
supportsURLLoading()
Whether this module supports URL loading.
getOrigin()
Get this module&#39;s origin.
getScriptURLsForDebug(ResourceLoaderContext $context)
Get the URL or URLs to load for this module&#39;s JS in debug mode.
getModuleContent(ResourceLoaderContext $context)
Get an array of this module&#39;s resources.
getName()
Get this module&#39;s name.
Object passed around to modules which contains information about the state of a specific loader reque...