MediaWiki  1.23.2
ResourceLoaderFileModule.php
Go to the documentation of this file.
1 <?php
29 
30  /* Protected Members */
31 
33  protected $localBasePath = '';
35  protected $remoteBasePath = '';
43  protected $scripts = array();
51  protected $languageScripts = array();
59  protected $skinScripts = array();
67  protected $debugScripts = array();
75  protected $loaderScripts = array();
83  protected $styles = array();
91  protected $skinStyles = array();
99  protected $dependencies = array();
107  protected $messages = array();
109  protected $group;
111  protected $position = 'bottom';
113  protected $debugRaw = true;
115  protected $raw = false;
116  protected $targets = array( 'desktop' );
117 
122  protected $hasGeneratedStyles = false;
123 
131  protected $modifiedTime = array();
139  protected $localFileRefs = array();
140 
141  /* Methods */
142 
195  public function __construct( $options = array(), $localBasePath = null,
196  $remoteBasePath = null
197  ) {
198  global $IP, $wgScriptPath, $wgResourceBasePath;
199  $this->localBasePath = $localBasePath === null ? $IP : $localBasePath;
200  if ( $remoteBasePath !== null ) {
201  $this->remoteBasePath = $remoteBasePath;
202  } else {
203  $this->remoteBasePath = $wgResourceBasePath === null ? $wgScriptPath : $wgResourceBasePath;
204  }
205 
206  if ( isset( $options['remoteExtPath'] ) ) {
207  global $wgExtensionAssetsPath;
208  $this->remoteBasePath = $wgExtensionAssetsPath . '/' . $options['remoteExtPath'];
209  }
210 
211  foreach ( $options as $member => $option ) {
212  switch ( $member ) {
213  // Lists of file paths
214  case 'scripts':
215  case 'debugScripts':
216  case 'loaderScripts':
217  case 'styles':
218  $this->{$member} = (array)$option;
219  break;
220  // Collated lists of file paths
221  case 'languageScripts':
222  case 'skinScripts':
223  case 'skinStyles':
224  if ( !is_array( $option ) ) {
225  throw new MWException(
226  "Invalid collated file path list error. " .
227  "'$option' given, array expected."
228  );
229  }
230  foreach ( $option as $key => $value ) {
231  if ( !is_string( $key ) ) {
232  throw new MWException(
233  "Invalid collated file path list key error. " .
234  "'$key' given, string expected."
235  );
236  }
237  $this->{$member}[$key] = (array)$value;
238  }
239  break;
240  // Lists of strings
241  case 'dependencies':
242  case 'messages':
243  case 'targets':
244  // Normalise
245  $option = array_values( array_unique( (array)$option ) );
246  sort( $option );
247 
248  $this->{$member} = $option;
249  break;
250  // Single strings
251  case 'group':
252  case 'position':
253  case 'localBasePath':
254  case 'remoteBasePath':
255  $this->{$member} = (string)$option;
256  break;
257  // Single booleans
258  case 'debugRaw':
259  case 'raw':
260  $this->{$member} = (bool)$option;
261  break;
262  }
263  }
264  // Make sure the remote base path is a complete valid URL,
265  // but possibly protocol-relative to avoid cache pollution
266  $this->remoteBasePath = wfExpandUrl( $this->remoteBasePath, PROTO_RELATIVE );
267  }
268 
275  public function getScript( ResourceLoaderContext $context ) {
276  $files = $this->getScriptFiles( $context );
277  return $this->readScriptFiles( $files );
278  }
279 
284  public function getScriptURLsForDebug( ResourceLoaderContext $context ) {
285  $urls = array();
286  foreach ( $this->getScriptFiles( $context ) as $file ) {
287  $urls[] = $this->getRemotePath( $file );
288  }
289  return $urls;
290  }
291 
295  public function supportsURLLoading() {
296  return $this->debugRaw;
297  }
298 
304  public function getLoaderScript() {
305  if ( count( $this->loaderScripts ) == 0 ) {
306  return false;
307  }
308  return $this->readScriptFiles( $this->loaderScripts );
309  }
310 
317  public function getStyles( ResourceLoaderContext $context ) {
318  $styles = $this->readStyleFiles(
319  $this->getStyleFiles( $context ),
320  $this->getFlip( $context )
321  );
322  // Collect referenced files
323  $this->localFileRefs = array_unique( $this->localFileRefs );
324  // If the list has been modified since last time we cached it, update the cache
325  try {
326  if ( $this->localFileRefs !== $this->getFileDependencies( $context->getSkin() ) ) {
327  $dbw = wfGetDB( DB_MASTER );
328  $dbw->replace( 'module_deps',
329  array( array( 'md_module', 'md_skin' ) ), array(
330  'md_module' => $this->getName(),
331  'md_skin' => $context->getSkin(),
332  'md_deps' => FormatJson::encode( $this->localFileRefs ),
333  )
334  );
335  }
336  } catch ( Exception $e ) {
337  wfDebugLog( 'resourceloader', __METHOD__ . ": failed to update DB: $e" );
338  }
339  return $styles;
340  }
341 
346  public function getStyleURLsForDebug( ResourceLoaderContext $context ) {
347  if ( $this->hasGeneratedStyles ) {
348  // Do the default behaviour of returning a url back to load.php
349  // but with only=styles.
350  return parent::getStyleURLsForDebug( $context );
351  }
352  // Our module consists entirely of real css files,
353  // in debug mode we can load those directly.
354  $urls = array();
355  foreach ( $this->getStyleFiles( $context ) as $mediaType => $list ) {
356  $urls[$mediaType] = array();
357  foreach ( $list as $file ) {
358  $urls[$mediaType][] = $this->getRemotePath( $file );
359  }
360  }
361  return $urls;
362  }
363 
369  public function getMessages() {
370  return $this->messages;
371  }
372 
378  public function getGroup() {
379  return $this->group;
380  }
381 
385  public function getPosition() {
386  return $this->position;
387  }
388 
394  public function getDependencies() {
395  return $this->dependencies;
396  }
397 
401  public function isRaw() {
402  return $this->raw;
403  }
404 
419  public function getModifiedTime( ResourceLoaderContext $context ) {
420  if ( isset( $this->modifiedTime[$context->getHash()] ) ) {
421  return $this->modifiedTime[$context->getHash()];
422  }
423  wfProfileIn( __METHOD__ );
424 
425  $files = array();
426 
427  // Flatten style files into $files
428  $styles = self::collateFilePathListByOption( $this->styles, 'media', 'all' );
429  foreach ( $styles as $styleFiles ) {
430  $files = array_merge( $files, $styleFiles );
431  }
432 
434  self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ),
435  'media',
436  'all'
437  );
438  foreach ( $skinFiles as $styleFiles ) {
439  $files = array_merge( $files, $styleFiles );
440  }
441 
442  // Final merge, this should result in a master list of dependent files
443  $files = array_merge(
444  $files,
445  $this->scripts,
446  $context->getDebug() ? $this->debugScripts : array(),
447  self::tryForKey( $this->languageScripts, $context->getLanguage() ),
448  self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' ),
449  $this->loaderScripts
450  );
451  $files = array_map( array( $this, 'getLocalPath' ), $files );
452  // File deps need to be treated separately because they're already prefixed
453  $files = array_merge( $files, $this->getFileDependencies( $context->getSkin() ) );
454 
455  // If a module is nothing but a list of dependencies, we need to avoid
456  // giving max() an empty array
457  if ( count( $files ) === 0 ) {
458  $this->modifiedTime[$context->getHash()] = 1;
459  wfProfileOut( __METHOD__ );
460  return $this->modifiedTime[$context->getHash()];
461  }
462 
463  wfProfileIn( __METHOD__ . '-filemtime' );
464  $filesMtime = max( array_map( array( __CLASS__, 'safeFilemtime' ), $files ) );
465  wfProfileOut( __METHOD__ . '-filemtime' );
466 
467  $this->modifiedTime[$context->getHash()] = max(
468  $filesMtime,
469  $this->getMsgBlobMtime( $context->getLanguage() ),
470  $this->getDefinitionMtime( $context )
471  );
472 
473  wfProfileOut( __METHOD__ );
474  return $this->modifiedTime[$context->getHash()];
475  }
476 
482  public function getDefinitionSummary( ResourceLoaderContext $context ) {
483  $summary = array(
484  'class' => get_class( $this ),
485  );
486  foreach ( array(
487  'scripts',
488  'debugScripts',
489  'loaderScripts',
490  'styles',
491  'languageScripts',
492  'skinScripts',
493  'skinStyles',
494  'dependencies',
495  'messages',
496  'targets',
497  'group',
498  'position',
499  'localBasePath',
500  'remoteBasePath',
501  'debugRaw',
502  'raw',
503  ) as $member ) {
504  $summary[$member] = $this->{$member};
505  };
506  return $summary;
507  }
508 
509  /* Protected Methods */
510 
515  protected function getLocalPath( $path ) {
516  return "{$this->localBasePath}/$path";
517  }
518 
523  protected function getRemotePath( $path ) {
524  return "{$this->remoteBasePath}/$path";
525  }
526 
534  public function getStyleSheetLang( $path ) {
535  return preg_match( '/\.less$/i', $path ) ? 'less' : 'css';
536  }
537 
547  protected static function collateFilePathListByOption( array $list, $option, $default ) {
548  $collatedFiles = array();
549  foreach ( (array)$list as $key => $value ) {
550  if ( is_int( $key ) ) {
551  // File name as the value
552  if ( !isset( $collatedFiles[$default] ) ) {
553  $collatedFiles[$default] = array();
554  }
555  $collatedFiles[$default][] = $value;
556  } elseif ( is_array( $value ) ) {
557  // File name as the key, options array as the value
558  $optionValue = isset( $value[$option] ) ? $value[$option] : $default;
559  if ( !isset( $collatedFiles[$optionValue] ) ) {
560  $collatedFiles[$optionValue] = array();
561  }
562  $collatedFiles[$optionValue][] = $key;
563  }
564  }
565  return $collatedFiles;
566  }
567 
577  protected static function tryForKey( array $list, $key, $fallback = null ) {
578  if ( isset( $list[$key] ) && is_array( $list[$key] ) ) {
579  return $list[$key];
580  } elseif ( is_string( $fallback )
581  && isset( $list[$fallback] )
582  && is_array( $list[$fallback] )
583  ) {
584  return $list[$fallback];
585  }
586  return array();
587  }
588 
595  protected function getScriptFiles( ResourceLoaderContext $context ) {
596  $files = array_merge(
597  $this->scripts,
598  self::tryForKey( $this->languageScripts, $context->getLanguage() ),
599  self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' )
600  );
601  if ( $context->getDebug() ) {
602  $files = array_merge( $files, $this->debugScripts );
603  }
604 
605  return array_unique( $files );
606  }
607 
614  protected function getStyleFiles( ResourceLoaderContext $context ) {
615  return array_merge_recursive(
616  self::collateFilePathListByOption( $this->styles, 'media', 'all' ),
617  self::collateFilePathListByOption(
618  self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ),
619  'media',
620  'all'
621  )
622  );
623  }
624 
629  public function getAllStyleFiles() {
630  $files = array();
631  foreach ( (array)$this->styles as $key => $value ) {
632  if ( is_array( $value ) ) {
633  $path = $key;
634  } else {
635  $path = $value;
636  }
637  $files[] = $this->getLocalPath( $path );
638  }
639  return $files;
640  }
641 
649  protected function readScriptFiles( array $scripts ) {
650  global $wgResourceLoaderValidateStaticJS;
651  if ( empty( $scripts ) ) {
652  return '';
653  }
654  $js = '';
655  foreach ( array_unique( $scripts ) as $fileName ) {
656  $localPath = $this->getLocalPath( $fileName );
657  if ( !file_exists( $localPath ) ) {
658  throw new MWException( __METHOD__ . ": script file not found: \"$localPath\"" );
659  }
660  $contents = file_get_contents( $localPath );
661  if ( $wgResourceLoaderValidateStaticJS ) {
662  // Static files don't really need to be checked as often; unlike
663  // on-wiki module they shouldn't change unexpectedly without
664  // admin interference.
665  $contents = $this->validateScriptFile( $fileName, $contents );
666  }
667  $js .= $contents . "\n";
668  }
669  return $js;
670  }
671 
684  protected function readStyleFiles( array $styles, $flip ) {
685  if ( empty( $styles ) ) {
686  return array();
687  }
688  foreach ( $styles as $media => $files ) {
689  $uniqueFiles = array_unique( $files );
690  $styleFiles = array();
691  foreach ( $uniqueFiles as $file ) {
692  $styleFiles[] = $this->readStyleFile( $file, $flip );
693  }
694  $styles[$media] = implode( "\n", $styleFiles );
695  }
696  return $styles;
697  }
698 
710  protected function readStyleFile( $path, $flip ) {
711  $localPath = $this->getLocalPath( $path );
712  if ( !file_exists( $localPath ) ) {
713  $msg = __METHOD__ . ": style file not found: \"$localPath\"";
714  wfDebugLog( 'resourceloader', $msg );
715  throw new MWException( $msg );
716  }
717 
718  if ( $this->getStyleSheetLang( $path ) === 'less' ) {
719  $style = $this->compileLESSFile( $localPath );
720  $this->hasGeneratedStyles = true;
721  } else {
722  $style = file_get_contents( $localPath );
723  }
724 
725  if ( $flip ) {
726  $style = CSSJanus::transform( $style, true, false );
727  }
728  $dirname = dirname( $path );
729  if ( $dirname == '.' ) {
730  // If $path doesn't have a directory component, don't prepend a dot
731  $dirname = '';
732  }
733  $dir = $this->getLocalPath( $dirname );
734  $remoteDir = $this->getRemotePath( $dirname );
735  // Get and register local file references
736  $this->localFileRefs = array_merge(
737  $this->localFileRefs,
739  );
740  return CSSMin::remap(
741  $style, $dir, $remoteDir, true
742  );
743  }
744 
750  public function getFlip( $context ) {
751  return $context->getDirection() === 'rtl';
752  }
753 
759  public function getTargets() {
760  return $this->targets;
761  }
762 
773  protected static function getLESSCacheKey( $fileName ) {
774  $vars = json_encode( ResourceLoader::getLESSVars() );
775  $hash = md5( $fileName . $vars );
776  return wfMemcKey( 'resourceloader', 'less', $hash );
777  }
778 
794  protected function compileLESSFile( $fileName ) {
795  $key = self::getLESSCacheKey( $fileName );
797 
798  // The input to lessc. Either an associative array representing the
799  // cached results of a previous compilation, or the string file name if
800  // no cache result exists.
801  $source = $cache->get( $key );
802  if ( !is_array( $source ) || !isset( $source['root'] ) ) {
803  $source = $fileName;
804  }
805 
806  $compiler = ResourceLoader::getLessCompiler();
807  $result = null;
808 
809  $result = $compiler->cachedCompile( $source );
810 
811  if ( !is_array( $result ) ) {
812  throw new MWException( 'LESS compiler result has type ' . gettype( $result ) . '; array expected.' );
813  }
814 
815  $this->localFileRefs += array_keys( $result['files'] );
816  $cache->set( $key, $result );
817  return $result['compiled'];
818  }
819 }
ResourceLoaderFileModule\getPosition
getPosition()
Definition: ResourceLoaderFileModule.php:385
ResourceLoaderContext
Object passed around to modules which contains information about the state of a specific loader reque...
Definition: ResourceLoaderContext.php:29
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
$files
$files
Definition: importImages.php:67
ResourceLoaderFileModule\getModifiedTime
getModifiedTime(ResourceLoaderContext $context)
Get the last modified timestamp of this module.
Definition: ResourceLoaderFileModule.php:419
ResourceLoaderFileModule\$localBasePath
$localBasePath
String: Local base path, see __construct()
Definition: ResourceLoaderFileModule.php:33
ResourceLoaderFileModule\__construct
__construct( $options=array(), $localBasePath=null, $remoteBasePath=null)
Constructs a new module from an options array.
Definition: ResourceLoaderFileModule.php:195
ResourceLoaderFileModule\$styles
$styles
Array: List of paths to CSS files to always include.
Definition: ResourceLoaderFileModule.php:83
CSSMin\remap
static remap( $source, $local, $remote, $embedData=true)
Remaps CSS URL paths and automatically embeds data URIs for CSS rules or url() values preceded by an ...
Definition: CSSMin.php:187
ResourceLoaderFileModule\$raw
$raw
Boolean: Whether mw.loader.state() call should be omitted.
Definition: ResourceLoaderFileModule.php:115
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
ResourceLoaderFileModule\getStyles
getStyles(ResourceLoaderContext $context)
Gets all styles for a given context concatenated together.
Definition: ResourceLoaderFileModule.php:317
$fallback
$fallback
Definition: MessagesAb.php:12
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1040
ResourceLoaderFileModule\getDependencies
getDependencies()
Gets list of names of modules this module depends on.
Definition: ResourceLoaderFileModule.php:394
ResourceLoaderFileModule\getScriptURLsForDebug
getScriptURLsForDebug(ResourceLoaderContext $context)
Definition: ResourceLoaderFileModule.php:284
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
ResourceLoaderFileModule\getFlip
getFlip( $context)
Get whether CSS for this module should be flipped.
Definition: ResourceLoaderFileModule.php:750
ResourceLoaderFileModule\$dependencies
$dependencies
Array: List of modules this module depends on.
Definition: ResourceLoaderFileModule.php:99
wfGetCache
wfGetCache( $inputType)
Get a cache object.
Definition: GlobalFunctions.php:3948
ResourceLoaderFileModule\getLoaderScript
getLoaderScript()
Gets loader script.
Definition: ResourceLoaderFileModule.php:304
ResourceLoaderFileModule\getDefinitionSummary
getDefinitionSummary(ResourceLoaderContext $context)
Get the definition summary for this module.
Definition: ResourceLoaderFileModule.php:482
ResourceLoaderFileModule\$scripts
$scripts
Array: List of paths to JavaScript files to always include.
Definition: ResourceLoaderFileModule.php:43
ResourceLoaderFileModule
ResourceLoader module based on local JavaScript/CSS files.
Definition: ResourceLoaderFileModule.php:28
ResourceLoaderFileModule\$debugRaw
$debugRaw
Boolean: Link to raw files in debug mode.
Definition: ResourceLoaderFileModule.php:113
CSSMin\getLocalFileReferences
static getLocalFileReferences( $source, $path=null)
Gets a list of local file paths which are referenced in a CSS style sheet.
Definition: CSSMin.php:71
FormatJson\encode
static encode( $value, $pretty=false, $escaping=0)
Returns the JSON representation of a value.
Definition: FormatJson.php:104
ResourceLoaderFileModule\$position
$position
String: Position on the page to load this module at.
Definition: ResourceLoaderFileModule.php:111
MWException
MediaWiki exception.
Definition: MWException.php:26
wfMemcKey
wfMemcKey()
Get a cache key.
Definition: GlobalFunctions.php:3571
ResourceLoaderFileModule\getGroup
getGroup()
Gets the name of the group this module should be loaded in.
Definition: ResourceLoaderFileModule.php:378
ResourceLoaderFileModule\$localFileRefs
$localFileRefs
Array: Place where readStyleFile() tracks file dependencies.
Definition: ResourceLoaderFileModule.php:139
ResourceLoaderModule\getDefinitionMtime
getDefinitionMtime(ResourceLoaderContext $context)
Helper method for calculating when this module's definition summary was last changed.
Definition: ResourceLoaderModule.php:447
ResourceLoaderFileModule\getAllStyleFiles
getAllStyleFiles()
Returns all style files used by this module.
Definition: ResourceLoaderFileModule.php:629
ResourceLoaderContext\getDebug
getDebug()
Definition: ResourceLoaderContext.php:182
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
ResourceLoaderFileModule\readStyleFiles
readStyleFiles(array $styles, $flip)
Gets the contents of a list of CSS files.
Definition: ResourceLoaderFileModule.php:684
ResourceLoaderFileModule\getStyleURLsForDebug
getStyleURLsForDebug(ResourceLoaderContext $context)
Definition: ResourceLoaderFileModule.php:346
ResourceLoaderFileModule\$languageScripts
$languageScripts
Array: List of JavaScript files to include when using a specific language.
Definition: ResourceLoaderFileModule.php:51
ResourceLoaderFileModule\getRemotePath
getRemotePath( $path)
Definition: ResourceLoaderFileModule.php:523
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ResourceLoaderFileModule\readStyleFile
readStyleFile( $path, $flip)
Reads a style file.
Definition: ResourceLoaderFileModule.php:710
ResourceLoaderFileModule\$targets
$targets
Definition: ResourceLoaderFileModule.php:116
ResourceLoaderFileModule\$messages
$messages
Array: List of message keys used by this module.
Definition: ResourceLoaderFileModule.php:107
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ResourceLoaderContext\getLanguage
getLanguage()
Definition: ResourceLoaderContext.php:143
ResourceLoaderFileModule\$loaderScripts
$loaderScripts
Array: List of paths to JavaScript files to include in the startup module.
Definition: ResourceLoaderFileModule.php:75
$options
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:1530
$value
$value
Definition: styleTest.css.php:45
ResourceLoaderFileModule\getTargets
getTargets()
Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile'].
Definition: ResourceLoaderFileModule.php:759
ResourceLoader\getLESSVars
static getLESSVars()
Get global LESS variables.
Definition: ResourceLoader.php:1316
ResourceLoaderFileModule\$hasGeneratedStyles
$hasGeneratedStyles
Boolean: Whether getStyleURLsForDebug should return raw file paths, or return load....
Definition: ResourceLoaderFileModule.php:122
CACHE_ANYTHING
const CACHE_ANYTHING
Definition: Defines.php:111
ResourceLoaderFileModule\readScriptFiles
readScriptFiles(array $scripts)
Gets the contents of a list of JavaScript files.
Definition: ResourceLoaderFileModule.php:649
PROTO_RELATIVE
const PROTO_RELATIVE
Definition: Defines.php:269
ResourceLoaderFileModule\$skinScripts
$skinScripts
Array: List of JavaScript files to include when using a specific skin.
Definition: ResourceLoaderFileModule.php:59
ResourceLoaderFileModule\collateFilePathListByOption
static collateFilePathListByOption(array $list, $option, $default)
Collates file paths by option (where provided).
Definition: ResourceLoaderFileModule.php:547
ResourceLoaderModule\validateScriptFile
validateScriptFile( $fileName, $contents)
Validate a given script file; if valid returns the original source.
Definition: ResourceLoaderModule.php:541
ResourceLoaderContext\getSkin
getSkin()
Definition: ResourceLoaderContext.php:168
ResourceLoaderFileModule\getLESSCacheKey
static getLESSCacheKey( $fileName)
Generate a cache key for a LESS file.
Definition: ResourceLoaderFileModule.php:773
scripts
The package scripts
Definition: README.txt:1
$hash
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks & $hash
Definition: hooks.txt:2697
ResourceLoaderModule\getMsgBlobMtime
getMsgBlobMtime( $lang)
Get the last modification timestamp of the message blob for this module in a given language.
Definition: ResourceLoaderModule.php:340
$summary
$summary
Definition: importImages.php:120
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
ResourceLoaderFileModule\getScriptFiles
getScriptFiles(ResourceLoaderContext $context)
Gets a list of file paths for all scripts in this module, in order of propper execution.
Definition: ResourceLoaderFileModule.php:595
ResourceLoader\getLessCompiler
static getLessCompiler()
Returns LESS compiler set up for use with MediaWiki.
Definition: ResourceLoader.php:1290
ResourceLoaderFileModule\getStyleSheetLang
getStyleSheetLang( $path)
Infer the stylesheet language from a stylesheet file path.
Definition: ResourceLoaderFileModule.php:534
ResourceLoaderFileModule\getLocalPath
getLocalPath( $path)
Definition: ResourceLoaderFileModule.php:515
ResourceLoaderFileModule\$modifiedTime
$modifiedTime
Array: Cache for mtime.
Definition: ResourceLoaderFileModule.php:131
ResourceLoaderModule
Abstraction for resource loader modules, with name registration and maxage functionality.
Definition: ResourceLoaderModule.php:28
ResourceLoaderFileModule\$remoteBasePath
$remoteBasePath
String: Remote base path, see __construct()
Definition: ResourceLoaderFileModule.php:35
$cache
$cache
Definition: mcc.php:32
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
ResourceLoaderFileModule\compileLESSFile
compileLESSFile( $fileName)
Compile a LESS file into CSS.
Definition: ResourceLoaderFileModule.php:794
ResourceLoaderFileModule\tryForKey
static tryForKey(array $list, $key, $fallback=null)
Gets a list of element that match a key, optionally using a fallback key.
Definition: ResourceLoaderFileModule.php:577
ResourceLoaderFileModule\$skinStyles
$skinStyles
Array: List of paths to CSS files to include when using specific skins.
Definition: ResourceLoaderFileModule.php:91
$path
$path
Definition: NoLocalSettings.php:35
as
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
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
CSSJanus\transform
static transform( $css, $swapLtrRtlInURL=false, $swapLeftRightInURL=false)
Transform an LTR stylesheet to RTL.
Definition: CSSJanus.php:139
ResourceLoaderFileModule\supportsURLLoading
supportsURLLoading()
Definition: ResourceLoaderFileModule.php:295
ResourceLoaderContext\getHash
getHash()
Definition: ResourceLoaderContext.php:231
$vars
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Definition: hooks.txt:1679
ResourceLoaderFileModule\getMessages
getMessages()
Gets list of message keys used by this module.
Definition: ResourceLoaderFileModule.php:369
$e
if( $useReadline) $e
Definition: eval.php:66
$IP
$IP
Definition: WebStart.php:88
ResourceLoaderFileModule\getStyleFiles
getStyleFiles(ResourceLoaderContext $context)
Gets a list of file paths for all styles in this module, in order of propper inclusion.
Definition: ResourceLoaderFileModule.php:614
ResourceLoaderModule\getFileDependencies
getFileDependencies( $skin)
Get the files this module depends on indirectly for a given skin.
Definition: ResourceLoaderModule.php:304
ResourceLoaderFileModule\getScript
getScript(ResourceLoaderContext $context)
Gets all scripts for a given context concatenated together.
Definition: ResourceLoaderFileModule.php:275
ResourceLoaderFileModule\$debugScripts
$debugScripts
Array: List of paths to JavaScript files to include in debug mode.
Definition: ResourceLoaderFileModule.php:67
ResourceLoaderModule\getName
getName()
Get this module's name.
Definition: ResourceLoaderModule.php:76
ResourceLoaderFileModule\isRaw
isRaw()
Definition: ResourceLoaderFileModule.php:401
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:497
ResourceLoaderFileModule\$group
$group
String: Name of group to load this module in.
Definition: ResourceLoaderFileModule.php:109