"Krinkle" posted a comment on MediaWiki.r108342. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/108342#c29464
Commit summary for MediaWiki.r108342: Implement MediaWiki::getPerformedAction() * Fixes: -- Bug 27930 - Ablity to get current action (The Right Way) Krinkle's comment: In r108343 CR it is suggested to store this in the RequestContext instead. However, I don't think it has suffecient information to determine the currently performed action. (OutputPage, WebRequest, User, etc.. all these are part of context but neither has suffient information right now due to some action-stuff still being decided in MediaWiki::performAction, which is terrible). So one could add a public field to the Context class and let MediaWiki::performAction assign a value in it, but that only moves the problem. I think there is an underlaying problem, namely that this @!#$)! action stuff doesn't belong here in the first place. How about we move the remaining pieces (view, edit, submit, ..) into Action as well (either a couple few-line classes like ViewAction, EditAction, ProtectAction, etc. or move the switch statement from here to Action::factory). Either way, so that calling Action::factory with the query-string value of "action" will be a completely reliable return value that is without a doubt the currently performed action. Then it suddenly becomes very simply to determine the currently performed action from anywhere (could be something like <tt>public static function Action::getPerformedAction( $context )</tt>). _______________________________________________ MediaWiki-CodeReview mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
