do not create new version anymore, unless the user, mimetype has changed

This commit is contained in:
Uwe Steinmann 2014-11-27 13:42:00 +01:00
parent d6565041cd
commit 671fbd1f33

View File

@ -542,11 +542,23 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$lc = $document->getLatestContent(); $lc = $document->getLatestContent();
if($lc->getChecksum() == SeedDMS_Core_File::checksum($tmpFile)) { if($lc->getChecksum() == SeedDMS_Core_File::checksum($tmpFile)) {
$lc->setDate(); $lc->setDate();
} elseif(!$document->addContent('', $this->user, $tmpFile, $name, $fileType, $mimetype, array(), array(), 0)) { } else {
if($this->user->getID() == $lc->getUser()->getID() &&
$name == $lc->getOriginalFileName() &&
$fileType == $lc->getFileType() &&
$mimetype == $lc->getMimeType()) {
if(!$document->replaceContent($lc->getVersion(), $this->user, $tmpFile, $name, $fileType, $mimetype)) {
unlink($tmpFile);
return "403 Forbidden";
}
} else {
if(!$document->addContent('', $this->user, $tmpFile, $name, $fileType, $mimetype, array(), array(), 0)) {
unlink($tmpFile); unlink($tmpFile);
return "409 Conflict"; return "409 Conflict";
} }
} }
}
}
} else { } else {
if ($folder->getAccessMode($this->user) < M_READWRITE) { if ($folder->getAccessMode($this->user) < M_READWRITE) {