50 protected $origin = self::ORIGIN_USER_SITEWIDE;
79 $this->{$member} = $option;
108 $pages[$script] = [
'type' =>
'script' ];
113 foreach ( $this->styles
as $style ) {
114 $pages[$style] = [
'type' =>
'style' ];
172 wfDebugLog(
'resourceloader', __METHOD__ .
': failed to load content of JS/CSS page!' );
176 return $content->serialize( $format );
186 if (
$options[
'type'] !==
'script' ) {
190 if ( strval( $script ) !==
'' ) {
205 if (
$options[
'type'] !==
'style' ) {
210 if ( strval( $style ) ===
'' ) {
213 if ( $this->
getFlip( $context ) ) {
214 $style = CSSJanus::transform( $style,
true,
false );
217 [ $style,
false, $this->
getConfig()->
get(
'ScriptPath' ),
true ] );
218 if ( !isset(
$styles[$media] ) ) {
246 $summary = parent::getDefinitionSummary( $context );
248 'pages' => $this->
getPages( $context ),
263 if ( $this->
getGroup() ===
'user' ) {
264 foreach ( $revisions
as $revision ) {
265 if ( $revision[
'rev_len'] > 0 ) {
276 return count( $revisions ) === 0;
291 $pages = $this->
getPages( $context );
292 $key = implode(
'|', array_keys( $pages ) );
293 if ( !isset( $this->titleInfo[$key] ) ) {
294 $this->titleInfo[$key] = [];
296 foreach ( $pages
as $titleText =>
$options ) {
300 if ( !
$batch->isEmpty() ) {
301 $res =
$dbr->select( [
'page',
'revision' ],
303 [
'page_namespace',
'page_title',
'page_touched',
'rev_len',
'rev_sha1' ],
307 [
'revision' => [
'INNER JOIN', [
'page_latest=rev_id' ] ] ]
309 foreach (
$res as $row ) {
313 $this->titleInfo[$key][
$title->getPrefixedText()] = [
314 'rev_len' => $row->rev_len,
315 'rev_sha1' => $row->rev_sha1,
316 'page_touched' => $row->page_touched,
321 return $this->titleInfo[$key];
339 return ( $this->styles && !$this->
scripts ) ? self::LOAD_STYLES : self::LOAD_GENERAL;
Abstraction for ResourceLoader modules which pull from wiki pages.
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
getDB()
Get the Database object used in getTitleInfo().
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
__construct(array $options=null)
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target...
get($name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
Class representing a list of titles The execute() method checks them all for existence and adds them ...
wfDebugLog($logGroup, $text, $dest= 'all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
enableModuleContentVersion()
Disable module content versioning.
validateScriptFile($fileName, $contents)
Validate a given script file; if valid returns the original source.
getTitleInfo(ResourceLoaderContext $context)
Get the information about the wiki pages for a given context.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
string $position
Position on the page to load this module at.
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
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
getStyles(ResourceLoaderContext $context)
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
static makeComment($text)
Generate a CSS or JS comment block.
getScript(ResourceLoaderContext $context)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
isKnownEmpty(ResourceLoaderContext $context)
getGroup()
Get group name.
const CONTENT_FORMAT_JAVASCRIPT
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
getDefinitionSummary(ResourceLoaderContext $context)
getPages(ResourceLoaderContext $context)
Subclasses should return an associative array of resources in the module.
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
static call($callable, array $args=[], $ttl=3600)
Shortcut method for creating a MemoizedCallable and invoking it with the specified arguments...
Object passed around to modules which contains information about the state of a specific loader reque...