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

This commit is contained in:
Uwe Steinmann 2020-01-21 17:32:24 +01:00
commit 11a8a8087f
6 changed files with 50 additions and 15 deletions

View File

@ -135,6 +135,7 @@
- clean up code for managing extensions
- fix renaming of folders via webdav
- fix list of expired documents on MyDocuments page
- pass showtree to ViewDocument (Closes: #462)
--------------------------------------------------------------------------------
Changes in version 5.1.13

View File

@ -50,6 +50,12 @@ class SeedDMS_Preview_Base {
*/
protected $xsendfile;
/**
* @var string $lastpreviewfile will be set to the file name of the last preview
* @access protected
*/
protected $lastpreviewfile;
function __construct($previewDir, $timeout=5, $xsendfile=true) { /* {{{ */
if(!is_dir($previewDir)) {
if (!SeedDMS_Core_File::makeDir($previewDir)) {
@ -158,14 +164,14 @@ class SeedDMS_Preview_Base {
return array_key_exists($mimetype, $this->converters) && $this->converters[$mimetype];
} /* }}} */
/**
* Send a file from disk to the browser
*
* This function uses either readfile() or the xѕendfile apache module if
* it is installed.
*
* @param string $filename
*/
/**
* Send a file from disk to the browser
*
* This function uses either readfile() or the xѕendfile apache module if
* it is installed.
*
* @param string $filename
*/
protected function sendFile($filename) { /* {{{ */
if($this->xsendfile && function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
header("X-Sendfile: ".$filename);
@ -177,5 +183,14 @@ class SeedDMS_Preview_Base {
readfile($filename);
}
} /* }}} */
/**
* Return path of last created preview file
*
* @return string
*/
public function getPreviewFile() { /* {{{ */
return $this->lastpreviewfile;
} /* }}} */
}

View File

@ -96,6 +96,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
return false;
if(!$target)
$target = $this->previewDir.$dir.md5($infile);
$this->lastpreviewfile = $target.'.png';
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
$cmd = '';
$mimeparts = explode('/', $mimetype, 2);
@ -110,6 +111,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
try {
self::execWithTimeout($cmd, $this->timeout);
} catch(Exception $e) {
$this->lastpreviewfile = '';
return false;
}
}

View File

@ -105,6 +105,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
return false;
if(!$target)
$target = $this->previewDir.$dir.md5($infile).'-'.$width;
$this->lastpreviewfile = $target.'.png';
if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) {
$cmd = '';
$mimeparts = explode('/', $mimetype, 2);
@ -120,6 +121,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
try {
self::execWithTimeout($cmd, $this->timeout);
} catch(Exception $e) {
$this->lastpreviewfile = '';
return false;
}
}

View File

@ -11,11 +11,11 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2019-02-11</date>
<date>2020-01-21</date>
<time>10:59:39</time>
<version>
<release>1.2.10</release>
<api>1.2.10</api>
<release>1.3.0</release>
<api>1.3.0</api>
</version>
<stability>
<release>stable</release>
@ -23,10 +23,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
make sure list of converters is always an array
usage of mod_sendfile can be configured
new parameter for enabling/disabling xsendfile
fix creation of pdf preview if document content class is not SeedDMS_Core_DocumentContent
add new methode getPreviewFile()
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -406,5 +403,22 @@ make sure list of converters is always an array
usage of mod_sendfile can be configured
</notes>
</release>
<release>
<date>2019-02-11</date>
<time>10:59:39</time>
<version>
<release>1.2.10</release>
<api>1.2.10</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
new parameter for enabling/disabling xsendfile
fix creation of pdf preview if document content class is not SeedDMS_Core_DocumentContent
</notes>
</release>
</changelog>
</package>

View File

@ -90,6 +90,7 @@ if($view) {
$view->setParam('pdfConverters', isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array());
$view->setParam('checkOutDir', $settings->_checkOutDir);
$view->setParam('showFullPreview', $settings->_showFullPreview);
$view->setParam('showtree', showtree());
$view->setParam('convertToPdf', $settings->_convertToPdf);
$view->setParam('currenttab', isset($_GET['currenttab']) ? $_GET['currenttab'] : "");
$view->setParam('timeout', $settings->_cmdTimeout);