Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/storage/PhabricatorFile.php
Show First 20 Lines • Show All 849 Lines • ▼ Show 20 Lines | public function getCDNURI($request_kind) { | ||||
$parts[] = 'file'; | $parts[] = 'file'; | ||||
$parts[] = $request_kind; | $parts[] = $request_kind; | ||||
// If this is an instanced install, add the instance identifier to the URI. | // If this is an instanced install, add the instance identifier to the URI. | ||||
// Instanced configurations behind a CDN may not be able to control the | // Instanced configurations behind a CDN may not be able to control the | ||||
// request domain used by the CDN (as with AWS CloudFront). Embedding the | // request domain used by the CDN (as with AWS CloudFront). Embedding the | ||||
// instance identity in the path allows us to distinguish between requests | // instance identity in the path allows us to distinguish between requests | ||||
// originating from different instances but served through the same CDN. | // originating from different instances but served through the same CDN. | ||||
$instance = PhabricatorEnv::getEnvConfig('cluster.instance'); | $instance = PhabricatorEnv::getEnvConfigStr('cluster.instance'); | ||||
if (strlen($instance)) { | if ($instance !== '') { | ||||
$parts[] = '@'.$instance; | $parts[] = '@'.$instance; | ||||
} | } | ||||
$parts[] = $this->getSecretKey(); | $parts[] = $this->getSecretKey(); | ||||
$parts[] = $this->getPHID(); | $parts[] = $this->getPHID(); | ||||
$parts[] = $name; | $parts[] = $name; | ||||
$path = '/'.implode('/', $parts); | $path = '/'.implode('/', $parts); | ||||
Show All 29 Lines | public function getURIForTransform(PhabricatorFileTransform $transform) { | ||||
return $this->getTransformedURI($transform->getTransformKey()); | return $this->getTransformedURI($transform->getTransformKey()); | ||||
} | } | ||||
private function getTransformedURI($transform) { | private function getTransformedURI($transform) { | ||||
$parts = array(); | $parts = array(); | ||||
$parts[] = 'file'; | $parts[] = 'file'; | ||||
$parts[] = 'xform'; | $parts[] = 'xform'; | ||||
$instance = PhabricatorEnv::getEnvConfig('cluster.instance'); | $instance = PhabricatorEnv::getEnvConfigStr('cluster.instance'); | ||||
if (strlen($instance)) { | if ($instance !== '') { | ||||
$parts[] = '@'.$instance; | $parts[] = '@'.$instance; | ||||
} | } | ||||
$parts[] = $transform; | $parts[] = $transform; | ||||
$parts[] = $this->getPHID(); | $parts[] = $this->getPHID(); | ||||
$parts[] = $this->getSecretKey(); | $parts[] = $this->getSecretKey(); | ||||
$path = implode('/', $parts); | $path = implode('/', $parts); | ||||
▲ Show 20 Lines • Show All 850 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0