MediaWiki  REL1_22
ResourceLoaderWikiModule Class Reference

Abstraction for resource loader modules which pull from wiki pages. More...

Inheritance diagram for ResourceLoaderWikiModule:
Collaboration diagram for ResourceLoaderWikiModule:

List of all members.

Public Member Functions

 getModifiedTime (ResourceLoaderContext $context)
 getScript (ResourceLoaderContext $context)
 getStyles (ResourceLoaderContext $context)
 isKnownEmpty (ResourceLoaderContext $context)

Protected Member Functions

 getContent ($title)
 getDB ()
 Get the Database object used in getTitleMTimes().
 getPages (ResourceLoaderContext $context)
 Subclasses should return an associative array of resources in the module.
 getTitleMtimes (ResourceLoaderContext $context)
 Get the modification times of all titles that would be loaded for a given context.

Protected Attributes

 $origin = self::ORIGIN_USER_SITEWIDE
 $titleMtimes = array()

Detailed Description

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.


Member Function Documentation

ResourceLoaderWikiModule::getContent ( title) [protected]
Parameters:
$titleTitle
Returns:
null|string

Definition at line 83 of file ResourceLoaderWikiModule.php.

References $title, Revision\newFromTitle(), Revision\RAW, IDBAccessObject\READ_NORMAL, and wfDebugLog().

Referenced by getScript(), and getStyles().

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.

Returns:
DatabaseBase|null

Definition at line 75 of file ResourceLoaderWikiModule.php.

References wfGetDB().

Referenced by getTitleMtimes().

ResourceLoaderWikiModule::getPages ( ResourceLoaderContext context) [abstract, protected]

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.

Parameters:
$contextResourceLoaderContext
Returns:
array

Reimplemented in ResourceLoaderNoscriptModule, ResourceLoaderSiteModule, ResourceLoaderUserModule, ResourceLoaderUserGroupsModule, and ResourceLoaderFilePageModule.

Referenced by getScript(), getStyles(), and getTitleMtimes().

Get the modification times of all titles that would be loaded for a given context.

Parameters:
$contextResourceLoaderContext: Context object
Returns:
array( prefixed DB key => UNIX timestamp ), nonexistent titles are dropped

Definition at line 201 of file ResourceLoaderWikiModule.php.

References $batch, $dbr, $hash, $options, $res, $title, array(), as, getDB(), ResourceLoaderContext\getHash(), getPages(), Title\makeTitle(), Title\newFromText(), and wfTimestamp().

Referenced by getModifiedTime(), and isKnownEmpty().

Parameters:
$contextResourceLoaderContext
Returns:
bool

Reimplemented from ResourceLoaderModule.

Definition at line 191 of file ResourceLoaderWikiModule.php.

References getTitleMtimes().


Member Data Documentation

ResourceLoaderWikiModule::$origin = self::ORIGIN_USER_SITEWIDE [protected]

Reimplemented from ResourceLoaderModule.

Reimplemented in ResourceLoaderUserModule, and ResourceLoaderUserGroupsModule.

Definition at line 37 of file ResourceLoaderWikiModule.php.

ResourceLoaderWikiModule::$titleMtimes = array() [protected]

Definition at line 40 of file ResourceLoaderWikiModule.php.


The documentation for this class was generated from the following file: