Refactor directory creation
This commit is contained in:
@@ -47,8 +47,12 @@ class CertificateStore {
|
||||
$chain = \array_slice($certificates, 1);
|
||||
$path = $this->root . '/' . $commonName;
|
||||
|
||||
if (!(yield File\isdir($path)) && !(yield File\mkdir($path, 0644, true)) && !(yield File\isdir($path))) {
|
||||
throw new FilesystemException("Couldn't create certificate directory: '{$path}'");
|
||||
if (!yield File\isdir($path)) {
|
||||
yield File\mkdir($path, 0644, true);
|
||||
|
||||
if (!yield File\isdir($path)) {
|
||||
throw new FilesystemException("Couldn't create certificate directory: '{$path}'");
|
||||
}
|
||||
}
|
||||
|
||||
yield File\put($path . '/cert.pem', $certificates[0]);
|
||||
|
||||
@@ -22,8 +22,12 @@ class ChallengeStore {
|
||||
throw new ChallengeStoreException("Document root doesn't exist: '{$this->docroot}'");
|
||||
}
|
||||
|
||||
if (!(yield File\isdir($path)) && !(yield File\mkdir($path, 0644, true)) && !(yield File\isdir($path))) {
|
||||
throw new ChallengeStoreException("Couldn't create key directory: '{$path}'");
|
||||
if (!yield File\isdir($path)) {
|
||||
yield File\mkdir($path, 0644, true);
|
||||
|
||||
if (!yield File\isdir($path)) {
|
||||
throw new ChallengeStoreException("Couldn't create key directory: '{$path}'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($user && !$userInfo = \posix_getpwnam($user)) {
|
||||
|
||||
@@ -43,8 +43,12 @@ class KeyStore {
|
||||
try {
|
||||
$dir = \dirname($file);
|
||||
|
||||
if (!(yield File\isdir($dir)) && !(yield File\mkdir($dir, 0644, true)) && !(yield File\isdir($dir))) {
|
||||
throw new FilesystemException("Couldn't create key directory: '{$dir}'");
|
||||
if (!yield File\isdir($dir)) {
|
||||
yield File\mkdir($dir, 0644, true);
|
||||
|
||||
if (!yield File\isdir($dir)) {
|
||||
throw new FilesystemException("Couldn't create key directory: '{$dir}'");
|
||||
}
|
||||
}
|
||||
|
||||
yield File\put($file, $key->toPem());
|
||||
|
||||
Reference in New Issue
Block a user