FAQ dotyczące rozszerzeń

From mediawiki.org
This page is a translated version of the page Extensions FAQ and the translation is 59% complete.
Rozszerzenia MediaWiki

Gdzie mogę zobaczyć listę zainstalowanych rozszerzeń?

The Special:Version page on each wiki contains a list of extensions that have registered themselves with the MediaWiki software. Wszystkie rozszerzenia można zainstalować tak, aby nie pokazywały się na Special:Version jeśli twórca nie doda odpowiedniego kodu, który powoduje wyświetlanie na tej liście.

Jak mogę włączyć rozszerzenie?

For most extensions, copy the extension PHP file (or directory) to your extensions/ folder and add the following statement to your LocalSettings.php , with ExtensionName being the filename of your extension, such as MyExtension.php.

require_once "extensions/ExtensionName/ExtensionName.php";

Since 1.25 (2015), there is a new way of installing extensions, which works with extensions that support extension registration. Odpowiednik dla powyższego rozszerzenia to:

wfLoadExtension('ExtensionName');

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

Zobacz też: Manual:Extensions#Installing an extension

Jak napisać moje własne rozszerzenie?

Zobacz Podręcznik:Tworzenie rozszerzeń .

Jak mogę wyłączyć cache'owanie stron korzystających z mojego rozszerzenia?

Jeżeli tworzysz np. stronę specjalną:

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

Dla haków tagów parsera:

function wfSomeHookFunction( $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 the PageRenderingHash 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.

Jak renderować wikitekst za pomocą mojego rozszerzenia?

Strony specjalne

Jeżeli renderowany jest kod wyjściowy nie będący przedmiotem działania cache analizatora, np. na stronach specjalnych:

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

where $text is the wikitext to be parsed.

Haki parsera

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

Jak mogę włączyć wyszukiwanie w zawartości wyjściowej rozszerzenia (dynamiczna zawartość)?

Jest to niemożliwe. Dynamiczna zawartość nie może być zawarta w indeksie statycznym wyszukiwarki.

Jak mogę zapobiec modyfikacji wyjściowego kodu HTML rozszerzenia?

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

Jak mogę przetwarzać parametry XML w rozszerzeniach znaczników?

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

Rozszerzenia i Szablony

See Manual:Tag extensions#Extensions and Templates

"NaodW..." lub "UNIQ..."

Your extension (or another one installed) might be using parse() function instead of recursiveTagParse(). Then change it to recursiveTagParse (using the parser given in parameter or $wgParser).

Jak z poziomu mojego rozszerzenia mogę określić czy strona jest zabezpieczona czy nie?

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

function extensionFunction() {
   # Przy założeniu że $title jest obiektem klasy Title.
   if( $title->isProtected( 'edit' ) ) {
      # Zabezpieczona przed edycją
   } else {
      # Nie zabezpieczona przed edycją
   }
}

Jakie prawa ustawić na katalog extensions?

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 a different user. The LocalSettings.php file is created by the script on setup and so will be an example to set the rest by.

Jak mogę ukazać moje rozszerzenie w Special:Version?

See Manual:Developing extensions#Registering features with MediaWiki