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

at upstream/main 55 lines 1.6 kB view raw
1<?php 2 3/** 4 * Delivers CSS and JS resources to the browser. This controller handles all 5 * `/res/` requests, and manages caching, package construction, and resource 6 * preprocessing. 7 */ 8final class CelerityPhabricatorResourceController 9 extends CelerityResourceController { 10 11 private $path; 12 private $hash; 13 private $library; 14 private $postprocessorKey; 15 16 public function getCelerityResourceMap() { 17 return CelerityResourceMap::getNamedInstance($this->library); 18 } 19 20 public function handleRequest(AphrontRequest $request) { 21 $this->path = $request->getURIData('path'); 22 $this->hash = $request->getURIData('hash'); 23 $this->library = $request->getURIData('library'); 24 $this->postprocessorKey = $request->getURIData('postprocessor'); 25 26 // Check that the resource library exists before trying to serve resources 27 // from it. 28 try { 29 $this->getCelerityResourceMap(); 30 } catch (Exception $ex) { 31 return new Aphront400Response(); 32 } 33 34 return $this->serveResource( 35 array( 36 'path' => $this->path, 37 'hash' => $this->hash, 38 )); 39 } 40 41 protected function buildResourceTransformer() { 42 $developer_on = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); 43 $should_minify = !$developer_on; 44 45 return id(new CelerityResourceTransformer()) 46 ->setMinify($should_minify) 47 ->setPostprocessorKey($this->postprocessorKey) 48 ->setCelerityMap($this->getCelerityResourceMap()); 49 } 50 51 protected function getCacheKey($path) { 52 return parent::getCacheKey($path.';'.$this->postprocessorKey); 53 } 54 55}