Issue #3214097 by paul121: The file permissions could not be set on keys/*.key

This commit is contained in:
Michael Stenta 2021-09-09 16:38:40 -04:00
commit 462f606625
1 changed files with 3 additions and 9 deletions

View File

@ -34,21 +34,15 @@ function farm_api_install() {
$pub_filename = sprintf('%s/public.key', $keys_path);
$pri_filename = sprintf('%s/private.key', $keys_path);
if ($file_system_checker->fileExist($pub_filename) && $file_system_checker->fileExist($pri_filename)) {
// 1. If the file already exists, then just set the correct permissions.
$file_system->chmod($pub_filename, 0600);
$file_system->chmod($pri_filename, 0600);
}
else {
// 2. Generate the pair in the selected directory.
// Create keys if they don't exist.
if (!$file_system_checker->fileExist($pub_filename) || !$file_system_checker->fileExist($pri_filename)) {
try {
$key_gen->generateKeys($keys_path);
}
catch (\Exception $e) {
// Unable to generate files after all.
watchdog_exception('farm_api', $e);
return;
}
}
// Delete the "Default Consumer" created by the consumers module.