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

FEAT #10599 TIME 0:05 Delete old document from docservers

parent 2d8a2436
No related branches found
No related tags found
No related merge requests found
......@@ -304,8 +304,8 @@ class DocumentController
}
$pathToDocument = $docserver['path'] . $adr[0]['path'] . $adr[0]['filename'];
if (!file_exists($pathToDocument)) {
return $response->withStatus(404)->withJson(['errors' => 'Document not found on docserver']);
if (!is_file($pathToDocument) || !is_readable($pathToDocument)) {
return $response->withStatus(404)->withJson(['errors' => 'Document not found on docserver or not readable']);
}
$tmpPath = CoreConfigModel::getTmpPath();
......@@ -391,6 +391,7 @@ class DocumentController
return $response->withStatus(500)->withJson(['errors' => $storeInfos['errors']]);
}
unlink($pathToDocument);
AdrModel::deleteDocumentAdr([
'where' => ['main_document_id = ?', 'type = ?'],
'data' => [$args['id'], 'DOC']
......
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