Differential D11680 Diff 28251 src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | public function execute(PhutilArgumentParser $args) { | ||||
$raw_device = $device_name; | $raw_device = $device_name; | ||||
$identify_as = $args->getArg('identify-as'); | $identify_as = $args->getArg('identify-as'); | ||||
if (strlen($identify_as)) { | if (strlen($identify_as)) { | ||||
$raw_device = $identify_as; | $raw_device = $identify_as; | ||||
} | } | ||||
$console->writeOut( | $console->writeOut( | ||||
"%s\n", | "%s\n", | ||||
pht('Installing device ID...', $raw_device)); | pht('Installing device %s...', $raw_device)); | ||||
// The permissions on this file are more open because the webserver also | // The permissions on this file are more open because the webserver also | ||||
// needs to read it. | // needs to read it. | ||||
$tmp_device = new TempFile(); | $tmp_device = new TempFile(); | ||||
Filesystem::changePermissions($tmp_device, 0644); | Filesystem::changePermissions($tmp_device, 0644); | ||||
execx('chown %s %s', $phd_user, $tmp_device); | execx('chown %s %s', $phd_user, $tmp_device); | ||||
Filesystem::writeFile($tmp_device, $raw_device); | Filesystem::writeFile($tmp_device, $raw_device); | ||||
execx('mv -f %s %s', $tmp_device, $stored_device_path); | execx('mv -f %s %s', $tmp_device, $stored_device_path); | ||||
Show All 18 Lines |