Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Extensions FAQ

From mediawiki.org
Translate this page
Languages:
Extensions:
MediaWiki extensions

Where can I find a list of installed extensions?

[edit]

TheSpecial:Version page on each wiki contains a list of extensions that have registered themselves with theMediaWiki software.All extensions can be installed without showing up onSpecial:Version, if the developer does notinclude the correct code to list it there.

How do I enable an extension?

[edit]

For most extensions, copy the extension PHP file (or directory) to yourextensions/ folder and add the following statement to yourLocalSettings.php, withExtensionName being the filename of your extension, such asMyExtension.php.

require_once"extensions/ExtensionName/ExtensionName.php";

Since1.25 (2015), there is a new way of installing extensions, which works with extensions that supportextension registration.The equivalent for the extension above would be:

wfLoadExtension('ExtensionName');

Some extensions, however, have additional steps and/or different installation procedures.Some extensions will contain a text-file namedREADME (sometimesINSTALL) that will have more detailed information about that extension.

See also:Manual:Extensions#Installing an extension

How do I write my own extension?

[edit]

SeeManual:Developing extensions.

How do I disable caching for pages using my extension?

[edit]

If you're writing e.g. special page:

global$wgOut;$wgOut->enableClientCache(false);

For parser tag hooks:

functionwfSomeHookFunction($parser,$foo,$bar){$parser->getOutput()->updateCacheExpiry(0);...}

In case your extension output is only dependent on some option or user context and not time, you can still let it get cached by the parser cache but make sure it's marked as one output variant (of many possible).Use thePageRenderingHash hook to influence the cache hash accordingly.

In older versions of MediaWiki, you would use$parser->disableCache() to disable caching, but this was deprecated in MW 1.28 and removed altogether in MW 1.35.

How do I render wikitext in my extension?

[edit]

Special pages

[edit]

When rendering output that will not be subject to parser cache, such as on a special page

global$wgOut;$wgOut->parse($text);

where$text is the wikitext to be parsed.

Parser hooks

[edit]

SeeManual:Tag extensions#How do I render wikitext in my extension?

How do I enable searching in my extension's output (dynamic content)?

[edit]

You can't. Dynamic content can not be included in a static index.

How can I avoid modification of my extension's HTML output?

[edit]

SeeManual:Tag extensions#How can I avoid modification of my extension's HTML output?

How can I pass XML-style parameters in my extension tag?

[edit]

SeeManual:Tag extensions#How can I pass XML-style parameters in my extension tag?

Extensions and Templates

[edit]

SeeManual:Tag extensions#Extensions and Templates

"NaodW..." or "UNIQ..."

[edit]

Your extension (or another one installed) might be usingparse() function instead ofrecursiveTagParse().Then change it torecursiveTagParse.


How can I determine in my extension, if an article is protected or not?

[edit]

Use the Title class and the isProtected( ) method, e.g.

functionextensionFunction(){# Assume $title is the title objectif($title->isProtected('edit')){# Protected from editing, do things}else{# Not protected from editing}}

What permissions do I apply to the extensions folder?

[edit]

All the scripts in the /wiki structure need to be readable and executable by the user that PHP runs as.All perms are usually 755 and owner/group being adifferent user.The LocalSettings.php file is created by the script on setup and so will be an example to set the rest by.

How do I get my extension to show up on Special:Version?

[edit]

SeeManual:Developing extensions#Registering features with MediaWiki

Retrieved from "https://www.mediawiki.org/w/index.php?title=Extensions_FAQ&oldid=7513489"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp