r48276 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48275‎ | r48276 | r48277 >
Date:18:57, 10 March 2009
Author:midom
Status:ok (Comments)
Tags:
Comment:
remove per-page editnotice functionality, message files and message cache are supposed to be global data.
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -426,7 +426,6 @@
427427
428428 # Optional notices on a per-namespace and per-page basis
429429 $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
430 - $editnotice_page = $editnotice_ns.'-'.$this->mTitle->getDBkey();
431430 if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) {
432431 $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) );
433432 }
@@ -439,8 +438,6 @@
440439 $wgOut->addWikiText( wfMsgForContent( $editnotice_base ) );
441440 }
442441 }
443 - } else if ( !wfEmptyMsg( $editnotice_page, wfMsgForContent( $editnotice_page ) ) ) {
444 - $wgOut->addWikiText( wfMsgForContent( $editnotice_page ) );
445442 }
446443
447444 # Attempt submission here. This will check for edit conflicts,

Follow-up revisions

RevisionCommit summaryAuthorDate
r97686Make per page edit notices work in namespaces without subpages enabled.bawolff00:19, 21 September 2011

Comments

#Comment by Anomie (talk | contribs)   12:46, 11 March 2009

Why remove per-page editnotices at all? But if you are going to remove them, why only remove them from namespaces without subpages enabled? And why not fix the comment on line 427 while you're at it?

#Comment by Midom (talk | contribs)   18:08, 11 March 2009

because. this feature introduced bad practices, message namespace and message cache should never be used for per-page dynamism of any sort. if you need, you can put editnotices in some subpage of project namespace, etc, and include them via template.

#Comment by Dragons flight (talk | contribs)   18:32, 11 March 2009

The editnotice is shown on the EditPage above the main edit window.

An example of this (which will disappear when this goes live) is the box above

ANI's edit page

Yes, this material could be moved out of the Mediawiki space, but I don't believe Mediawiki presently provides any natural alternative way to get a per page message into the space above the edit window. Am I wrong about that?

#Comment by Midom (talk | contribs)   14:25, 12 March 2009

mediawiki doesn't provide lots of things, that shouldn't be reason of allowing bad practices in.

oh, and this change is live anyway :)

#Comment by Dragons flight (talk | contribs)   16:36, 12 March 2009

I figured out my confusion. ANI's board is still live because your changes never disabled per page editnotices in namespaces that have subpages. The second jump in the diff above is hiding:

        if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
            $parts = explode( '/', $this->mTitle->getDBkey() );
            $editnotice_base = $editnotice_ns;
            while ( count( $parts ) > 0 ) {
                $editnotice_base .= '-'.array_shift( $parts );
                if ( !wfEmptyMsg( $editnotice_base, wfMsgForContent( $editnotice_base ) ) ) {
                    $wgOut->addWikiText( wfMsgForContent( $editnotice_base )  );
                }
            }
        }

Which generates per-page notices for namespaces with subpages. Was it intentional to leave that functionality in? Given your motivation, it seems more likely to be an accident.

#Comment by MZMcBride (talk | contribs)   18:32, 12 March 2009

The related bug regarding this is 15102.

#Comment by ViperSnake151 (talk | contribs)   22:24, 12 March 2009

Why not code some namespace for it?

#Comment by 😂 (talk | contribs)   00:51, 15 March 2009

A specific namespace just for edit notices? That's an even worse idea.

#Comment by Midom (talk | contribs)   06:33, 15 March 2009

What would make sense - ability to have protected subpages in certain namespace. Then one could do Project:Editnotices/Blah/Blah without fear of having vandals come and do bad things.

#Comment by Dragons flight (talk | contribs)   07:11, 15 March 2009

The Title Blacklist extension already provides that functionality.

#Comment by Midom (talk | contribs)   08:03, 15 March 2009

Here you go ;-)

#Comment by Sunwell5 (talk | contribs)   20:52, 15 March 2009

How do i get this to work?

#Comment by Catrope (talk | contribs)   09:58, 16 March 2009

Do you mean to ask how to get per-page editnotices to work? I guess putting {{Project:Editnotices/{{FULLPAGENAME}}}} (wrapped in an #ifexist for prettiness of course) in MediaWiki:editnotice would do.

#Comment by Dragons flight (talk | contribs)   10:17, 16 March 2009

Actually there doesn't appear to be a generic Mediawiki:editnotice. Rather there are a series of namespace notices, e.g. Mediawiki:editnotice-0, where the number is the namespace number. There are also other related messages, like the editing protected page message, but they aren't globally relevant.

Enwiki is headed in the direction you describe but currently going towards Template:Editnotices as the root rather than Project.

#Comment by Brion VIBBER (talk | contribs)   22:23, 21 September 2011

r97686 restores this with a tweak to normalize '/' chars into '-' -- should that stay or be reverted again?

#Comment by He7d3r (talk | contribs)   11:23, 30 December 2012

Status & tagging log