@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Modularize config modules + add edges, phid modules

Summary: Fixes T6859. Adds a readout in `/config/` of installed edge and PHID types. See also D13626.

Test Plan: {F643222}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T6859

Differential Revision: https://secure.phabricator.com/D13662

+210 -60
+10 -2
src/__phutil_library_map__.php
··· 1741 1741 'PhabricatorConfigDatabaseStatusController' => 'applications/config/controller/PhabricatorConfigDatabaseStatusController.php', 1742 1742 'PhabricatorConfigDefaultSource' => 'infrastructure/env/PhabricatorConfigDefaultSource.php', 1743 1743 'PhabricatorConfigDictionarySource' => 'infrastructure/env/PhabricatorConfigDictionarySource.php', 1744 + 'PhabricatorConfigEdgeModule' => 'applications/config/module/PhabricatorConfigEdgeModule.php', 1744 1745 'PhabricatorConfigEditController' => 'applications/config/controller/PhabricatorConfigEditController.php', 1745 1746 'PhabricatorConfigEditor' => 'applications/config/editor/PhabricatorConfigEditor.php', 1746 1747 'PhabricatorConfigEntry' => 'applications/config/storage/PhabricatorConfigEntry.php', ··· 1763 1764 'PhabricatorConfigManagementMigrateWorkflow' => 'applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php', 1764 1765 'PhabricatorConfigManagementSetWorkflow' => 'applications/config/management/PhabricatorConfigManagementSetWorkflow.php', 1765 1766 'PhabricatorConfigManagementWorkflow' => 'applications/config/management/PhabricatorConfigManagementWorkflow.php', 1767 + 'PhabricatorConfigModule' => 'applications/config/module/PhabricatorConfigModule.php', 1768 + 'PhabricatorConfigModuleController' => 'applications/config/controller/PhabricatorConfigModuleController.php', 1766 1769 'PhabricatorConfigOption' => 'applications/config/option/PhabricatorConfigOption.php', 1767 1770 'PhabricatorConfigOptionType' => 'applications/config/custom/PhabricatorConfigOptionType.php', 1771 + 'PhabricatorConfigPHIDModule' => 'applications/config/module/PhabricatorConfigPHIDModule.php', 1768 1772 'PhabricatorConfigProxySource' => 'infrastructure/env/PhabricatorConfigProxySource.php', 1769 1773 'PhabricatorConfigResponse' => 'applications/config/response/PhabricatorConfigResponse.php', 1770 1774 'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php', 1771 1775 'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php', 1772 1776 'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php', 1773 - 'PhabricatorConfigSiteModuleController' => 'applications/config/controller/PhabricatorConfigSiteModuleController.php', 1777 + 'PhabricatorConfigSiteModule' => 'applications/config/module/PhabricatorConfigSiteModule.php', 1774 1778 'PhabricatorConfigSiteSource' => 'infrastructure/env/PhabricatorConfigSiteSource.php', 1775 1779 'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php', 1776 1780 'PhabricatorConfigStackSource' => 'infrastructure/env/PhabricatorConfigStackSource.php', ··· 5478 5482 'PhabricatorConfigDatabaseStatusController' => 'PhabricatorConfigDatabaseController', 5479 5483 'PhabricatorConfigDefaultSource' => 'PhabricatorConfigProxySource', 5480 5484 'PhabricatorConfigDictionarySource' => 'PhabricatorConfigSource', 5485 + 'PhabricatorConfigEdgeModule' => 'PhabricatorConfigModule', 5481 5486 'PhabricatorConfigEditController' => 'PhabricatorConfigController', 5482 5487 'PhabricatorConfigEditor' => 'PhabricatorApplicationTransactionEditor', 5483 5488 'PhabricatorConfigEntry' => array( ··· 5504 5509 'PhabricatorConfigManagementMigrateWorkflow' => 'PhabricatorConfigManagementWorkflow', 5505 5510 'PhabricatorConfigManagementSetWorkflow' => 'PhabricatorConfigManagementWorkflow', 5506 5511 'PhabricatorConfigManagementWorkflow' => 'PhabricatorManagementWorkflow', 5512 + 'PhabricatorConfigModule' => 'Phobject', 5513 + 'PhabricatorConfigModuleController' => 'PhabricatorConfigController', 5507 5514 'PhabricatorConfigOption' => array( 5508 5515 'Phobject', 5509 5516 'PhabricatorMarkupInterface', 5510 5517 ), 5511 5518 'PhabricatorConfigOptionType' => 'Phobject', 5519 + 'PhabricatorConfigPHIDModule' => 'PhabricatorConfigModule', 5512 5520 'PhabricatorConfigProxySource' => 'PhabricatorConfigSource', 5513 5521 'PhabricatorConfigResponse' => 'AphrontStandaloneHTMLResponse', 5514 5522 'PhabricatorConfigSchemaQuery' => 'Phobject', 5515 5523 'PhabricatorConfigSchemaSpec' => 'Phobject', 5516 5524 'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema', 5517 - 'PhabricatorConfigSiteModuleController' => 'PhabricatorConfigController', 5525 + 'PhabricatorConfigSiteModule' => 'PhabricatorConfigModule', 5518 5526 'PhabricatorConfigSiteSource' => 'PhabricatorConfigProxySource', 5519 5527 'PhabricatorConfigSource' => 'Phobject', 5520 5528 'PhabricatorConfigStackSource' => 'PhabricatorConfigSource',
+1 -1
src/applications/config/application/PhabricatorConfigApplication.php
··· 57 57 ), 58 58 'cache/' => 'PhabricatorConfigCacheController', 59 59 'module/' => array( 60 - 'sites/' => 'PhabricatorConfigSiteModuleController', 60 + '(?P<module>[^/]+)/' => 'PhabricatorConfigModuleController', 61 61 ), 62 62 ), 63 63 );
+5 -1
src/applications/config/controller/PhabricatorConfigController.php
··· 25 25 $nav->addLabel(pht('Welcome')); 26 26 $nav->addFilter('welcome/', pht('Welcome Screen')); 27 27 $nav->addLabel(pht('Modules')); 28 - $nav->addFilter('module/sites/', pht('Sites')); 28 + 29 + $modules = PhabricatorConfigModule::getAllModules(); 30 + foreach ($modules as $key => $module) { 31 + $nav->addFilter('module/'.$key.'/', $module->getModuleName()); 32 + } 29 33 30 34 return $nav; 31 35 }
+37
src/applications/config/controller/PhabricatorConfigModuleController.php
··· 1 + <?php 2 + 3 + final class PhabricatorConfigModuleController 4 + extends PhabricatorConfigController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $this->getViewer(); 8 + $key = $request->getURIData('module'); 9 + 10 + $all_modules = PhabricatorConfigModule::getAllModules(); 11 + if (empty($all_modules[$key])) { 12 + return new Aphront404Response(); 13 + } 14 + 15 + $module = $all_modules[$key]; 16 + $content = $module->renderModuleStatus($request); 17 + $name = $module->getModuleName(); 18 + 19 + $crumbs = $this->buildApplicationCrumbs(); 20 + $crumbs->addTextCrumb($name); 21 + 22 + $nav = $this->buildSideNavView(); 23 + $nav->selectFilter('module/'.$key.'/'); 24 + $nav->appendChild( 25 + array( 26 + $crumbs, 27 + $content, 28 + )); 29 + 30 + return $this->buildApplicationPage( 31 + $nav, 32 + array( 33 + 'title' => $name, 34 + )); 35 + } 36 + 37 + }
-56
src/applications/config/controller/PhabricatorConfigSiteModuleController.php
··· 1 - <?php 2 - 3 - final class PhabricatorConfigSiteModuleController 4 - extends PhabricatorConfigController { 5 - 6 - public function handleRequest(AphrontRequest $request) { 7 - $viewer = $this->getViewer(); 8 - 9 - $sites = AphrontSite::getAllSites(); 10 - 11 - $rows = array(); 12 - foreach ($sites as $key => $site) { 13 - $rows[] = array( 14 - $site->getPriority(), 15 - $key, 16 - $site->getDescription(), 17 - ); 18 - } 19 - 20 - $table = id(new AphrontTableView($rows)) 21 - ->setHeaders( 22 - array( 23 - pht('Priority'), 24 - pht('Class'), 25 - pht('Description'), 26 - )) 27 - ->setColumnClasses( 28 - array( 29 - null, 30 - 'pri', 31 - 'wide', 32 - )); 33 - 34 - $box = id(new PHUIObjectBoxView()) 35 - ->setHeaderText(pht('Site Modules')) 36 - ->appendChild($table); 37 - 38 - $crumbs = $this->buildApplicationCrumbs(); 39 - $crumbs->addTextCrumb(pht('Site Modules')); 40 - 41 - $nav = $this->buildSideNavView(); 42 - $nav->selectFilter('module/sites/'); 43 - $nav->appendChild( 44 - array( 45 - $crumbs, 46 - $box, 47 - )); 48 - 49 - return $this->buildApplicationPage( 50 - $nav, 51 - array( 52 - 'title' => array(pht('Site Modules')), 53 - )); 54 - } 55 - 56 - }
+47
src/applications/config/module/PhabricatorConfigEdgeModule.php
··· 1 + <?php 2 + 3 + final class PhabricatorConfigEdgeModule extends PhabricatorConfigModule { 4 + 5 + public function getModuleKey() { 6 + return 'edge'; 7 + } 8 + 9 + public function getModuleName() { 10 + return pht('Edge Types'); 11 + } 12 + 13 + public function renderModuleStatus(AphrontRequest $request) { 14 + $viewer = $request->getViewer(); 15 + 16 + $types = PhabricatorEdgeType::getAllTypes(); 17 + $types = msort($types, 'getEdgeConstant'); 18 + 19 + $rows = array(); 20 + foreach ($types as $key => $type) { 21 + $rows[] = array( 22 + $type->getEdgeConstant(), 23 + $type->getInverseEdgeConstant(), 24 + get_class($type), 25 + ); 26 + } 27 + 28 + $table = id(new AphrontTableView($rows)) 29 + ->setHeaders( 30 + array( 31 + pht('Constant'), 32 + pht('Inverse'), 33 + pht('Class'), 34 + )) 35 + ->setColumnClasses( 36 + array( 37 + null, 38 + null, 39 + 'pri wide', 40 + )); 41 + 42 + return id(new PHUIObjectBoxView()) 43 + ->setHeaderText(pht('Edge Types')) 44 + ->appendChild($table); 45 + } 46 + 47 + }
+17
src/applications/config/module/PhabricatorConfigModule.php
··· 1 + <?php 2 + 3 + abstract class PhabricatorConfigModule extends Phobject { 4 + 5 + abstract public function getModuleKey(); 6 + abstract public function getModuleName(); 7 + abstract public function renderModuleStatus(AphrontRequest $request); 8 + 9 + final public static function getAllModules() { 10 + return id(new PhutilClassMapQuery()) 11 + ->setAncestorClass(__CLASS__) 12 + ->setUniqueMethod('getModuleKey') 13 + ->setSortMethod('getModuleName') 14 + ->execute(); 15 + } 16 + 17 + }
+47
src/applications/config/module/PhabricatorConfigPHIDModule.php
··· 1 + <?php 2 + 3 + final class PhabricatorConfigPHIDModule extends PhabricatorConfigModule { 4 + 5 + public function getModuleKey() { 6 + return 'phid'; 7 + } 8 + 9 + public function getModuleName() { 10 + return pht('PHID Types'); 11 + } 12 + 13 + public function renderModuleStatus(AphrontRequest $request) { 14 + $viewer = $request->getViewer(); 15 + 16 + $types = PhabricatorPHIDType::getAllTypes(); 17 + $types = msort($types, 'getTypeConstant'); 18 + 19 + $rows = array(); 20 + foreach ($types as $key => $type) { 21 + $rows[] = array( 22 + $type->getTypeConstant(), 23 + get_class($type), 24 + $type->getTypeName(), 25 + ); 26 + } 27 + 28 + $table = id(new AphrontTableView($rows)) 29 + ->setHeaders( 30 + array( 31 + pht('Constant'), 32 + pht('Class'), 33 + pht('Name'), 34 + )) 35 + ->setColumnClasses( 36 + array( 37 + null, 38 + 'pri', 39 + 'wide', 40 + )); 41 + 42 + return id(new PHUIObjectBoxView()) 43 + ->setHeaderText(pht('PHID Types')) 44 + ->appendChild($table); 45 + } 46 + 47 + }
+46
src/applications/config/module/PhabricatorConfigSiteModule.php
··· 1 + <?php 2 + 3 + final class PhabricatorConfigSiteModule extends PhabricatorConfigModule { 4 + 5 + public function getModuleKey() { 6 + return 'site'; 7 + } 8 + 9 + public function getModuleName() { 10 + return pht('Sites'); 11 + } 12 + 13 + public function renderModuleStatus(AphrontRequest $request) { 14 + $viewer = $request->getViewer(); 15 + 16 + $sites = AphrontSite::getAllSites(); 17 + 18 + $rows = array(); 19 + foreach ($sites as $key => $site) { 20 + $rows[] = array( 21 + $site->getPriority(), 22 + $key, 23 + $site->getDescription(), 24 + ); 25 + } 26 + 27 + $table = id(new AphrontTableView($rows)) 28 + ->setHeaders( 29 + array( 30 + pht('Priority'), 31 + pht('Class'), 32 + pht('Description'), 33 + )) 34 + ->setColumnClasses( 35 + array( 36 + null, 37 + 'pri', 38 + 'wide', 39 + )); 40 + 41 + return id(new PHUIObjectBoxView()) 42 + ->setHeaderText(pht('Sites')) 43 + ->appendChild($table); 44 + } 45 + 46 + }