When cluster.instance is defined, use it to namespace S3 objects

Summary: Ref T7163. This isn't //technically// necessary but seems generally desirable.

Test Plan: Will deploy S3 in production.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7163

Differential Revision: https://secure.phabricator.com/D11770
This commit is contained in:
epriestley
2015-02-16 11:30:37 -08:00
parent 5a9d70707b
commit 3a8cd60bab

View File

@@ -32,12 +32,19 @@ final class PhabricatorS3FileStorageEngine
// files more browsable with web/debugging tools like the S3 administration // files more browsable with web/debugging tools like the S3 administration
// tool. // tool.
$seed = Filesystem::readRandomCharacters(20); $seed = Filesystem::readRandomCharacters(20);
$parts = array( $parts = array();
substr($seed, 0, 2), $parts[] = 'phabricator';
substr($seed, 2, 2),
substr($seed, 4), $instance_name = PhabricatorEnv::getEnvConfig('cluster.instance');
); if (strlen($instance_name)) {
$name = 'phabricator/'.implode('/', $parts); $parts[] = $instance_name;
}
$parts[] = substr($seed, 0, 2);
$parts[] = substr($seed, 2, 2);
$parts[] = substr($seed, 4);
$name = implode('/', $parts);
AphrontWriteGuard::willWrite(); AphrontWriteGuard::willWrite();
$profiler = PhutilServiceProfiler::getInstance(); $profiler = PhutilServiceProfiler::getInstance();