MediaWiki REL1_30
ResourceLoaderFileModule.php
Go to the documentation of this file.
1<?php
29 /* Protected Members */
30
32 protected $localBasePath = '';
33
35 protected $remoteBasePath = '';
36
38 protected $templates = [];
39
47 protected $scripts = [];
48
56 protected $languageScripts = [];
57
65 protected $skinScripts = [];
66
74 protected $debugScripts = [];
75
83 protected $styles = [];
84
92 protected $skinStyles = [];
93
101 protected $dependencies = [];
102
106 protected $skipFunction = null;
107
115 protected $messages = [];
116
118 protected $group;
119
121 protected $debugRaw = true;
122
124 protected $raw = false;
125
126 protected $targets = [ 'desktop' ];
127
129 protected $noflip = false;
130
135 protected $hasGeneratedStyles = false;
136
144 protected $localFileRefs = [];
145
150 protected $missingLocalFileRefs = [];
151
152 /* Methods */
153
211 public function __construct(
212 $options = [],
213 $localBasePath = null,
214 $remoteBasePath = null
215 ) {
216 // Flag to decide whether to automagically add the mediawiki.template module
217 $hasTemplates = false;
218 // localBasePath and remoteBasePath both have unbelievably long fallback chains
219 // and need to be handled separately.
220 list( $this->localBasePath, $this->remoteBasePath ) =
221 self::extractBasePaths( $options, $localBasePath, $remoteBasePath );
222
223 // Extract, validate and normalise remaining options
224 foreach ( $options as $member => $option ) {
225 switch ( $member ) {
226 // Lists of file paths
227 case 'scripts':
228 case 'debugScripts':
229 case 'styles':
230 $this->{$member} = (array)$option;
231 break;
232 case 'templates':
233 $hasTemplates = true;
234 $this->{$member} = (array)$option;
235 break;
236 // Collated lists of file paths
237 case 'languageScripts':
238 case 'skinScripts':
239 case 'skinStyles':
240 if ( !is_array( $option ) ) {
241 throw new InvalidArgumentException(
242 "Invalid collated file path list error. " .
243 "'$option' given, array expected."
244 );
245 }
246 foreach ( $option as $key => $value ) {
247 if ( !is_string( $key ) ) {
248 throw new InvalidArgumentException(
249 "Invalid collated file path list key error. " .
250 "'$key' given, string expected."
251 );
252 }
253 $this->{$member}[$key] = (array)$value;
254 }
255 break;
256 case 'deprecated':
257 $this->deprecated = $option;
258 break;
259 // Lists of strings
260 case 'dependencies':
261 case 'messages':
262 case 'targets':
263 // Normalise
264 $option = array_values( array_unique( (array)$option ) );
265 sort( $option );
266
267 $this->{$member} = $option;
268 break;
269 // Single strings
270 case 'group':
271 case 'skipFunction':
272 $this->{$member} = (string)$option;
273 break;
274 // Single booleans
275 case 'debugRaw':
276 case 'raw':
277 case 'noflip':
278 $this->{$member} = (bool)$option;
279 break;
280 }
281 }
282 if ( $hasTemplates ) {
283 $this->dependencies[] = 'mediawiki.template';
284 // Ensure relevant template compiler module gets loaded
285 foreach ( $this->templates as $alias => $templatePath ) {
286 if ( is_int( $alias ) ) {
287 $alias = $templatePath;
288 }
289 $suffix = explode( '.', $alias );
290 $suffix = end( $suffix );
291 $compilerModule = 'mediawiki.template.' . $suffix;
292 if ( $suffix !== 'html' && !in_array( $compilerModule, $this->dependencies ) ) {
293 $this->dependencies[] = $compilerModule;
294 }
295 }
296 }
297 }
298
310 public static function extractBasePaths(
311 $options = [],
312 $localBasePath = null,
313 $remoteBasePath = null
314 ) {
315 global $IP, $wgResourceBasePath;
316
317 // The different ways these checks are done, and their ordering, look very silly,
318 // but were preserved for backwards-compatibility just in case. Tread lightly.
319
320 if ( $localBasePath === null ) {
322 }
323 if ( $remoteBasePath === null ) {
325 }
326
327 if ( isset( $options['remoteExtPath'] ) ) {
329 $remoteBasePath = $wgExtensionAssetsPath . '/' . $options['remoteExtPath'];
330 }
331
332 if ( isset( $options['remoteSkinPath'] ) ) {
333 global $wgStylePath;
334 $remoteBasePath = $wgStylePath . '/' . $options['remoteSkinPath'];
335 }
336
337 if ( array_key_exists( 'localBasePath', $options ) ) {
338 $localBasePath = (string)$options['localBasePath'];
339 }
340
341 if ( array_key_exists( 'remoteBasePath', $options ) ) {
342 $remoteBasePath = (string)$options['remoteBasePath'];
343 }
344
346 }
347
355 $files = $this->getScriptFiles( $context );
356 return $this->getDeprecationInformation() . $this->readScriptFiles( $files );
357 }
358
364 $urls = [];
365 foreach ( $this->getScriptFiles( $context ) as $file ) {
367 $this->getConfig(),
368 $this->getRemotePath( $file )
369 );
370 }
371 return $urls;
372 }
373
377 public function supportsURLLoading() {
378 return $this->debugRaw;
379 }
380
388 $styles = $this->readStyleFiles(
389 $this->getStyleFiles( $context ),
390 $this->getFlip( $context ),
392 );
393 // Collect referenced files
394 $this->saveFileDependencies( $context, $this->localFileRefs );
395
396 return $styles;
397 }
398
404 if ( $this->hasGeneratedStyles ) {
405 // Do the default behaviour of returning a url back to load.php
406 // but with only=styles.
407 return parent::getStyleURLsForDebug( $context );
408 }
409 // Our module consists entirely of real css files,
410 // in debug mode we can load those directly.
411 $urls = [];
412 foreach ( $this->getStyleFiles( $context ) as $mediaType => $list ) {
413 $urls[$mediaType] = [];
414 foreach ( $list as $file ) {
416 $this->getConfig(),
417 $this->getRemotePath( $file )
418 );
419 }
420 }
421 return $urls;
422 }
423
429 public function getMessages() {
430 return $this->messages;
431 }
432
438 public function getGroup() {
439 return $this->group;
440 }
441
448 return $this->dependencies;
449 }
450
456 public function getSkipFunction() {
457 if ( !$this->skipFunction ) {
458 return null;
459 }
460
461 $localPath = $this->getLocalPath( $this->skipFunction );
462 if ( !file_exists( $localPath ) ) {
463 throw new MWException( __METHOD__ . ": skip function file not found: \"$localPath\"" );
464 }
465 $contents = $this->stripBom( file_get_contents( $localPath ) );
466 if ( $this->getConfig()->get( 'ResourceLoaderValidateStaticJS' ) ) {
467 $contents = $this->validateScriptFile( $localPath, $contents );
468 }
469 return $contents;
470 }
471
475 public function isRaw() {
476 return $this->raw;
477 }
478
487 public function enableModuleContentVersion() {
488 return false;
489 }
490
502 $files = [];
503
504 // Flatten style files into $files
505 $styles = self::collateFilePathListByOption( $this->styles, 'media', 'all' );
506 foreach ( $styles as $styleFiles ) {
507 $files = array_merge( $files, $styleFiles );
508 }
509
510 $skinFiles = self::collateFilePathListByOption(
511 self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ),
512 'media',
513 'all'
514 );
515 foreach ( $skinFiles as $styleFiles ) {
516 $files = array_merge( $files, $styleFiles );
517 }
518
519 // Final merge, this should result in a master list of dependent files
520 $files = array_merge(
521 $files,
522 $this->scripts,
523 $this->templates,
524 $context->getDebug() ? $this->debugScripts : [],
525 $this->getLanguageScripts( $context->getLanguage() ),
526 self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' )
527 );
528 if ( $this->skipFunction ) {
529 $files[] = $this->skipFunction;
530 }
531 $files = array_map( [ $this, 'getLocalPath' ], $files );
532 // File deps need to be treated separately because they're already prefixed
533 $files = array_merge( $files, $this->getFileDependencies( $context ) );
534 // Filter out any duplicates from getFileDependencies() and others.
535 // Most commonly introduced by compileLessFile(), which always includes the
536 // entry point Less file we already know about.
537 $files = array_values( array_unique( $files ) );
538
539 // Don't include keys or file paths here, only the hashes. Including that would needlessly
540 // cause global cache invalidation when files move or if e.g. the MediaWiki path changes.
541 // Any significant ordering is already detected by the definition summary.
542 return array_map( [ __CLASS__, 'safeFileHash' ], $files );
543 }
544
552 $summary = parent::getDefinitionSummary( $context );
553
554 $options = [];
555 foreach ( [
556 // The following properties are omitted because they don't affect the module reponse:
557 // - localBasePath (Per T104950; Changes when absolute directory name changes. If
558 // this affects 'scripts' and other file paths, getFileHashes accounts for that.)
559 // - remoteBasePath (Per T104950)
560 // - dependencies (provided via startup module)
561 // - targets
562 // - group (provided via startup module)
563 'scripts',
564 'debugScripts',
565 'styles',
566 'languageScripts',
567 'skinScripts',
568 'skinStyles',
569 'messages',
570 'templates',
571 'skipFunction',
572 'debugRaw',
573 'raw',
574 ] as $member ) {
575 $options[$member] = $this->{$member};
576 };
577
578 $summary[] = [
579 'options' => $options,
580 'fileHashes' => $this->getFileHashes( $context ),
581 'messageBlob' => $this->getMessageBlob( $context ),
582 ];
583
584 $lessVars = $this->getLessVars( $context );
585 if ( $lessVars ) {
586 $summary[] = [ 'lessVars' => $lessVars ];
587 }
588
589 return $summary;
590 }
591
596 protected function getLocalPath( $path ) {
597 if ( $path instanceof ResourceLoaderFilePath ) {
598 return $path->getLocalPath();
599 }
600
601 return "{$this->localBasePath}/$path";
602 }
603
608 protected function getRemotePath( $path ) {
609 if ( $path instanceof ResourceLoaderFilePath ) {
610 return $path->getRemotePath();
611 }
612
613 return "{$this->remoteBasePath}/$path";
614 }
615
623 public function getStyleSheetLang( $path ) {
624 return preg_match( '/\.less$/i', $path ) ? 'less' : 'css';
625 }
626
636 protected static function collateFilePathListByOption( array $list, $option, $default ) {
637 $collatedFiles = [];
638 foreach ( (array)$list as $key => $value ) {
639 if ( is_int( $key ) ) {
640 // File name as the value
641 if ( !isset( $collatedFiles[$default] ) ) {
642 $collatedFiles[$default] = [];
643 }
644 $collatedFiles[$default][] = $value;
645 } elseif ( is_array( $value ) ) {
646 // File name as the key, options array as the value
647 $optionValue = isset( $value[$option] ) ? $value[$option] : $default;
648 if ( !isset( $collatedFiles[$optionValue] ) ) {
649 $collatedFiles[$optionValue] = [];
650 }
651 $collatedFiles[$optionValue][] = $key;
652 }
653 }
654 return $collatedFiles;
655 }
656
666 protected static function tryForKey( array $list, $key, $fallback = null ) {
667 if ( isset( $list[$key] ) && is_array( $list[$key] ) ) {
668 return $list[$key];
669 } elseif ( is_string( $fallback )
670 && isset( $list[$fallback] )
671 && is_array( $list[$fallback] )
672 ) {
673 return $list[$fallback];
674 }
675 return [];
676 }
677
685 $files = array_merge(
686 $this->scripts,
687 $this->getLanguageScripts( $context->getLanguage() ),
688 self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' )
689 );
690 if ( $context->getDebug() ) {
691 $files = array_merge( $files, $this->debugScripts );
692 }
693
694 return array_unique( $files, SORT_REGULAR );
695 }
696
704 private function getLanguageScripts( $lang ) {
705 $scripts = self::tryForKey( $this->languageScripts, $lang );
706 if ( $scripts ) {
707 return $scripts;
708 }
709 $fallbacks = Language::getFallbacksFor( $lang );
710 foreach ( $fallbacks as $lang ) {
711 $scripts = self::tryForKey( $this->languageScripts, $lang );
712 if ( $scripts ) {
713 return $scripts;
714 }
715 }
716
717 return [];
718 }
719
727 return array_merge_recursive(
728 self::collateFilePathListByOption( $this->styles, 'media', 'all' ),
729 self::collateFilePathListByOption(
730 self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ),
731 'media',
732 'all'
733 )
734 );
735 }
736
744 protected function getSkinStyleFiles( $skinName ) {
745 return self::collateFilePathListByOption(
746 self::tryForKey( $this->skinStyles, $skinName ),
747 'media',
748 'all'
749 );
750 }
751
758 protected function getAllSkinStyleFiles() {
759 $styleFiles = [];
760 $internalSkinNames = array_keys( Skin::getSkinNames() );
761 $internalSkinNames[] = 'default';
762
763 foreach ( $internalSkinNames as $internalSkinName ) {
764 $styleFiles = array_merge_recursive(
765 $styleFiles,
766 $this->getSkinStyleFiles( $internalSkinName )
767 );
768 }
769
770 return $styleFiles;
771 }
772
778 public function getAllStyleFiles() {
779 $collatedStyleFiles = array_merge_recursive(
780 self::collateFilePathListByOption( $this->styles, 'media', 'all' ),
781 $this->getAllSkinStyleFiles()
782 );
783
784 $result = [];
785
786 foreach ( $collatedStyleFiles as $media => $styleFiles ) {
787 foreach ( $styleFiles as $styleFile ) {
788 $result[] = $this->getLocalPath( $styleFile );
789 }
790 }
791
792 return $result;
793 }
794
802 protected function readScriptFiles( array $scripts ) {
803 if ( empty( $scripts ) ) {
804 return '';
805 }
806 $js = '';
807 foreach ( array_unique( $scripts, SORT_REGULAR ) as $fileName ) {
808 $localPath = $this->getLocalPath( $fileName );
809 if ( !file_exists( $localPath ) ) {
810 throw new MWException( __METHOD__ . ": script file not found: \"$localPath\"" );
811 }
812 $contents = $this->stripBom( file_get_contents( $localPath ) );
813 if ( $this->getConfig()->get( 'ResourceLoaderValidateStaticJS' ) ) {
814 // Static files don't really need to be checked as often; unlike
815 // on-wiki module they shouldn't change unexpectedly without
816 // admin interference.
817 $contents = $this->validateScriptFile( $fileName, $contents );
818 }
819 $js .= $contents . "\n";
820 }
821 return $js;
822 }
823
839 public function readStyleFiles( array $styles, $flip, $context = null ) {
840 if ( $context === null ) {
841 wfDeprecated( __METHOD__ . ' without a ResourceLoader context', '1.27' );
842 $context = ResourceLoaderContext::newDummyContext();
843 }
844
845 if ( empty( $styles ) ) {
846 return [];
847 }
848 foreach ( $styles as $media => $files ) {
849 $uniqueFiles = array_unique( $files, SORT_REGULAR );
850 $styleFiles = [];
851 foreach ( $uniqueFiles as $file ) {
852 $styleFiles[] = $this->readStyleFile( $file, $flip, $context );
853 }
854 $styles[$media] = implode( "\n", $styleFiles );
855 }
856 return $styles;
857 }
858
871 protected function readStyleFile( $path, $flip, $context ) {
872 $localPath = $this->getLocalPath( $path );
873 $remotePath = $this->getRemotePath( $path );
874 if ( !file_exists( $localPath ) ) {
875 $msg = __METHOD__ . ": style file not found: \"$localPath\"";
876 wfDebugLog( 'resourceloader', $msg );
877 throw new MWException( $msg );
878 }
879
880 if ( $this->getStyleSheetLang( $localPath ) === 'less' ) {
881 $style = $this->compileLessFile( $localPath, $context );
882 $this->hasGeneratedStyles = true;
883 } else {
884 $style = $this->stripBom( file_get_contents( $localPath ) );
885 }
886
887 if ( $flip ) {
888 $style = CSSJanus::transform( $style, true, false );
889 }
890 $localDir = dirname( $localPath );
891 $remoteDir = dirname( $remotePath );
892 // Get and register local file references
893 $localFileRefs = CSSMin::getLocalFileReferences( $style, $localDir );
894 foreach ( $localFileRefs as $file ) {
895 if ( file_exists( $file ) ) {
896 $this->localFileRefs[] = $file;
897 } else {
898 $this->missingLocalFileRefs[] = $file;
899 }
900 }
901 // Don't cache this call. remap() ensures data URIs embeds are up to date,
902 // and urls contain correct content hashes in their query string. (T128668)
903 return CSSMin::remap( $style, $localDir, $remoteDir, true );
904 }
905
911 public function getFlip( $context ) {
912 return $context->getDirection() === 'rtl' && !$this->noflip;
913 }
914
920 public function getTargets() {
921 return $this->targets;
922 }
923
930 public function getType() {
931 $canBeStylesOnly = !(
932 // All options except 'styles', 'skinStyles' and 'debugRaw'
933 $this->scripts
934 || $this->debugScripts
935 || $this->templates
936 || $this->languageScripts
937 || $this->skinScripts
938 || $this->dependencies
939 || $this->messages
940 || $this->skipFunction
941 || $this->raw
942 );
943 return $canBeStylesOnly ? self::LOAD_STYLES : self::LOAD_GENERAL;
944 }
945
958 protected function compileLessFile( $fileName, ResourceLoaderContext $context ) {
959 static $cache;
960
961 if ( !$cache ) {
962 $cache = ObjectCache::getLocalServerInstance( CACHE_ANYTHING );
963 }
964
965 // Construct a cache key from the LESS file name and a hash digest
966 // of the LESS variables used for compilation.
967 $vars = $this->getLessVars( $context );
968 ksort( $vars );
969 $varsHash = hash( 'md4', serialize( $vars ) );
970 $cacheKey = $cache->makeGlobalKey( 'LESS', $fileName, $varsHash );
971 $cachedCompile = $cache->get( $cacheKey );
972
973 // If we got a cached value, we have to validate it by getting a
974 // checksum of all the files that were loaded by the parser and
975 // ensuring it matches the cached entry's.
976 if ( isset( $cachedCompile['hash'] ) ) {
977 $contentHash = FileContentsHasher::getFileContentsHash( $cachedCompile['files'] );
978 if ( $contentHash === $cachedCompile['hash'] ) {
979 $this->localFileRefs = array_merge( $this->localFileRefs, $cachedCompile['files'] );
980 return $cachedCompile['css'];
981 }
982 }
983
984 $compiler = $context->getResourceLoader()->getLessCompiler( $vars );
985 $css = $compiler->parseFile( $fileName )->getCss();
986 $files = $compiler->AllParsedFiles();
987 $this->localFileRefs = array_merge( $this->localFileRefs, $files );
988
989 // Cache for 24 hours (86400 seconds).
990 $cache->set( $cacheKey, [
991 'css' => $css,
992 'files' => $files,
993 'hash' => FileContentsHasher::getFileContentsHash( $files ),
994 ], 3600 * 24 );
995
996 return $css;
997 }
998
1004 public function getTemplates() {
1005 $templates = [];
1006
1007 foreach ( $this->templates as $alias => $templatePath ) {
1008 // Alias is optional
1009 if ( is_int( $alias ) ) {
1010 $alias = $templatePath;
1011 }
1012 $localPath = $this->getLocalPath( $templatePath );
1013 if ( file_exists( $localPath ) ) {
1014 $content = file_get_contents( $localPath );
1015 $templates[$alias] = $this->stripBom( $content );
1016 } else {
1017 $msg = __METHOD__ . ": template file not found: \"$localPath\"";
1018 wfDebugLog( 'resourceloader', $msg );
1019 throw new MWException( $msg );
1020 }
1021 }
1022 return $templates;
1023 }
1024
1035 protected function stripBom( $input ) {
1036 if ( substr_compare( "\xef\xbb\xbf", $input, 0, 3 ) === 0 ) {
1037 return substr( $input, 3 );
1038 }
1039 return $input;
1040 }
1041}
serialize()
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
$wgExtensionAssetsPath
The URL path of the extensions directory.
$wgStylePath
The URL path of the skins directory.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
$messages
$fallback
The package scripts
Definition README.txt:1
static getFileContentsHash( $filePaths, $algo='md4')
Get a hash of the combined contents of one or more files, either by retrieving a previously-computed ...
MediaWiki exception.
static transformResourcePath(Config $config, $path)
Transform path to web-accessible static resource.
Object passed around to modules which contains information about the state of a specific loader reque...
ResourceLoader module based on local JavaScript/CSS files.
array $dependencies
List of modules this module depends on.
array $skinStyles
List of paths to CSS files to include when using specific skins.
getScriptFiles(ResourceLoaderContext $context)
Get a list of file paths for all scripts in this module, in order of proper execution.
getStyleFiles(ResourceLoaderContext $context)
Get a list of file paths for all styles in this module, in order of proper inclusion.
getTargets()
Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile'].
readStyleFiles(array $styles, $flip, $context=null)
Gets the contents of a list of CSS files.
getStyles(ResourceLoaderContext $context)
Get all styles for a given context.
array $skinScripts
List of JavaScript files to include when using a specific skin.
getFileHashes(ResourceLoaderContext $context)
Helper method to gather file hashes for getDefinitionSummary.
string $skipFunction
File name containing the body of the skip function.
array $languageScripts
List of JavaScript files to include when using a specific language.
bool $raw
Whether mw.loader.state() call should be omitted.
readScriptFiles(array $scripts)
Gets the contents of a list of JavaScript files.
array $scripts
List of paths to JavaScript files to always include.
getSkipFunction()
Get the skip function.
getScriptURLsForDebug(ResourceLoaderContext $context)
getGroup()
Gets the name of the group this module should be loaded in.
getStyleURLsForDebug(ResourceLoaderContext $context)
bool $debugRaw
Link to raw files in debug mode.
readStyleFile( $path, $flip, $context)
Reads a style file.
array $templates
Saves a list of the templates named by the modules.
getTemplates()
Takes named templates by the module and returns an array mapping.
static tryForKey(array $list, $key, $fallback=null)
Get a list of element that match a key, optionally using a fallback key.
getFlip( $context)
Get whether CSS for this module should be flipped.
string $localBasePath
Local base path, see __construct()
getMessages()
Gets list of message keys used by this module.
string $group
Name of group to load this module in.
compileLessFile( $fileName, ResourceLoaderContext $context)
Compile a LESS file into CSS.
getDefinitionSummary(ResourceLoaderContext $context)
Get the definition summary for this module.
array $debugScripts
List of paths to JavaScript files to include in debug mode.
getSkinStyleFiles( $skinName)
Gets a list of file paths for all skin styles in the module used by the skin.
__construct( $options=[], $localBasePath=null, $remoteBasePath=null)
Constructs a new module from an options array.
getStyleSheetLang( $path)
Infer the stylesheet language from a stylesheet file path.
getDependencies(ResourceLoaderContext $context=null)
Gets list of names of modules this module depends on.
enableModuleContentVersion()
Disable module content versioning.
static extractBasePaths( $options=[], $localBasePath=null, $remoteBasePath=null)
Extract a pair of local and remote base paths from module definition information.
bool $hasGeneratedStyles
Whether getStyleURLsForDebug should return raw file paths, or return load.php urls.
array $missingLocalFileRefs
Place where readStyleFile() tracks file dependencies for non-existent files.
static collateFilePathListByOption(array $list, $option, $default)
Collates file paths by option (where provided).
getScript(ResourceLoaderContext $context)
Gets all scripts for a given context concatenated together.
getType()
Get the module's load type.
stripBom( $input)
Takes an input string and removes the UTF-8 BOM character if present.
getAllSkinStyleFiles()
Gets a list of file paths for all skin style files in the module, for all available skins.
getLanguageScripts( $lang)
Get the set of language scripts for the given language, possibly using a fallback language.
array $styles
List of paths to CSS files to always include.
bool $noflip
Whether CSSJanus flipping should be skipped for this module.
getAllStyleFiles()
Returns all style files and all skin style files used by this module.
array $localFileRefs
Place where readStyleFile() tracks file dependencies.
string $remoteBasePath
Remote base path, see __construct()
An object to represent a path to a JavaScript/CSS file, along with a remote and local base path,...
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
getFileDependencies(ResourceLoaderContext $context)
Get the files this module depends on indirectly for a given skin.
validateScriptFile( $fileName, $contents)
Validate a given script file; if valid returns the original source.
getMessageBlob(ResourceLoaderContext $context)
Get the hash of the message blob.
getDeprecationInformation()
Get JS representing deprecation information for the current module if available.
saveFileDependencies(ResourceLoaderContext $context, $localFileRefs)
Set the files this module depends on indirectly for a given skin.
static getSkinNames()
Fetch the set of available skins.
Definition Skin.php:51
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
the array() calling protocol came about after MediaWiki 1.4rc1.
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Definition hooks.txt:2198
namespace being checked & $result
Definition hooks.txt:2293
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition hooks.txt:181
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 & $options
Definition hooks.txt:1971
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:2780
$IP
Definition update.php:3
const CACHE_ANYTHING
Definition Defines.php:102
$cache
Definition mcc.php:33
if(is_array($mode)) switch( $mode) $input
if(!isset( $args[0])) $lang