2011-08-31 22:25:13 +02:00
|
|
|
<?php
|
|
|
|
|
2012-07-04 01:46:27 +02:00
|
|
|
/**
|
|
|
|
* @group events
|
|
|
|
*/
|
2012-03-14 00:21:04 +01:00
|
|
|
final class PhabricatorEventEngine {
|
2011-08-31 22:25:13 +02:00
|
|
|
|
|
|
|
public static function initialize() {
|
|
|
|
$listeners = PhabricatorEnv::getEnvConfig('events.listeners');
|
|
|
|
foreach ($listeners as $listener) {
|
2013-08-15 04:14:16 +02:00
|
|
|
try {
|
|
|
|
id(new $listener())->register();
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
// If the listener does not exist, or throws when registering, just
|
|
|
|
// log it and continue. In particular, this is important to let you
|
|
|
|
// run `bin/config` in order to remove an invalid listener.
|
|
|
|
phlog($ex);
|
|
|
|
}
|
2011-08-31 22:25:13 +02:00
|
|
|
}
|
|
|
|
|
2011-11-10 02:23:33 +01:00
|
|
|
// Register the DarkConosole event logger.
|
|
|
|
id(new DarkConsoleEventPluginAPI())->register();
|
2012-07-03 00:42:06 +02:00
|
|
|
id(new ManiphestEdgeEventListener())->register();
|
|
|
|
|
2012-08-24 22:19:47 +02:00
|
|
|
$applications = PhabricatorApplication::getAllInstalledApplications();
|
|
|
|
foreach ($applications as $application) {
|
|
|
|
$listeners = $application->getEventListeners();
|
|
|
|
foreach ($listeners as $listener) {
|
2013-10-22 02:00:21 +02:00
|
|
|
$listener->setApplication($application);
|
2012-08-24 22:19:47 +02:00
|
|
|
$listener->register();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-31 22:25:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|