@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.

Serve celerity resources from multiple maps

Summary: Ref T4222. Adds the map name to Celerity resource URIs, so we can serve out of any map.

Test Plan: Poked around, verified URIs have "/phabricator/" in them now.

Reviewers: btrahan, hach-que

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4222

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

+23 -2
+1
src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
··· 73 73 return array( 74 74 '/res/' => array( 75 75 '(?:(?P<mtime>[0-9]+)T/)?'. 76 + '(?P<library>[^/]+)/'. 76 77 '(?P<hash>[a-f0-9]{8})/'. 77 78 '(?P<path>.+\.(?:css|js|jpg|png|swf|gif))' 78 79 => 'CelerityPhabricatorResourceController',
+11 -1
src/infrastructure/celerity/CelerityPhabricatorResourceController.php
··· 12 12 13 13 private $path; 14 14 private $hash; 15 + private $library; 15 16 16 17 public function getCelerityResourceMap() { 17 - return CelerityResourceMap::getNamedInstance('phabricator'); 18 + return CelerityResourceMap::getNamedInstance($this->library); 18 19 } 19 20 20 21 public function willProcessRequest(array $data) { 21 22 $this->path = $data['path']; 22 23 $this->hash = $data['hash']; 24 + $this->library = $data['library']; 23 25 } 24 26 25 27 public function processRequest() { 28 + // Check that the resource library exists before trying to serve resources 29 + // from it. 30 + try { 31 + $this->getCelerityResourceMap(); 32 + } catch (Exception $ex) { 33 + return new Aphront400Response(); 34 + } 35 + 26 36 return $this->serveResource($this->path); 27 37 } 28 38
+9
src/infrastructure/celerity/resources/CelerityPhysicalResources.php
··· 30 30 31 31 foreach ($resources_list as $resources) { 32 32 $name = $resources->getName(); 33 + 34 + if (!preg_match('/^[a-z0-9]+/', $name)) { 35 + throw new Exception( 36 + pht( 37 + 'Resources name "%s" is not valid; it must contain only '. 38 + 'lowercase latin letters and digits.', 39 + $name)); 40 + } 41 + 33 42 if (empty($resources_map[$name])) { 34 43 $resources_map[$name] = $resources; 35 44 } else {
+2 -1
src/infrastructure/celerity/resources/CelerityResources.php
··· 25 25 } 26 26 27 27 public function getResourceURI($hash, $name) { 28 - return "/res/{$hash}/{$name}"; 28 + $resources = $this->getName(); 29 + return "/res/{$resources}/{$hash}/{$name}"; 29 30 } 30 31 31 32 public function getResourcePackages() {