Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2022-11-09 19:15:55 +01:00
commit 971dc536f7
2 changed files with 16 additions and 15 deletions

View File

@ -1,5 +1,5 @@
WebDAV
-----------------------------------------------
========
SeedDMS has support for WebDAV which allows to easily add, delete,
move, copy and modify documents. All operating systems have support
@ -29,7 +29,7 @@ the content of document or creating a new
version if a document is saved.
Configuring davfs2
===================
-------------------
On Linux it is quite simple to mount the SeedDMS WebDAV server with
davfs2. Just place a line like the following in your /etc/fstab
@ -51,15 +51,14 @@ and possibly add your login data to /etc/davfs2/secrets
/media/webdav admin secret
Making applications work with WebDAV
=====================================
-------------------------------------
Various programms have differnt strategies to save files to disc and
prevent data lost under all circumstances. Those strategies often don't
work very well an a WebDAV-Server. The following will list some of those
strategies.
VIM
=========================
### VIM
vim does a lot more than just reading and writing the file you want
to edit. It creates swap and backup files for data recovery if vim crashes
@ -69,7 +68,7 @@ swap file at all or create it outside the WebDAV server. A second problem
arises from how vim modifіes the file you are editing. Before a file
is saved a backup is created by renaming the file to the same name with a
'~' at the end and writing the file content into a new
file with the name of the original file. Afterwards vim deleteѕ the backup
file with the name of the original file. Afterwards vim deletes the backup
file. On a regular file system you
won't see a difference between the file before and after saving, though
it is actually a new one. In SeedDMS you won't notice a difference either
@ -89,11 +88,10 @@ set nowritebackup
set noswapfile
Creating the backup file in a directory outside of WebDAV doesn't help in
this case, because it still does the file renaming which is turned of by
this case, because it still does the file renaming which is turned off by
'nowritebackup'.
cdaver
========
### cdaver
cadaver is a webdav client similar to classical command line based ftp clients.
It can be used to browse through the folders, downloads and uploads files, and

View File

@ -663,14 +663,17 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$tmp = explode(';', $mimetype);
$mimetype = $tmp[0];
$lastDotIndex = strrpos($name, ".");
if($lastDotIndex === false) $fileType = ".";
else $fileType = substr($name, $lastDotIndex);
switch($mimetype) {
case 'application/pdf';
case 'application/pdf':
$fileType = ".pdf";
break;
default:
$lastDotIndex = strrpos($name, ".");
if($lastDotIndex === false) $fileType = ".";
else $fileType = substr($name, $lastDotIndex);
case 'text/plain':
if($fileType == '.md')
$mimetype = 'text/markdown';
break;
}
if($this->logger)
$this->logger->log('PUT: file is of type '.$mimetype, PEAR_LOG_INFO);
@ -698,7 +701,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
unlink($tmpFile);
return "403 Forbidden";
} else {
/* Check if the new version iѕ identical to the current version.
/* Check if the new version is identical to the current version.
* In that case just update the modification date
*/
$lc = $document->getLatestContent();