Hi, I was wondering if someone out there could please point out a better way to store some data I'm using in this extension.
The basic premise is to display a header or footer for all pages within a given namespace or category (it also allows a global one, or page specific). I decided to leverage MediaWiki's ability to edit pages to store the actual headers and footers, which made a lot of sense because they are wikitext.
I obviously don't want them searched, so at first I put them in NS_MEDIAWIKI. The urls look something like: MediaWiki:HeadersFooters/Cat/<catname>/Header
Alphos and bawolff pointed out in IRC that if I was going to use NS_MEDIAWIKI I should make them more message like... so I've converted to: MediaWiki:headersfooters-cat-<catname>-header
And I'm checking if the message exists before fetching the contents using wfMsgForContentNoTrans. This is interesting because technically an administrator could make some multi-langual messages in the i18n file manually. A potential problem is that as far as I know messages aren't really supposed to be mixed case, and a category name inserted into <catname> could definitely have some uppercase letters in it.
Reedy in IRC mentioned this was all awful, but didn't offer any suggestions when I asked.
Another idea I had was to store these messages as pages in a custom namespace, like HeadersFooters:Cat/<catname>/Header -- although I have no clue how I would go about making my extension add a new custom namespace without the admin having to go and make them herself, so some information about this would be much appreciated.
Yet another would be to store them in a new database table, but this sounds really clunky and icky, but maybe I'm wrong and it's slick? It would necesitate I create all these editing and management pages for the new table.
I'm designing a SpecialPage to make sure users can make these headers and footers more easily.
Does anyone have any suggestions for me? Anything would be appreciated, - Olivier Finlay Beaton
Olivier Beaton wrote:
Alphos and bawolff pointed out in IRC that if I was going to use NS_MEDIAWIKI I should make them more message like... so I've converted to: MediaWiki:headersfooters-cat-<catname>-header
And I'm checking if the message exists before fetching the contents using wfMsgForContentNoTrans. This is interesting because technically an administrator could make some multi-langual messages in the i18n file manually. A potential problem is that as far as I know messages aren't really supposed to be mixed case, and a category name inserted into<catname> could definitely have some uppercase letters in it.
Having message names all lowercase is a convention, but uppercase text in the middle of the name should work (actually, it may work too well, as you may want to ignore the case of the first character in catname).
wikitech-l@lists.wikimedia.org