Page MenuHomePhabricator

Add a new MediaWiki system message as a content header inside #mw-content-text
Open, Needs TriagePublic

Description

There should be a MediaWiki system message (named, for example, content-header) that appeared inside #mw-content-text, just at the beginning, before the rest of the content.

This "message" would be empty by default and, as usual, its contents would be determined by a certain page in the MediaWiki namespace.

For the equivalent footer in #mw-content-text, see T138652.

Event Timeline

Hello, I am Jake and here to help. What do you need help on?

Hi, @JakeTheDeveloper! Perhaps you could help on T138652, which is the equivalent task, but more urgent. Many thanks in advance! :D

This is a job for a Developer. Sorry I could not help. Here, I contacted a developer for you.

[offtopic] @JakeTheDeveloper: For your info, the Developer-notice tag is not meant for "contacting a developer" - see its project description. Basically every task needs a developer so there is no specific tag.

Hello! Gerrit is acting funny on large pages so I wrote a theoretical piece of code that should hopefully work but I have no way to test it.
/includes/Page/Article.php line 1136, function showNamespaceHeader(), add the following after the previous if statement:

if ( !$this->getTitle()->isTalkPage() && !$this->getTitle()->isSpecialPage() && !wfMessage( 'content-header' )->isDisabled() ) {
	$this->getContext()->getOutput()->wrapWikiMsg(
		"<div class=\"mw-content-header\">\n$1\n</div>",
		[ 'content-header' ]
	);
}

Also add a line to languages/i18n/en.json:

"content-header": "-",

and to languages/i18n/qqq.json:

"content-header": "{{notranslate}}",

Thanks for taking a look at the code. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader.

A friend tested this change for me (thanks @Aca ), everything seems fine so Imma go ahead and try to upload the patch. Fingers crossed!

Change 714448 had a related patch set uploaded (by Gerrit Patch Uploader; author: Ivi104):

[mediawiki/core@master] New MW message for content namespaces: MediaWiki:Content-header

https://gerrit.wikimedia.org/r/714448

@Aklapper I uploaded the main change, but am unable to upload languages/i18n/en.json nor languages/i18n/qqq.json due to 502 Bad Gateway. Could you or someone else add the new message and upload them for me? The changes are listed in a previous comment.

Same problem on the Gerrit's web interface. Sorry, unable to help.

(If there is some problem with Gerrit, could you please bring it up on https://www.mediawiki.org/wiki/Talk:Gerrit/Troubleshooting with more info? Thanks.)

502 error with Gerrit is probably better to be filed on Phabricator, not on the talk page...

Change 715147 had a related patch set uploaded (by Gerrit Patch Uploader; author: Ivi104):

[mediawiki/core@master] New MW message for content namespaces: MediaWiki:Content-header

https://gerrit.wikimedia.org/r/715147

This is the correct patch, containing everything. I tested it on my local installation, everything works. I am unable to abandon the previous patch (714448), presumably because it was uploaded via Gerrit Patch Uploader.

Change 714448 abandoned by Aklapper:

[mediawiki/core@master] New MW message for content namespaces: MediaWiki:Content-header

Reason:

Superseded by https://gerrit.wikimedia.org/r/715147

https://gerrit.wikimedia.org/r/714448

Regarding the relationship with T6469 – that adds a namespace-specific sitenotice, which would be cached once per namespace view so is very performant. But the caching implies that we cannot use {{PAGENAME}} or other magic words whose value differ between pages in the namespace.

This task is for adding a header in the content area which would be cached along with the page content – hence enabling the use of {{PAGENAME}} and the like. This is still desirable functionality in addition to that one, though I wonder if this has any performance implications.

What would this message be used for?