Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/engine/PhabricatorS3FileStorageEngine.php
Show All 26 Lines | /* -( Implementation )----------------------------------------------------- */ | ||||
public function writeFile($data, array $params) { | public function writeFile($data, array $params) { | ||||
$s3 = $this->newS3API(); | $s3 = $this->newS3API(); | ||||
// Generate a random name for this file. We add some directories to it | // Generate a random name for this file. We add some directories to it | ||||
// (e.g. 'abcdef123456' becomes 'ab/cd/ef123456') to make large numbers of | // (e.g. 'abcdef123456' becomes 'ab/cd/ef123456') to make large numbers of | ||||
// 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(); | ||||
$call_id = $profiler->beginServiceCall( | $call_id = $profiler->beginServiceCall( | ||||
array( | array( | ||||
'type' => 's3', | 'type' => 's3', | ||||
'method' => 'putObject', | 'method' => 'putObject', | ||||
)); | )); | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |