enterprisemediawiki / HeaderFooter

Add common headers and footers to MediaWiki pages
http://www.mediawiki.org/wiki/Extension:Header_Footer
6 stars 18 forks source link

Use another namespace than MediaWiki: to avoid performance conflict with MessageCache #33

Open Seb35 opened 2 years ago

Seb35 commented 2 years ago

By default HeaderFooter uses pages like MediaWiki:Hf-header-page name. This is fine when there are only a few such pages, but when there is a great number of pages it adds a performance hit to the MessageCache mechanism of MediaWiki, which loads all pages in the MediaWiki: namespace (see method MessageCache::loadFromDB()).

To give figures, my company Wiki Valley hosts Everybodywiki, where HeaderFooter is used on almost every page (each with a dedicated HeaderFooter page): there are currently about 140,000 HeaderFooter pages, and MessageCache::loadFromDB() spend 44 seconds to be loaded instead of a few milliseconds for wikis without HeaderFooter.

So I propose to create a configuration parameter to define the namespace: $wgHeaderFooterNamespace = NS_MEDIAWIKI; by default but it could be set (e.g.) to $wgHeaderFooterNamespace = NS_PROJECT; to use pages like Project:Hf-header-page name. I developed such patch and it is currently deployed on Everybodywiki if you search the HeaderFooter pages there; I will submit this patch as a Pull Request.