3 use Composer\Package\Package
;
4 use Composer\Script\Event
;
6 $GLOBALS['IP'] = __DIR__
. '/../../';
7 require_once __DIR__
. '/../AutoLoader.php';
10 * @licence GNU GPL v2+
11 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
13 class ComposerHookHandler
{
15 public static function onPreUpdate( Event
$event ) {
16 self
::handleChangeEvent( $event );
19 public static function onPreInstall( Event
$event ) {
20 self
::handleChangeEvent( $event );
23 private static function handleChangeEvent( Event
$event ) {
24 $package = $event->getComposer()->getPackage();
26 if ( $package instanceof Package
) {
27 $packageModifier = new ComposerPackageModifier(
29 new ComposerVersionNormalizer(),
30 new MediaWikiVersionFetcher()
33 $packageModifier->setProvidesMediaWiki();