Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98082593
CelerityPhabricatorResourceController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jan 9, 14:46
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 11, 14:46 (2 d)
Engine
blob
Format
Raw Data
Handle
23501666
Attached To
rPH Phabricator
CelerityPhabricatorResourceController.php
View Options
<?php
/**
* Delivers CSS and JS resources to the browser. This controller handles all
* ##/res/## requests, and manages caching, package construction, and resource
* preprocessing.
*
* @group celerity
*/
final
class
CelerityPhabricatorResourceController
extends
CelerityResourceController
{
private
$path
;
private
$hash
;
private
$package
;
protected
function
getRootDirectory
()
{
$root
=
dirname
(
phutil_get_library_root
(
'phabricator'
));
return
$root
.
'/webroot/'
;
}
public
function
willProcessRequest
(
array
$data
)
{
$this
->
path
=
$data
[
'path'
];
$this
->
hash
=
$data
[
'hash'
];
$this
->
package
=
!
empty
(
$data
[
'package'
]);
}
public
function
processRequest
()
{
$package_hash
=
null
;
if
(
$this
->
package
)
{
$package_hash
=
$this
->
hash
;
}
return
$this
->
serveResource
(
$this
->
path
,
$package_hash
);
}
protected
function
buildResourceTransformer
()
{
$xformer
=
new
CelerityResourceTransformer
();
$xformer
->
setMinify
(
!
PhabricatorEnv
::
getEnvConfig
(
'phabricator.developer-mode'
)
&&
PhabricatorEnv
::
getEnvConfig
(
'celerity.minify'
));
$xformer
->
setCelerityMap
(
CelerityResourceMap
::
getInstance
());
return
$xformer
;
}
}
Event Timeline
Log In to Comment