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

This commit is contained in:
Uwe Steinmann 2020-02-12 17:29:52 +01:00
commit 5ff1333c9f
6 changed files with 60 additions and 9 deletions

View File

@ -136,6 +136,7 @@
- fix renaming of folders via webdav
- fix list of expired documents on MyDocuments page
- pass showtree to ViewDocument (Closes: #462)
- fix upgrade script for sqlite3
--------------------------------------------------------------------------------
Changes in version 5.1.13

View File

@ -1996,7 +1996,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if($fileType == '.')
$fileType = '';
/* Check if $user, $orgFileName, $fileType and $mimetype are the same */
/* Check if $user, $orgFileName, $fileType and $mimeType are the same */
if($user->getID() != $content->getUser()->getID()) {
return false;
}
@ -3411,7 +3411,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
*
* @return string path of file on disc
*/
function getPath() { return $this->_document->getDir() . $this->_version . ($this->_fileType != '.' ? $this->_fileType : ''); }
function getPath() { return $this->_document->getDir() . $this->_version . $this->_fileType; }
function setRevisionDate($date = false) { /* {{{ */
$db = $this->_document->getDMS()->getDB();
@ -6349,6 +6349,50 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return $needwkflaction;
} /* }}} */
/**
* Checks the internal data of the document version and repairs it.
* Currently, this function only repairs a missing filetype
*
* @return boolean true on success, otherwise false
*/
function repair() { /* {{{ */
$dms = $this->_document->getDMS();
$db = $this->_dms->getDB();
if(file_exists($this->_dms->contentDir.$this->_document->getDir() . $this->_version . $this->_fileType)) {
if(strlen($this->_fileType) < 2) {
switch($this->_mimeType) {
case "application/pdf":
case "image/png":
case "image/gif":
case "image/jpg":
$expect = substr($this->_mimeType, -3, 3);
if($this->_fileType != '.'.$expect) {
$db->startTransaction();
$queryStr = "UPDATE `tblDocumentContent` SET `fileType`='.".$expect."' WHERE `id` = ". $this->_id;
echo $queryStr."<br />";
$res = $db->getResult($queryStr);
if ($res) {
if(!SeedDMS_Core_File::renameFile($this->_dms->contentDir.$this->_document->getDir() . $this->_version . $this->_fileType, $this->_dms->contentDir.$this->_document->getDir() . $this->_version . '.' . $expect)) {
$db->rollbackTransaction();
} else {
$db->commitTransaction();
}
} else {
$db->rollbackTransaction();
}
}
break;
}
}
} elseif(file_exists($this->_document->getDir() . $this->_version . '.')) {
echo "no file";
} else {
echo $this->_dms->contentDir.$this->_document->getDir() . $this->_version . $this->_fileType;
}
return true;
} /* }}} */
} /* }}} */

View File

@ -96,7 +96,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
return false;
if(!$target)
$target = $this->previewDir.$dir.md5($infile);
$this->lastpreviewfile = $target.'.png';
$this->lastpreviewfile = $target.'.pdf';
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
$cmd = '';
$mimeparts = explode('/', $mimetype, 2);

View File

@ -203,5 +203,3 @@ class SeedDMS_ExtExample_Task extends SeedDMS_SchedulerTaskBase {
));
}
}
?>

View File

@ -223,6 +223,7 @@ if($view) {
$view->setParam('setfilesize', $setfilesize);
$view->setParam('setchecksum', $setchecksum);
$view->setParam('repair', $repair);
$view->setParam('showtree', showtree());
$view->setParam('rootfolder', $rootfolder);
$view->setParam('repairobjects', $repairobjects);
$view->setParam('cachedir', $settings->_cacheDir);
@ -230,8 +231,11 @@ if($view) {
$view->setParam('previewconverters', $settings->_converters['preview']);
$view->setParam('timeout', $settings->_cmdTimeout);
$view->setParam('accessobject', $accessop);
$view->setParam('previewWidthList', $settings->_previewWidthList);
$view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array());
$view->setParam('timeout', $settings->_cmdTimeout);
$view->setParam('xsendfile', $settings->_enableXsendfile);
$view($_GET);
exit;
}
?>

View File

@ -128,8 +128,8 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Bootstrap_Style {
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("id")."</th>\n";
print "<th>".getMLText("parent")."</th>\n";
print "<th>".getMLText("error")."</th>\n";
print "<th></th>\n";
print "<th>".getMLText("error")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($unlinkedfolders as $error) {
echo "<tr>";
@ -230,10 +230,12 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Bootstrap_Style {
foreach($nofilesizeversions as $version) {
$doc = $version->getDocument();
print "<tr><td>".$doc->getId()."</td><td>".$version->getVersion()."</td><td>".$version->getOriginalFileName()."</td><td>".$version->getMimeType()."</td>";
echo "<td>";
if($setfilesize) {
if($version->setFileSize())
echo "<td>".getMLText('repaired')."</td>";
echo getMLText('repaired');
}
echo "</td>";
print "</tr>\n";
}
print "</tbody></table>\n";
@ -264,10 +266,12 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Bootstrap_Style {
foreach($nochecksumversions as $version) {
$doc = $version->getDocument();
print "<tr><td>".$doc->getId()."</td><td>".$version->getVersion()."</td><td>".$version->getOriginalFileName()."</td><td>".$version->getMimeType()."</td>";
echo "<td>";
if($setchecksum) {
if($version->setChecksum())
echo "<td>".getMLText('repaired')."</td>";
echo getMLText('repaired');
}
echo "</td>";
print "</tr>\n";
}
print "</tbody></table>\n";