mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-27 07:50:57 +01:00
d66972c9f2
Summary: Ref T3675. Some of these listeners shouldn't do their thing if the viewer doesn't have access to an application (for example, users without access to Differential should not be able to "Edit Tasks"). Set the stage for that: - Introduce `PhabricatorEventListener`, which has an application. - Populate this for event listeners installed by applications. - Rename the "PeopleMenu" listeners to "ActionMenu" listeners, which better describes their modern behavior. This doesn't actually change any behaviors. Test Plan: Viewed Maniphest, Differntial, People. Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Maniphest Tasks: T3675 Differential Revision: https://secure.phabricator.com/D7364
36 lines
1 KiB
PHP
36 lines
1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group events
|
|
*/
|
|
final class PhabricatorEventEngine {
|
|
|
|
public static function initialize() {
|
|
$listeners = PhabricatorEnv::getEnvConfig('events.listeners');
|
|
foreach ($listeners as $listener) {
|
|
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);
|
|
}
|
|
}
|
|
|
|
// Register the DarkConosole event logger.
|
|
id(new DarkConsoleEventPluginAPI())->register();
|
|
id(new ManiphestEdgeEventListener())->register();
|
|
|
|
$applications = PhabricatorApplication::getAllInstalledApplications();
|
|
foreach ($applications as $application) {
|
|
$listeners = $application->getEventListeners();
|
|
foreach ($listeners as $listener) {
|
|
$listener->setApplication($application);
|
|
$listener->register();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|