r110716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110715‎ | r110716 | r110717 >
Date:11:00, 5 February 2012
Author:wikinaut
Status:ok (Comments)
Tags:
Comment:
Please review carefully, I cannot see negative side effects from this patch. It gives extensions which use the (depreacted) UnknownAction hook a chance to see the original action= value. This fixes bug 34203 and bug 34161 UnknownAction hook problem: the hook must pass the unknown action to the callee and not the value "nosuchaction"
Modified paths:
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Wiki.php
@@ -486,7 +486,7 @@
487487 return;
488488 }
489489
490 - if ( wfRunHooks( 'UnknownAction', array( $act, $page ) ) ) {
 490+ if ( wfRunHooks( 'UnknownAction', array( $request->getVal( 'action', 'view' ), $page ) ) ) {
491491 $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
492492 }
493493

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109678Reinstate r109223 per CR + fixes...krinkle06:57, 21 January 2012

Comments

#Comment by Aaron Schulz (talk | contribs)   20:40, 5 February 2012

Why not just add it as a third param to avoid breakage? What are the callers remaining?

#Comment by Wikinaut (talk | contribs)   20:44, 5 February 2012

No, this would break everything! See https://www.mediawiki.org/wiki/Manual:Hooks/UnknownAction how it was since years (first parameter is the original &action=value

#Comment by Aaron Schulz (talk | contribs)   20:47, 5 February 2012

Which revision did it change in?

#Comment by Wikinaut (talk | contribs)   20:56, 5 February 2012

I have no idea when this broke (in Wiki.php). Only those extensions are(were) affected which use the hook

https://www.mediawiki.org/wiki/Category:UnknownAction_extensions

For example, I debugged and fixed https://www.mediawiki.org/wiki/Extension:WikiArticleFeeds and found the problem with $act. This extension was working for years but stopped working when I upgraded to trunk version.

#Comment by Wikinaut (talk | contribs)   21:04, 5 February 2012

I really think, it's okay, as I verbatim copied the essential part out of the (previously called) getActionName() function line 102, when the action value is read from the request.

#Comment by Aaron Schulz (talk | contribs)   21:02, 5 February 2012

See https://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_18/phase3/includes/Wiki.php?revision=107907&view=markup

In 1.18 $act was the result of getAction(), which isn't quite the same as what happens here.

#Comment by Wikinaut (talk | contribs)   21:05, 5 February 2012

But please try to understand the logic of the hook. It makes only sense to pass the original action value, as is documented in the Manual page.

#Comment by Wikinaut (talk | contribs)   21:06, 5 February 2012

So either the core code was wrong, or the Manual page. Please try to follow the logic of an Extension like WikiArticleFeeds (which triggers upon &action=feed ,. it did this for years, and could not be wrong)

#Comment by Wikinaut (talk | contribs)   21:11, 5 February 2012

Thanks.

As an additional argument for my patch, please see line 310 in https://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php?annotate=110721

if ( $action != 'feed' ) return true;

So, an extension which consumes the UnknownAction hook must be able to read the original action value (even when this is "nosuchaction" for MW core).

I am convinced, that all the https://www.mediawiki.org/wiki/Category:UnknownAction_extensions Extensions were probably broken between 1.18 and revision r110716 .

#Comment by Wikinaut (talk | contribs)   21:27, 5 February 2012

I reset my patch "new", because the performance impact of the additional "$request->getVal( 'action', 'view' )" should be discussed; my patch should of course not degrade MW core performance.

Can someone say some words (and hopefully take away my concerns regarding mw performance degradation) ?

#Comment by Aaron Schulz (talk | contribs)   22:07, 5 February 2012

How would that effect performance? getVal() is just quick that function that works on the $_GET global. It has negligible speed impact.

#Comment by Wikinaut (talk | contribs)   00:23, 6 February 2012

Ok, fine. I was just not sure about this. I would like to ask you to set CR status now finally to "ok" again, thanks.

#Comment by Krinkle (talk | contribs)   23:49, 7 February 2012

This is a follow-up to r109678.

Status & tagging log