Allow registration of Actions using a callback that returns an Action instance
authorjeroendedauw <jeroendedauw@gmail.com>
Mon, 18 Feb 2013 22:23:16 +0000 (23:23 +0100)
committerJeroen De Dauw <jeroendedauw@gmail.com>
Wed, 4 Sep 2013 21:08:32 +0000 (21:08 +0000)
commitf303047f680d465694cad69ce0f30d7a2e675d54
tree845ca5fe5db723f287de0e9bf782c32ace81951e
parentbc687deca09e2802afa5acf72350d3dec7b09a38
Allow registration of Actions using a callback that returns an Action instance

Basically implementing what Brion suggested on wikitech

This allows for injecting dependencies while still only loading the actual class when needed.

Simple example:

$wgActions['epundo'] = function( Page $page, IContextSource $context = null ) use ( $differ ) {
$undoAction = new \EducationProgram\UndoAction( $page, $context );
$undoAction->setDiffer( $differ );
return $undoAction;
};

Change-Id: I6c0f4022f1df1ebaf9cd1a5fe4bd362d0ecc0d62
RELEASE-NOTES-1.22
includes/Action.php