MediaWiki  master
ResourceLoaderModule.php
Go to the documentation of this file.
1 <?php
32 
36 abstract class ResourceLoaderModule implements LoggerAwareInterface {
38  protected $config;
40  protected $logger;
41 
49  protected $origin = self::ORIGIN_CORE_SITEWIDE;
50 
52  protected $name = null;
54  protected $targets = [ 'desktop' ];
55 
57  protected $fileDeps = [];
59  protected $msgBlobs = [];
61  protected $versionHash = [];
63  protected $contents = [];
64 
66  protected $deprecated = false;
67 
69  const TYPE_SCRIPTS = 'scripts';
71  const TYPE_STYLES = 'styles';
73  const TYPE_COMBINED = 'combined';
74 
76  const LOAD_STYLES = 'styles';
78  const LOAD_GENERAL = 'general';
79 
81  const ORIGIN_CORE_SITEWIDE = 1;
83  const ORIGIN_CORE_INDIVIDUAL = 2;
89  const ORIGIN_USER_SITEWIDE = 3;
91  const ORIGIN_USER_INDIVIDUAL = 4;
93  const ORIGIN_ALL = 10;
94 
101  public function getName() {
102  return $this->name;
103  }
104 
111  public function setName( $name ) {
112  $this->name = $name;
113  }
114 
122  public function getOrigin() {
123  return $this->origin;
124  }
125 
130  public function getFlip( $context ) {
131  return MediaWikiServices::getInstance()->getContentLanguage()->getDir() !==
132  $context->getDirection();
133  }
134 
140  public function getDeprecationInformation() {
141  $deprecationInfo = $this->deprecated;
142  if ( $deprecationInfo ) {
143  $name = $this->getName();
144  $warning = 'This page is using the deprecated ResourceLoader module "' . $name . '".';
145  if ( is_string( $deprecationInfo ) ) {
146  $warning .= "\n" . $deprecationInfo;
147  }
148  return 'mw.log.warn(' . ResourceLoader::encodeJsonForScript( $warning ) . ');';
149  } else {
150  return '';
151  }
152  }
153 
174  // Stub, override expected
175  return '';
176  }
177 
183  public function getTemplates() {
184  // Stub, override expected.
185  return [];
186  }
187 
192  public function getConfig() {
193  if ( $this->config === null ) {
194  // Ugh, fall back to default
195  $this->config = MediaWikiServices::getInstance()->getMainConfig();
196  }
197 
198  return $this->config;
199  }
200 
205  public function setConfig( Config $config ) {
206  $this->config = $config;
207  }
208 
213  public function setLogger( LoggerInterface $logger ) {
214  $this->logger = $logger;
215  }
216 
221  protected function getLogger() {
222  if ( !$this->logger ) {
223  $this->logger = new NullLogger();
224  }
225  return $this->logger;
226  }
227 
243  $resourceLoader = $context->getResourceLoader();
244  $derivative = new DerivativeResourceLoaderContext( $context );
245  $derivative->setModules( [ $this->getName() ] );
246  $derivative->setOnly( 'scripts' );
247  $derivative->setDebug( true );
248 
249  $url = $resourceLoader->createLoaderURL(
250  $this->getSource(),
251  $derivative
252  );
253 
254  return [ $url ];
255  }
256 
263  public function supportsURLLoading() {
264  return true;
265  }
266 
276  // Stub, override expected
277  return [];
278  }
279 
290  $resourceLoader = $context->getResourceLoader();
291  $derivative = new DerivativeResourceLoaderContext( $context );
292  $derivative->setModules( [ $this->getName() ] );
293  $derivative->setOnly( 'styles' );
294  $derivative->setDebug( true );
295 
296  $url = $resourceLoader->createLoaderURL(
297  $this->getSource(),
298  $derivative
299  );
300 
301  return [ 'all' => [ $url ] ];
302  }
303 
311  public function getMessages() {
312  // Stub, override expected
313  return [];
314  }
315 
321  public function getGroup() {
322  // Stub, override expected
323  return null;
324  }
325 
331  public function getSource() {
332  // Stub, override expected
333  return 'local';
334  }
335 
349  // Stub, override expected
350  return [];
351  }
352 
358  public function getTargets() {
359  return $this->targets;
360  }
361 
368  public function getType() {
369  return self::LOAD_GENERAL;
370  }
371 
386  public function getSkipFunction() {
387  return null;
388  }
389 
399  $vary = self::getVary( $context );
400 
401  // Try in-object cache first
402  if ( !isset( $this->fileDeps[$vary] ) ) {
403  $dbr = wfGetDB( DB_REPLICA );
404  $deps = $dbr->selectField( 'module_deps',
405  'md_deps',
406  [
407  'md_module' => $this->getName(),
408  'md_skin' => $vary,
409  ],
410  __METHOD__
411  );
412 
413  if ( !is_null( $deps ) ) {
414  $this->fileDeps[$vary] = self::expandRelativePaths(
415  (array)json_decode( $deps, true )
416  );
417  } else {
418  $this->fileDeps[$vary] = [];
419  }
420  }
421  return $this->fileDeps[$vary];
422  }
423 
434  $vary = self::getVary( $context );
435  $this->fileDeps[$vary] = $files;
436  }
437 
445  protected function saveFileDependencies( ResourceLoaderContext $context, $localFileRefs ) {
446  try {
447  // Related bugs and performance considerations:
448  // 1. Don't needlessly change the database value with the same list in a
449  // different order or with duplicates.
450  // 2. Use relative paths to avoid ghost entries when $IP changes. (T111481)
451  // 3. Don't needlessly replace the database with the same value
452  // just because $IP changed (e.g. when upgrading a wiki).
453  // 4. Don't create an endless replace loop on every request for this
454  // module when '../' is used anywhere. Even though both are expanded
455  // (one expanded by getFileDependencies from the DB, the other is
456  // still raw as originally read by RL), the latter has not
457  // been normalized yet.
458 
459  // Normalise
460  $localFileRefs = array_values( array_unique( $localFileRefs ) );
461  sort( $localFileRefs );
462  $localPaths = self::getRelativePaths( $localFileRefs );
463  $storedPaths = self::getRelativePaths( $this->getFileDependencies( $context ) );
464 
465  if ( $localPaths === $storedPaths ) {
466  // Unchanged. Avoid needless database query (especially master conn!).
467  return;
468  }
469 
470  // The file deps list has changed, we want to update it.
471  $vary = self::getVary( $context );
473  $key = $cache->makeKey( __METHOD__, $this->getName(), $vary );
474  $scopeLock = $cache->getScopedLock( $key, 0 );
475  if ( !$scopeLock ) {
476  // Another request appears to be doing this update already.
477  // Avoid write slams (T124649).
478  return;
479  }
480 
481  // No needless escaping as this isn't HTML output.
482  // Only stored in the database and parsed in PHP.
483  $deps = json_encode( $localPaths, JSON_UNESCAPED_SLASHES );
484  $dbw = wfGetDB( DB_MASTER );
485  $dbw->upsert( 'module_deps',
486  [
487  'md_module' => $this->getName(),
488  'md_skin' => $vary,
489  'md_deps' => $deps,
490  ],
491  [ [ 'md_module', 'md_skin' ] ],
492  [
493  'md_deps' => $deps,
494  ],
495  __METHOD__
496  );
497 
498  if ( $dbw->trxLevel() ) {
499  $dbw->onTransactionResolution(
500  function () use ( &$scopeLock ) {
501  ScopedCallback::consume( $scopeLock ); // release after commit
502  },
503  __METHOD__
504  );
505  }
506  } catch ( Exception $e ) {
507  // Probably a DB failure. Either the read query from getFileDependencies(),
508  // or the write query above.
509  wfDebugLog( 'resourceloader', __METHOD__ . ": failed to update DB: $e" );
510  }
511  }
512 
523  public static function getRelativePaths( array $filePaths ) {
524  global $IP;
525  return array_map( function ( $path ) use ( $IP ) {
526  return RelPath::getRelativePath( $path, $IP );
527  }, $filePaths );
528  }
529 
537  public static function expandRelativePaths( array $filePaths ) {
538  global $IP;
539  return array_map( function ( $path ) use ( $IP ) {
540  return RelPath::joinPath( $IP, $path );
541  }, $filePaths );
542  }
543 
552  if ( !$this->getMessages() ) {
553  // Don't bother consulting MessageBlobStore
554  return null;
555  }
556  // Message blobs may only vary language, not by context keys
557  $lang = $context->getLanguage();
558  if ( !isset( $this->msgBlobs[$lang] ) ) {
559  $this->getLogger()->warning( 'Message blob for {module} should have been preloaded', [
560  'module' => $this->getName(),
561  ] );
562  $store = $context->getResourceLoader()->getMessageBlobStore();
563  $this->msgBlobs[$lang] = $store->getBlob( $this, $lang );
564  }
565  return $this->msgBlobs[$lang];
566  }
567 
577  public function setMessageBlob( $blob, $lang ) {
578  $this->msgBlobs[$lang] = $blob;
579  }
580 
595  final public function getHeaders( ResourceLoaderContext $context ) {
596  $headers = [];
597 
598  $formattedLinks = [];
599  foreach ( $this->getPreloadLinks( $context ) as $url => $attribs ) {
600  $link = "<{$url}>;rel=preload";
601  foreach ( $attribs as $key => $val ) {
602  $link .= ";{$key}={$val}";
603  }
604  $formattedLinks[] = $link;
605  }
606  if ( $formattedLinks ) {
607  $headers[] = 'Link: ' . implode( ',', $formattedLinks );
608  }
609 
610  return $headers;
611  }
612 
653  return [];
654  }
655 
664  return [];
665  }
666 
675  $contextHash = $context->getHash();
676  // Cache this expensive operation. This calls builds the scripts, styles, and messages
677  // content which typically involves filesystem and/or database access.
678  if ( !array_key_exists( $contextHash, $this->contents ) ) {
679  $this->contents[$contextHash] = $this->buildContent( $context );
680  }
681  return $this->contents[$contextHash];
682  }
683 
691  final protected function buildContent( ResourceLoaderContext $context ) {
692  $rl = $context->getResourceLoader();
693  $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
694  $statStart = microtime( true );
695 
696  // This MUST build both scripts and styles, regardless of whether $context->getOnly()
697  // is 'scripts' or 'styles' because the result is used by getVersionHash which
698  // must be consistent regardless of the 'only' filter on the current request.
699  // Also, when introducing new module content resources (e.g. templates, headers),
700  // these should only be included in the array when they are non-empty so that
701  // existing modules not using them do not get their cache invalidated.
702  $content = [];
703 
704  // Scripts
705  // If we are in debug mode, we'll want to return an array of URLs if possible
706  // However, we can't do this if the module doesn't support it.
707  // We also can't do this if there is an only= parameter, because we have to give
708  // the module a way to return a load.php URL without causing an infinite loop
709  if ( $context->getDebug() && !$context->getOnly() && $this->supportsURLLoading() ) {
710  $scripts = $this->getScriptURLsForDebug( $context );
711  } else {
712  $scripts = $this->getScript( $context );
713  // Make the script safe to concatenate by making sure there is at least one
714  // trailing new line at the end of the content. Previously, this looked for
715  // a semi-colon instead, but that breaks concatenation if the semicolon
716  // is inside a comment like "// foo();". Instead, simply use a
717  // line break as separator which matches JavaScript native logic for implicitly
718  // ending statements even if a semi-colon is missing.
719  // Bugs: T29054, T162719.
720  if ( is_string( $scripts )
721  && strlen( $scripts )
722  && substr( $scripts, -1 ) !== "\n"
723  ) {
724  $scripts .= "\n";
725  }
726  }
727  $content['scripts'] = $scripts;
728 
729  $styles = [];
730  // Don't create empty stylesheets like [ '' => '' ] for modules
731  // that don't *have* any stylesheets (T40024).
732  $stylePairs = $this->getStyles( $context );
733  if ( count( $stylePairs ) ) {
734  // If we are in debug mode without &only= set, we'll want to return an array of URLs
735  // See comment near shouldIncludeScripts() for more details
736  if ( $context->getDebug() && !$context->getOnly() && $this->supportsURLLoading() ) {
737  $styles = [
738  'url' => $this->getStyleURLsForDebug( $context )
739  ];
740  } else {
741  // Minify CSS before embedding in mw.loader.implement call
742  // (unless in debug mode)
743  if ( !$context->getDebug() ) {
744  foreach ( $stylePairs as $media => $style ) {
745  // Can be either a string or an array of strings.
746  if ( is_array( $style ) ) {
747  $stylePairs[$media] = [];
748  foreach ( $style as $cssText ) {
749  if ( is_string( $cssText ) ) {
750  $stylePairs[$media][] =
751  ResourceLoader::filter( 'minify-css', $cssText );
752  }
753  }
754  } elseif ( is_string( $style ) ) {
755  $stylePairs[$media] = ResourceLoader::filter( 'minify-css', $style );
756  }
757  }
758  }
759  // Wrap styles into @media groups as needed and flatten into a numerical array
760  $styles = [
761  'css' => $rl->makeCombinedStyles( $stylePairs )
762  ];
763  }
764  }
765  $content['styles'] = $styles;
766 
767  // Messages
768  $blob = $this->getMessageBlob( $context );
769  if ( $blob ) {
770  $content['messagesBlob'] = $blob;
771  }
772 
773  $templates = $this->getTemplates();
774  if ( $templates ) {
775  $content['templates'] = $templates;
776  }
777 
778  $headers = $this->getHeaders( $context );
779  if ( $headers ) {
780  $content['headers'] = $headers;
781  }
782 
783  $statTiming = microtime( true ) - $statStart;
784  $statName = strtr( $this->getName(), '.', '_' );
785  $stats->timing( "resourceloader_build.all", 1000 * $statTiming );
786  $stats->timing( "resourceloader_build.$statName", 1000 * $statTiming );
787 
788  return $content;
789  }
790 
809  // Cache this somewhat expensive operation. Especially because some classes
810  // (e.g. startup module) iterate more than once over all modules to get versions.
811  $contextHash = $context->getHash();
812  if ( !array_key_exists( $contextHash, $this->versionHash ) ) {
813  if ( $this->enableModuleContentVersion() ) {
814  // Detect changes directly by hashing the module contents.
815  $str = json_encode( $this->getModuleContent( $context ) );
816  } else {
817  // Infer changes based on definition and other metrics
818  $summary = $this->getDefinitionSummary( $context );
819  if ( !isset( $summary['_class'] ) ) {
820  throw new LogicException( 'getDefinitionSummary must call parent method' );
821  }
822  $str = json_encode( $summary );
823  }
824 
825  $this->versionHash[$contextHash] = ResourceLoader::makeHash( $str );
826  }
827  return $this->versionHash[$contextHash];
828  }
829 
839  public function enableModuleContentVersion() {
840  return false;
841  }
842 
887  return [
888  '_class' => static::class,
889  // Make sure that when filter cache for minification is invalidated,
890  // we also change the HTTP urls and mw.loader.store keys (T176884).
891  '_cacheVersion' => ResourceLoader::CACHE_VERSION,
892  ];
893  }
894 
905  return false;
906  }
907 
919  return $this->getGroup() === 'private';
920  }
921 
923  private static $jsParser;
924  private static $parseCacheVersion = 1;
925 
934  protected function validateScriptFile( $fileName, $contents ) {
935  if ( !$this->getConfig()->get( 'ResourceLoaderValidateJS' ) ) {
936  return $contents;
937  }
938  $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
939  return $cache->getWithSetCallback(
940  $cache->makeGlobalKey(
941  'resourceloader-jsparse',
942  self::$parseCacheVersion,
943  md5( $contents ),
944  $fileName
945  ),
946  $cache::TTL_WEEK,
947  function () use ( $contents, $fileName ) {
948  $parser = self::javaScriptParser();
949  $err = null;
950  try {
951  AtEase::suppressWarnings();
952  $parser->parse( $contents, $fileName, 1 );
953  } catch ( Exception $e ) {
954  $err = $e;
955  } finally {
956  AtEase::restoreWarnings();
957  }
958  if ( $err ) {
959  // Send the error to the browser console client-side.
960  // By returning this as replacement for the actual script,
961  // we ensure modules are safe to load in a batch request,
962  // without causing other unrelated modules to break.
963  return 'mw.log.error(' .
964  Xml::encodeJsVar( 'JavaScript parse error: ' . $err->getMessage() ) .
965  ');';
966  }
967  return $contents;
968  }
969  );
970  }
971 
975  protected static function javaScriptParser() {
976  if ( !self::$jsParser ) {
977  self::$jsParser = new JSParser();
978  }
979  return self::$jsParser;
980  }
981 
989  protected static function safeFilemtime( $filePath ) {
990  AtEase::suppressWarnings();
991  $mtime = filemtime( $filePath ) ?: 1;
992  AtEase::restoreWarnings();
993  return $mtime;
994  }
995 
1004  protected static function safeFileHash( $filePath ) {
1005  return FileContentsHasher::getFileContentsHash( $filePath );
1006  }
1007 
1015  public static function getVary( ResourceLoaderContext $context ) {
1016  return implode( '|', [
1017  $context->getSkin(),
1018  $context->getLanguage(),
1019  ] );
1020  }
1021 }
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:2621
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:2147
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.
string bool $deprecated
Deprecation string or true if deprecated; false otherwise.
string [] $targets
What client platforms the module targets (e.g.
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
array $versionHash
Map of (context hash => cached module version hash)
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition: hooks.txt:1781
const DB_MASTER
Definition: defines.php:26
setMessageBlob( $blob, $lang)
Set in-object cache for message blobs.
array $fileDeps
Map of (variant => indirect file dependencies)
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:3039
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.
getSource()
Get the source of this module.
array $contents
Map of (context hash => cached module content)
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
static encodeJsonForScript( $data)
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode...
array $msgBlobs
Map of (language => in-object cache for message blob)
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:1972
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:767
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;].
int $origin
Script and style modules form a hierarchy of trustworthiness, with core modules like skins and jQuery...
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.
string null $name
Module 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 $context
Definition: hooks.txt:2621
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...
static getVary(ResourceLoaderContext $context)
Get vary string.
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...