mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Make Celerity a real application
Summary: Ref T5702. This primarily gets URI routing out of Aphront and into an Application, for consistency. Test Plan: Loaded some pages, got static resources. Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5702 Differential Revision: https://secure.phabricator.com/D10696
This commit is contained in:
parent
bd741ffcc7
commit
c728c0ac60
25 changed files with 56 additions and 46 deletions
|
@ -109,22 +109,22 @@ phutil_register_library_map(array(
|
|||
'CalendarConstants' => 'applications/calendar/constants/CalendarConstants.php',
|
||||
'CalendarTimeUtil' => 'applications/calendar/util/CalendarTimeUtil.php',
|
||||
'CalendarTimeUtilTestCase' => 'applications/calendar/__tests__/CalendarTimeUtilTestCase.php',
|
||||
'CelerityAPI' => 'infrastructure/celerity/CelerityAPI.php',
|
||||
'CelerityManagementMapWorkflow' => 'infrastructure/celerity/management/CelerityManagementMapWorkflow.php',
|
||||
'CelerityManagementWorkflow' => 'infrastructure/celerity/management/CelerityManagementWorkflow.php',
|
||||
'CelerityPhabricatorResourceController' => 'infrastructure/celerity/CelerityPhabricatorResourceController.php',
|
||||
'CelerityPhabricatorResources' => 'infrastructure/celerity/resources/CelerityPhabricatorResources.php',
|
||||
'CelerityPhysicalResources' => 'infrastructure/celerity/resources/CelerityPhysicalResources.php',
|
||||
'CelerityResourceController' => 'infrastructure/celerity/CelerityResourceController.php',
|
||||
'CelerityResourceGraph' => 'infrastructure/celerity/CelerityResourceGraph.php',
|
||||
'CelerityResourceMap' => 'infrastructure/celerity/CelerityResourceMap.php',
|
||||
'CelerityResourceMapGenerator' => 'infrastructure/celerity/CelerityResourceMapGenerator.php',
|
||||
'CelerityResourceTransformer' => 'infrastructure/celerity/CelerityResourceTransformer.php',
|
||||
'CelerityResourceTransformerTestCase' => 'infrastructure/celerity/__tests__/CelerityResourceTransformerTestCase.php',
|
||||
'CelerityResources' => 'infrastructure/celerity/resources/CelerityResources.php',
|
||||
'CelerityResourcesOnDisk' => 'infrastructure/celerity/resources/CelerityResourcesOnDisk.php',
|
||||
'CeleritySpriteGenerator' => 'infrastructure/celerity/CeleritySpriteGenerator.php',
|
||||
'CelerityStaticResourceResponse' => 'infrastructure/celerity/CelerityStaticResourceResponse.php',
|
||||
'CelerityAPI' => 'applications/celerity/CelerityAPI.php',
|
||||
'CelerityManagementMapWorkflow' => 'applications/celerity/management/CelerityManagementMapWorkflow.php',
|
||||
'CelerityManagementWorkflow' => 'applications/celerity/management/CelerityManagementWorkflow.php',
|
||||
'CelerityPhabricatorResourceController' => 'applications/celerity/controller/CelerityPhabricatorResourceController.php',
|
||||
'CelerityPhabricatorResources' => 'applications/celerity/resources/CelerityPhabricatorResources.php',
|
||||
'CelerityPhysicalResources' => 'applications/celerity/resources/CelerityPhysicalResources.php',
|
||||
'CelerityResourceController' => 'applications/celerity/controller/CelerityResourceController.php',
|
||||
'CelerityResourceGraph' => 'applications/celerity/CelerityResourceGraph.php',
|
||||
'CelerityResourceMap' => 'applications/celerity/CelerityResourceMap.php',
|
||||
'CelerityResourceMapGenerator' => 'applications/celerity/CelerityResourceMapGenerator.php',
|
||||
'CelerityResourceTransformer' => 'applications/celerity/CelerityResourceTransformer.php',
|
||||
'CelerityResourceTransformerTestCase' => 'applications/celerity/__tests__/CelerityResourceTransformerTestCase.php',
|
||||
'CelerityResources' => 'applications/celerity/resources/CelerityResources.php',
|
||||
'CelerityResourcesOnDisk' => 'applications/celerity/resources/CelerityResourcesOnDisk.php',
|
||||
'CeleritySpriteGenerator' => 'applications/celerity/CeleritySpriteGenerator.php',
|
||||
'CelerityStaticResourceResponse' => 'applications/celerity/CelerityStaticResourceResponse.php',
|
||||
'ChatLogConduitAPIMethod' => 'applications/chatlog/conduit/ChatLogConduitAPIMethod.php',
|
||||
'ChatLogQueryConduitAPIMethod' => 'applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php',
|
||||
'ChatLogRecordConduitAPIMethod' => 'applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php',
|
||||
|
@ -1317,6 +1317,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php',
|
||||
'PhabricatorCalendarViewController' => 'applications/calendar/controller/PhabricatorCalendarViewController.php',
|
||||
'PhabricatorCampfireProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php',
|
||||
'PhabricatorCelerityApplication' => 'applications/celerity/application/PhabricatorCelerityApplication.php',
|
||||
'PhabricatorCelerityTestCase' => '__tests__/PhabricatorCelerityTestCase.php',
|
||||
'PhabricatorChangeParserTestCase' => 'applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php',
|
||||
'PhabricatorChangesetResponse' => 'infrastructure/diff/PhabricatorChangesetResponse.php',
|
||||
|
@ -2884,8 +2885,8 @@ phutil_register_library_map(array(
|
|||
),
|
||||
'function' => array(
|
||||
'_phabricator_time_format' => 'view/viewutils.php',
|
||||
'celerity_generate_unique_node_id' => 'infrastructure/celerity/api.php',
|
||||
'celerity_get_resource_uri' => 'infrastructure/celerity/api.php',
|
||||
'celerity_generate_unique_node_id' => 'applications/celerity/api.php',
|
||||
'celerity_get_resource_uri' => 'applications/celerity/api.php',
|
||||
'implode_selected_handle_links' => 'applications/phid/handle/view/render.php',
|
||||
'javelin_tag' => 'infrastructure/javelin/markup.php',
|
||||
'phabricator_date' => 'view/viewutils.php',
|
||||
|
@ -2898,7 +2899,7 @@ phutil_register_library_map(array(
|
|||
'phid_get_subtype' => 'applications/phid/utils.php',
|
||||
'phid_get_type' => 'applications/phid/utils.php',
|
||||
'phid_group_by_type' => 'applications/phid/utils.php',
|
||||
'require_celerity_resource' => 'infrastructure/celerity/api.php',
|
||||
'require_celerity_resource' => 'applications/celerity/api.php',
|
||||
),
|
||||
'xmap' => array(
|
||||
'AlmanacConduitUtil' => 'Phobject',
|
||||
|
@ -4287,6 +4288,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorCalendarViewController' => 'PhabricatorCalendarController',
|
||||
'PhabricatorCampfireProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter',
|
||||
'PhabricatorCelerityApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorCelerityTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorChangeParserTestCase' => 'PhabricatorWorkingCopyTestCase',
|
||||
'PhabricatorChangesetResponse' => 'AphrontProxyResponse',
|
||||
|
|
|
@ -11,7 +11,6 @@ abstract class AphrontApplicationConfiguration {
|
|||
private $console;
|
||||
|
||||
abstract public function getApplicationName();
|
||||
abstract public function getURIMap();
|
||||
abstract public function buildRequest();
|
||||
abstract public function build404Controller();
|
||||
abstract public function buildRedirectController($uri, $external);
|
||||
|
@ -64,8 +63,8 @@ abstract class AphrontApplicationConfiguration {
|
|||
* first test if the HTTP_HOST is configured as a valid Phabricator URI. If
|
||||
* it isn't, we do a special check to see if it's a custom domain for a blog
|
||||
* in the Phame application and if that fails we error. Otherwise, we test
|
||||
* the URI against all builtin routes from @{method:getURIMap}, then against
|
||||
* all application routes from installed @{class:PhabricatorApplication}s.
|
||||
* against all application routes from installed
|
||||
* @{class:PhabricatorApplication}s.
|
||||
*
|
||||
* If we match a route, we construct the controller it points at, build it,
|
||||
* and return it.
|
||||
|
@ -212,7 +211,6 @@ abstract class AphrontApplicationConfiguration {
|
|||
*/
|
||||
final public function buildControllerForPath($path) {
|
||||
$maps = array();
|
||||
$maps[] = array(null, $this->getURIMap());
|
||||
|
||||
$applications = PhabricatorApplication::getAllInstalledApplications();
|
||||
foreach ($applications as $application) {
|
||||
|
|
|
@ -14,26 +14,6 @@ class AphrontDefaultApplicationConfiguration
|
|||
return 'aphront-default';
|
||||
}
|
||||
|
||||
public function getURIMap() {
|
||||
return $this->getResourceURIMapRules();
|
||||
}
|
||||
|
||||
protected function getResourceURIMapRules() {
|
||||
$extensions = CelerityResourceController::getSupportedResourceTypes();
|
||||
$extensions = array_keys($extensions);
|
||||
$extensions = implode('|', $extensions);
|
||||
|
||||
return array(
|
||||
'/res/' => array(
|
||||
'(?:(?P<mtime>[0-9]+)T/)?'.
|
||||
'(?P<library>[^/]+)/'.
|
||||
'(?P<hash>[a-f0-9]{8})/'.
|
||||
'(?P<path>.+\.(?:'.$extensions.'))'
|
||||
=> 'CelerityPhabricatorResourceController',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phutil-external-symbol class PhabricatorStartup
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorCelerityApplication extends PhabricatorApplication {
|
||||
|
||||
public function getName() {
|
||||
return pht('Celerity');
|
||||
}
|
||||
|
||||
public function canUninstall() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isUnlisted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
$extensions = CelerityResourceController::getSupportedResourceTypes();
|
||||
$extensions = array_keys($extensions);
|
||||
$extensions = implode('|', $extensions);
|
||||
|
||||
return array(
|
||||
'/res/' => array(
|
||||
'(?:(?P<mtime>[0-9]+)T/)?'.
|
||||
'(?P<library>[^/]+)/'.
|
||||
'(?P<hash>[a-f0-9]{8})/'.
|
||||
'(?P<path>.+\.(?:'.$extensions.'))'
|
||||
=> 'CelerityPhabricatorResourceController',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,9 +8,6 @@ application class and subdirectory organization best practices.
|
|||
|
||||
When a user visits a Phabricator URI, the Phabricator infrastructure parses
|
||||
that URI with a regular expression to determine what controller class to load.
|
||||
For now, that regular expression is hard-coded inside the
|
||||
@{class:AphrontDefaultApplicationConfiguration} within the ##getURIMap##
|
||||
method. Use the existing entries as examples for adding your own entries.
|
||||
|
||||
The Phabricator infrastructure knows where a given controller class lives on
|
||||
disk from a cache file the Arcanist phutil mapper generates. This mapping
|
||||
|
|
Loading…
Reference in a new issue