Skip to content
Snippets Groups Projects
Verified Commit efa60f1b authored by Damien's avatar Damien
Browse files

FEAT #13671 TIME 0:30 Check if docservers already exist

parent 7937bcf2
No related branches found
No related tags found
No related merge requests found
......@@ -1713,7 +1713,7 @@ class UserController
continue;
}
$existingUser = UserModel::getByLogin(['login' => strtolower($user['user_id']), 'select' => ['id', 'status', 'mail']]);
$existingUser = UserModel::getByLogin(['login' => strtolower($user['user_id']), 'select' => ['id', 'status']]);
if (!empty($existingUser) && $existingUser['status'] != 'DEL') {
$errors[] = ['error' => "User already exists with login {$user['user_id']}", 'index' => $key, 'lang' => ''];
continue;
......
......@@ -410,13 +410,21 @@ class InstallerController
];
foreach ($docservers as $docserver) {
if (!@mkdir("{$body['path']}/{$body['customId']}/{$docserver}", 0755, true)) {
if (is_dir("{$body['path']}/{$body['customId']}/{$docserver}")) {
if (!is_readable("{$body['path']}/{$body['customId']}/{$docserver}") || !is_writable("{$body['path']}/{$body['customId']}/{$docserver}")) {
return $response->withStatus(400)->withJson(['errors' => "Docserver {$body['path']}/{$body['customId']}/{$docserver} is not readable or writable"]);
}
} elseif (!@mkdir("{$body['path']}/{$body['customId']}/{$docserver}", 0755, true)) {
return $response->withStatus(400)->withJson(['errors' => "Docserver folder creation failed for path : {$body['path']}/{$body['customId']}/{$docserver}"]);
}
}
$templatesPath = "{$body['path']}/{$body['customId']}/templates/0000";
if (!@mkdir($templatesPath, 0755, true)) {
if (is_dir($templatesPath)) {
if (!is_readable($templatesPath) || !is_writable($templatesPath)) {
return $response->withStatus(400)->withJson(['errors' => "Docserver {$templatesPath} is not readable or writable"]);
}
} elseif (!@mkdir($templatesPath, 0755, true)) {
return $response->withJson(['success' => "Docservers created but templates folder creation failed"]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment