2011-08-31 13:25:13 -07:00
|
|
|
<?php
|
|
|
|
|
2012-07-03 16:46:27 -07:00
|
|
|
/**
|
|
|
|
* @group events
|
|
|
|
*/
|
2012-03-13 16:21:04 -07:00
|
|
|
final class PhabricatorEventEngine {
|
2011-08-31 13:25:13 -07:00
|
|
|
|
|
|
|
public static function initialize() {
|
|
|
|
$listeners = PhabricatorEnv::getEnvConfig('events.listeners');
|
|
|
|
foreach ($listeners as $listener) {
|
2013-08-14 19:14:16 -07: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 13:25:13 -07:00
|
|
|
}
|
|
|
|
|
2011-11-09 17:23:33 -08:00
|
|
|
// Register the DarkConosole event logger.
|
|
|
|
id(new DarkConsoleEventPluginAPI())->register();
|
2012-07-02 15:42:06 -07:00
|
|
|
id(new ManiphestEdgeEventListener())->register();
|
|
|
|
|
2012-08-24 13:19:47 -07:00
|
|
|
$applications = PhabricatorApplication::getAllInstalledApplications();
|
|
|
|
foreach ($applications as $application) {
|
|
|
|
$listeners = $application->getEventListeners();
|
|
|
|
foreach ($listeners as $listener) {
|
2013-10-21 17:00:21 -07:00
|
|
|
$listener->setApplication($application);
|
2012-08-24 13:19:47 -07:00
|
|
|
$listener->register();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-31 13:25:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|