Manual talk:Developing extensions

From MediaWiki.org
Jump to: navigation, search

This section could use a tutorial if anyone feels inclined to write one. --Sjledet 21:57, 22 January 2011 (UTC)

Well, lets start small... How do I Making your extension user configurable? --Dmb 16:18, 22 April 2011 (UTC)
BTW, There is a tutorial (of sorts) here: How_to_become_a_MediaWiki_hacker/Extension_Writing_Tutorial --Dan Bolser (talk) 04:24, 16 February 2013 (UTC)

Canonical extension 'setup' script?[edit | edit source]

I know different extension types need different extension types require different setup, but I wan't to create a nice 'template' setup script where sections you don't need can be commented out...

There is a good example of a ParserFunction type extension here: Manual:Parser_functions.

Best place for storing generated files[edit | edit source]

Hello all, is there a best practice where to store files that belong to an extension? I would suppose they should be stored in a subdirectory of $wgUploadDirectory (e. g. $IP/images/myextension/... ). Is that a recommended approach? --Pigpen (talk) 16:28, 20 March 2013 (UTC)

Disable caching while developing[edit | edit source]

Sorry for my bad English.

"While developing, you may want to disable caching by setting $wgMainCacheType = CACHE_NONE and $wgCacheDirectory = false, otherwise system message and other changes may not show up."

Localisation cache still enebled in Db, or not?

This will not affect on Localisation сache because in "includes/DefaultSettings.php(1844)": $wgLocalisationCacheConf = array( 'class' => 'LocalisationCache', 'store' => 'detect', 'storeClass' => false, 'storeDirectory' => false, 'manualRecache' => false, ); "* store: The location to store cache data. May be 'files', 'db' or * 'detect'. If set to "files", data will be in CDB files. If set * to "db", data will be stored to the database. If set to * "detect", files will be used if $wgCacheDirectory is set, * otherwise the database will be used."

But in http://www.mediawiki.org/wiki/Manual:$wgCacheDirectory "Set this to false to not use any local caches." And in http://www.mediawiki.org/wiki/Manual:Cache#Localization_caching "After finding out that a large number of the cached objects above were interface messages, the bits of text that are not content, an advanced localisation cache was introduced. Set $wgCacheDirectory in LocalSettings.php to a valid path to use."

As I understand it, initialy Localisation cache store only in filesystem, and $wgCacheDirectory used as trigger for disable/enable Localisation cache. But than by adding future for storing localisation cache in datebase and by mistake continue use $wgCacheDirectory as trigger. Therefore currently with parameters $wgMainCacheType = CACHE_NONE and $wgCacheDirectory = false Localisation Cache is still enebled and use datebase. This may confuse extention developers. (Its confuse me when I set hook $wgHooks['MessagesPreLoad'][] that not work, thanx debugging i find table with cache and modify exprie column, for row with cached messages).

Is currently there a way to disable localisation cache?

how to upload code to extension page[edit | edit source]

I have built an extension I would like to share, I've created an extension page and I would like to upload my code to the page so users can download a 'snapshot'. I've submitted a request to 'tool labs' for a gir repository but I'm not sure if I did it correctly as I haven't heard back from them in months. How do I go about adding my code to my new extension? Thanks --Tech (talk) 09:10, 24 June 2013 (UTC)