In the beginning, there was Article.php. And the Article class had methods
like Article::view(), Article::delete(), Article::protect(), etc. And the
fundamental codeflow of Mediawiki consisted of something along the lines of:
$article = new Article( $title );
$action = wfGetTheActionSomehow();
$article->$action();
Over time Article has grown and bloated to become our third largest class
(after ZhConversion and Parser). Several of its action methods have been
spun out to separate files (EditPage.php, ProtectionForm.php and
HistoryPage.php, among others). It's long overdue that this process be
carried through to its natural conclusion with all action methods spun out
into some new structure.
There are essentially two competing possibilities for structuring this, and
they reflect the two parallel systems we have for "doing things other than
viewing" to a wiki. One is action parameters, and the other is special
pages. We have action=edit, or Special:MovePage, for instance; they have a
similar function but different structure. We have action=delete to get rid
of stuff, but then Special:Undelete to bring it back again.
Special:Whatlinkshere and action=history are another pair of pages which
have very similar principles (getting data that relates to a given page) but
different implementations.
For either case in the backend I would think we'd want to create an
ActionPage base class and an EditActionPage from that, which looks
internally rather like a SpecialPage construct, might even subclass it. I'd
like to ask people's opinions about which they think would work better in
the frontend for, say, editing or protecting. If people think it would be
better as a special page we'd make
http://foo.example.com/w/index.php?title=Bar&action=edit a hard redirect to
Special:Edit/Bar; that has the significant advantage of being able to be
formed as an internal link. Conversely if we'd like to keep it an action it
would make sense to redirect Special:MovePage/Bar back to
?title=Bar&action=move. Or is something more exotic like
[[Action:Edit/Bar]] a possibility?
Thoughts?
--HM