MediaWiki
1.23.5
|
Abstraction for resource loader modules which pull from wiki pages. More...
Public Member Functions | |
getDefinitionSummary (ResourceLoaderContext $context) | |
Get the definition summary for this module. More... | |
getModifiedTime (ResourceLoaderContext $context) | |
getScript (ResourceLoaderContext $context) | |
getStyles (ResourceLoaderContext $context) | |
isKnownEmpty (ResourceLoaderContext $context) | |
Public Member Functions inherited from ResourceLoaderModule | |
getDefinitionMtime (ResourceLoaderContext $context) | |
Helper method for calculating when this module's definition summary was last changed. More... | |
getDependencies () | |
Get a list of modules this module depends on. More... | |
getFileDependencies ( $skin) | |
Get the files this module depends on indirectly for a given skin. More... | |
getFlip ( $context) | |
getGroup () | |
Get the group this module is in. More... | |
getHashMtime (ResourceLoaderContext $context) | |
Helper method for calculating when the module's hash (if it has one) changed. More... | |
getLoaderScript () | |
Get the loader JS for this module, if set. More... | |
getMessages () | |
Get the messages needed for this module. More... | |
getModifiedHash (ResourceLoaderContext $context) | |
Get the hash for whatever this module may contain. More... | |
getMsgBlobMtime ( $lang) | |
Get the last modification timestamp of the message blob for this module in a given language. More... | |
getName () | |
Get this module's name. More... | |
getOrigin () | |
Get this module's origin. More... | |
getPosition () | |
Where on the HTML page should this module's JS be loaded? More... | |
getScriptURLsForDebug (ResourceLoaderContext $context) | |
Get the URL or URLs to load for this module's JS in debug mode. More... | |
getSource () | |
Get the origin of this module. More... | |
getStyleURLsForDebug (ResourceLoaderContext $context) | |
Get the URL or URLs to load for this module's CSS in debug mode. More... | |
getTargets () | |
Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']. More... | |
isRaw () | |
Whether this module's JS expects to work without the client-side ResourceLoader module. More... | |
setFileDependencies ( $skin, $deps) | |
Set preloaded file dependency information. More... | |
setMsgBlobMtime ( $lang, $mtime) | |
Set a preloaded message blob last modification timestamp. More... | |
setName ( $name) | |
Set this module's name. More... | |
setOrigin ( $origin) | |
Set this module's origin. More... | |
supportsURLLoading () | |
Whether this module supports URL loading. More... | |
Protected Member Functions | |
getContent ( $title) | |
getDB () | |
Get the Database object used in getTitleMTimes(). More... | |
getPages (ResourceLoaderContext $context) | |
Subclasses should return an associative array of resources in the module. More... | |
getTitleMtimes (ResourceLoaderContext $context) | |
Get the modification times of all titles that would be loaded for a given context. More... | |
Protected Member Functions inherited from ResourceLoaderModule | |
validateScriptFile ( $fileName, $contents) | |
Validate a given script file; if valid returns the original source. More... | |
Protected Attributes | |
$origin = self::ORIGIN_USER_SITEWIDE | |
$titleMtimes = array() | |
Protected Attributes inherited from ResourceLoaderModule | |
$fileDeps = array() | |
$msgBlobMtime = array() | |
$name = null | |
$origin = self::ORIGIN_CORE_SITEWIDE | |
$targets = array( 'desktop' ) | |
Additional Inherited Members | |
Public Attributes inherited from ResourceLoaderModule | |
const | ORIGIN_ALL = 10 |
const | ORIGIN_CORE_INDIVIDUAL = 2 |
const | ORIGIN_CORE_SITEWIDE = 1 |
const | ORIGIN_USER_INDIVIDUAL = 4 |
const | ORIGIN_USER_SITEWIDE = 3 |
const | TYPE_COMBINED = 'combined' |
const | TYPE_MESSAGES = 'messages' |
const | TYPE_SCRIPTS = 'scripts' |
const | TYPE_STYLES = 'styles' |
Static Protected Member Functions inherited from ResourceLoaderModule | |
static | javaScriptParser () |
static | safeFilemtime ( $filename) |
Safe version of filemtime(), which doesn't throw a PHP warning if the file doesn't exist but returns 1 instead. More... | |
Abstraction for resource loader modules which pull from wiki pages.
This can only be used for wiki pages in the MediaWiki and User namespaces, because of its dependence on the functionality of Title::isCssJsSubpage.
Definition at line 32 of file ResourceLoaderWikiModule.php.
|
protected |
$title | Title |
Definition at line 83 of file ResourceLoaderWikiModule.php.
References $title, CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, Revision\newFromTitle(), Revision\RAW, IDBAccessObject\READ_NORMAL, and wfDebugLog().
Referenced by getScript(), and getStyles().
|
protected |
Get the Database object used in getTitleMTimes().
Defaults to the local slave DB but subclasses may want to override this to return a remote DB object, or to return null if getTitleMTimes() shouldn't access the DB at all.
NOTE: This ONLY works for getTitleMTimes() and getModifiedTime(), NOT FOR ANYTHING ELSE. In particular, it doesn't work for getting the content of JS and CSS pages. That functionality will use the local DB irrespective of the return value of this method.
Definition at line 75 of file ResourceLoaderWikiModule.php.
References DB_SLAVE, and wfGetDB().
Referenced by getTitleMtimes().
ResourceLoaderWikiModule::getDefinitionSummary | ( | ResourceLoaderContext | $context | ) |
Get the definition summary for this module.
Reimplemented from ResourceLoaderModule.
Definition at line 196 of file ResourceLoaderWikiModule.php.
References array(), and getPages().
ResourceLoaderWikiModule::getModifiedTime | ( | ResourceLoaderContext | $context | ) |
$context | ResourceLoaderContext |
Reimplemented from ResourceLoaderModule.
Definition at line 177 of file ResourceLoaderWikiModule.php.
References ResourceLoaderModule\getDefinitionMtime(), ResourceLoaderContext\getLanguage(), ResourceLoaderModule\getMsgBlobMtime(), and getTitleMtimes().
|
abstractprotected |
Subclasses should return an associative array of resources in the module.
Keys should be the title of a page in the MediaWiki or User namespace.
Values should be a nested array of options. The supported keys are 'type' and (CSS only) 'media'.
For scripts, 'type' should be 'script'.
For stylesheets, 'type' should be 'style'. There is an optional media key, the value of which can be the medium ('screen', 'print', etc.) of the stylesheet.
$context | ResourceLoaderContext |
Reimplemented in ResourceLoaderNoscriptModule, ResourceLoaderUserModule, ResourceLoaderSiteModule, ResourceLoaderUserGroupsModule, and ResourceLoaderFilePageModule.
Referenced by getDefinitionSummary(), getScript(), getStyles(), and getTitleMtimes().
ResourceLoaderWikiModule::getScript | ( | ResourceLoaderContext | $context | ) |
$context | ResourceLoaderContext |
Reimplemented from ResourceLoaderModule.
Definition at line 115 of file ResourceLoaderWikiModule.php.
References $options, $title, as, getContent(), getPages(), Title\newFromText(), and ResourceLoaderModule\validateScriptFile().
ResourceLoaderWikiModule::getStyles | ( | ResourceLoaderContext | $context | ) |
$context | ResourceLoaderContext |
Reimplemented from ResourceLoaderModule.
Definition at line 141 of file ResourceLoaderWikiModule.php.
References $options, $title, array(), as, getContent(), ResourceLoaderModule\getFlip(), getPages(), global, Title\newFromText(), CSSMin\remap(), and CSSJanus\transform().
|
protected |
Get the modification times of all titles that would be loaded for a given context.
$context | ResourceLoaderContext: Context object |
Definition at line 217 of file ResourceLoaderWikiModule.php.
References $batch, $dbr, $hash, $options, $res, $title, array(), as, getDB(), ResourceLoaderContext\getHash(), getPages(), Title\makeTitle(), Title\newFromText(), TS_UNIX, and wfTimestamp().
Referenced by getModifiedTime(), and isKnownEmpty().
ResourceLoaderWikiModule::isKnownEmpty | ( | ResourceLoaderContext | $context | ) |
$context | ResourceLoaderContext |
Reimplemented from ResourceLoaderModule.
Definition at line 207 of file ResourceLoaderWikiModule.php.
References getTitleMtimes().
|
protected |
Definition at line 37 of file ResourceLoaderWikiModule.php.
|
protected |
Definition at line 40 of file ResourceLoaderWikiModule.php.