r105664 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105663‎ | r105664 | r105665 >
Date:10:32, 9 December 2011
Author:tstarling
Status:reverted (Comments)
Tags:
Comment:
* Revert r103476, r105161 and implement the fix for bug 32858 (a.k.a. bug 32450) in WikiPage instead. See comment 14 for further rationale.
* Clarified release notes. Please write what the new code does, not the bug description.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -156,7 +156,8 @@
157157 * (bug 32168) Add wfAssembleUrl for use in wfExpandUrl.
158158 * (bug 32168) fixed - wfExpandUrl expands dot segments now.
159159 * (bug 31535) Upload comments now truncated properly, and don't have brackets.
160 -* (bug 32450) Scripts pages in MediaWiki: namespace parse [[Category:#]] links.
 160+* (bug 32858) Do not register links, categories, etc. from CSS/JS pages in the
 161+ database.
161162 * (bug 32086) Special:PermanentLink now show an error message when no subpage
162163 was specified.
163164 * (bug 30368) Special:Newpages now shows the new page name for moved pages.
Index: trunk/phase3/tests/parser/parserTests.txt
@@ -8993,28 +8993,6 @@
89948994
89958995 !! end
89968996
8997 -!! test
8998 -Bug 32450: MediaWiki: js pages should ignore Category syntax
8999 -!! options
9000 -title=[[MediaWiki:bug32450.js]]
9001 -!! input
9002 -var foo = "[[Category:bug32450]]"
9003 -!! result
9004 -<p>var foo = "[[Category:bug32450]]"
9005 -</p>
9006 -!! end
9007 -
9008 -!! test
9009 -Bug 32450: MediaWiki: css pages should ignore Category syntax
9010 -!! options
9011 -title=[[MediaWiki:bug32450.css]]
9012 -!! input
9013 -/** Css comment: "[[Category:bug32450]]" */
9014 -!! result
9015 -<p>/** Css comment: "[[Category:bug32450]]" */
9016 -</p>
9017 -!! end
9018 -
90198997 TODO:
90208998 more images
90218999 more tables
Index: trunk/phase3/includes/parser/Parser.php
@@ -1643,12 +1643,6 @@
16441644 * @private
16451645 */
16461646 function replaceInternalLinks( $s ) {
1647 - if( $this->getTitle()->isCssOrJsPage() ) {
1648 - # bug 32450 : js and script pages in MediaWiki: namespace do not want
1649 - # to get their code or comments altered. Think about js string:
1650 - # var foobar = "[[Category:" + $catname + "]];
1651 - return $s;
1652 - }
16531647 $this->mLinkHolders->merge( $this->replaceInternalLinks2( $s ) );
16541648 return $s;
16551649 }
Index: trunk/phase3/includes/WikiPage.php
@@ -2018,7 +2018,18 @@
20192019 $edit->newText = $text;
20202020 $edit->pst = $wgParser->preSaveTransform( $text, $this->mTitle, $user, $popts );
20212021 $edit->popts = $this->makeParserOptions( 'canonical' );
2022 - $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $edit->popts, true, true, $revid );
 2022+
 2023+ // Bug 32858: For a CSS/JS page, put a blank parser output into the
 2024+ // prepared edit, so that links etc. won't be registered in the
 2025+ // database. We could have set $edit->output to false or something if
 2026+ // we thought of this bug earlier, but now that would break the
 2027+ // interface with AbuseFilter etc.
 2028+ if ( $this->mTitle->isCssOrJsPage() || $this->getTitle()->isCssJsSubpage() ) {
 2029+ $input = '';
 2030+ } else {
 2031+ $input = $edit->pst;
 2032+ }
 2033+ $edit->output = $wgParser->parse( $input, $this->mTitle, $edit->popts, true, true, $revid );
20232034 $edit->oldText = $this->getRawText();
20242035
20252036 $this->mPreparedEdit = $edit;

Follow-up revisions

RevisionCommit summaryAuthorDate
r107449Revert the fix for bug 32858 (r105664, r105161, r103476): no consensus, backw...tstarling22:50, 27 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103476(bug 32450) MediaWiki: .js|.css pages parsed [[Category:#]] links...hashar16:46, 17 November 2011
r105161Skip replaceInternalLinks2 for js/css pages...hashar10:14, 5 December 2011

Comments

#Comment by Schnark (talk | contribs)   08:21, 12 December 2011

As an author of quite some user scripts I really dislike this change. It is very important for me to find out who is using my scripts by looking at the backlinks. It allows me to decide if backwards compatibility is needed, to find bugs the users don't report to me (I had never found out that in some cases one of my scripts edited User_talk:Undefined otherwise), etc.

Responsible users know that they must put their scripts in nowiki-tags, at least the German documentation mentions this fact.

Okay, some scripts pollute the tables, because some users forgot to wrap their scripts with nowiki-tags, but what's the problem with that? I can pollute the tables by random stuff on my user page, the tables are polluted by users forgetting the colon before interwikilinks: [1]. So this change won't stop unwanted links from showing up in the tables.

As long as there isn't a good alternative to find out who is using one's scripts, this feature shouldn't be disabled. At least the text inside javascript comments should still be parsed as it was also mentioned in the bug.

This change has another serious problem: It breaks Extension:SpamBlacklist. Steps to reproduce:

  1. Create User:NAME/spam with {{User:NAME/spam.js}}
  2. Create User:NAME/spam.js with [some blocked URL]
  3. Purge User:NAME/spam

Before this change the edit in step 2 was denied, after this change the edit is allowed, the link shows up on the user page. (Note: You can't swap step 1 and 2, this will still trigger SBL.)

#Comment by Tim Starling (talk | contribs)   09:35, 12 December 2011

Can you copy your comment to bug 32858?

#Comment by P858snake (talk | contribs)   09:20, 12 December 2011

.

#Comment by He7d3r (talk | contribs)   15:32, 18 October 2012

Ignore this comment (aka bugzilla:22094)

Status & tagging log