mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-22 19:49:02 +01:00
Return applications in application order
Summary: By default, order applications in application order. See discussion in D4708. Principally, this is intended to make sure that application event handlers are registered in order, and thus fire in order. Test Plan: Looked at /applications/, homepage tiles, verified they both still work. I didn't actually test the event handler bit since it's fairly complicated to test blind; D4708 should provide a test case. Reviewers: btrahan, Afaque_Hussain Reviewed By: Afaque_Hussain CC: aran Differential Revision: https://secure.phabricator.com/D4791
This commit is contained in:
parent
5459af3bdd
commit
57ff0a80aa
3 changed files with 21 additions and 22 deletions
|
@ -244,7 +244,6 @@ abstract class PhabricatorApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAllApplications() {
|
public static function getAllApplications() {
|
||||||
|
|
||||||
$classes = id(new PhutilSymbolLoader())
|
$classes = id(new PhutilSymbolLoader())
|
||||||
->setAncestorClass(__CLASS__)
|
->setAncestorClass(__CLASS__)
|
||||||
->setConcreteOnly(true)
|
->setConcreteOnly(true)
|
||||||
|
@ -257,6 +256,13 @@ abstract class PhabricatorApplication {
|
||||||
$apps[] = $app;
|
$apps[] = $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reorder the applications into "application order". Notably, this ensures
|
||||||
|
// their event handlers register in application order.
|
||||||
|
$apps = msort($apps, 'getApplicationOrder');
|
||||||
|
$apps = mgroup($apps, 'getApplicationGroup');
|
||||||
|
$apps = array_select_keys($apps, self::getApplicationGroups()) + $apps;
|
||||||
|
$apps = array_mergev($apps);
|
||||||
|
|
||||||
return $apps;
|
return $apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,31 +276,24 @@ abstract class PhabricatorApplication {
|
||||||
PhabricatorEnv::getEnvConfig('phabricator.uninstalled-applications');
|
PhabricatorEnv::getEnvConfig('phabricator.uninstalled-applications');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($applications)) {
|
if (empty($applications)) {
|
||||||
$classes = id(new PhutilSymbolLoader())
|
$all_applications = self::getAllApplications();
|
||||||
->setAncestorClass(__CLASS__)
|
|
||||||
->setConcreteOnly(true)
|
|
||||||
->selectAndLoadSymbols();
|
|
||||||
|
|
||||||
$apps = array();
|
$apps = array();
|
||||||
foreach ($classes as $class) {
|
foreach ($all_applications as $app) {
|
||||||
|
$class = get_class($app);
|
||||||
if (isset($uninstalled[$class['name']])) {
|
if (isset($uninstalled[$class])) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$app = newv($class['name'], array());
|
|
||||||
|
|
||||||
if (!$app->isEnabled()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$show_beta && $app->isBeta()) {
|
if (!$app->isEnabled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$apps[] = $app;
|
if (!$show_beta && $app->isBeta()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$apps[] = $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
$applications = $apps;
|
$applications = $apps;
|
||||||
|
|
|
@ -65,8 +65,6 @@ abstract class PhabricatorDirectoryController extends PhabricatorController {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tile_group = msort($tile_group, 'getApplicationOrder');
|
|
||||||
|
|
||||||
$is_small_tiles = ($tile_display == PhabricatorApplication::TILE_SHOW) ||
|
$is_small_tiles = ($tile_display == PhabricatorApplication::TILE_SHOW) ||
|
||||||
($tile_display == PhabricatorApplication::TILE_HIDE);
|
($tile_display == PhabricatorApplication::TILE_HIDE);
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ final class PhabricatorApplicationsListController
|
||||||
private function buildInstalledApplicationsList(array $applications) {
|
private function buildInstalledApplicationsList(array $applications) {
|
||||||
$list = new PhabricatorObjectItemListView();
|
$list = new PhabricatorObjectItemListView();
|
||||||
|
|
||||||
|
$applications = msort($applications, 'getName');
|
||||||
|
|
||||||
foreach ($applications as $application) {
|
foreach ($applications as $application) {
|
||||||
$item = id(new PhabricatorObjectItemView())
|
$item = id(new PhabricatorObjectItemView())
|
||||||
->setHeader($application->getName())
|
->setHeader($application->getName())
|
||||||
|
|
Loading…
Add table
Reference in a new issue