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

This commit is contained in:
Uwe Steinmann 2017-09-20 09:24:00 +02:00
commit c9d01565ba
9 changed files with 42 additions and 15 deletions

View File

@ -49,6 +49,7 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.0.14 Changes in version 5.0.14
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- use cmd timeout when indexing documents (Closes #344)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.0.13 Changes in version 5.0.13
@ -152,6 +153,7 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 4.3.37 Changes in version 4.3.37
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- fix label in password forgotten form (Closes #346)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 4.3.36 Changes in version 4.3.36

View File

@ -64,13 +64,13 @@ class SeedDMS_Preview_Base {
2 => array("pipe", "w") 2 => array("pipe", "w")
); );
$pipes = array(); $pipes = array();
$timeout += time(); $timeout += time();
$process = proc_open($cmd, $descriptorspec, $pipes); $process = proc_open($cmd, $descriptorspec, $pipes);
if (!is_resource($process)) { if (!is_resource($process)) {
throw new Exception("proc_open failed on: " . $cmd); throw new Exception("proc_open failed on: " . $cmd);
} }
$output = ''; $output = '';
$timeleft = $timeout - time(); $timeleft = $timeout - time();
$read = array($pipes[1]); $read = array($pipes[1]);
@ -78,13 +78,13 @@ class SeedDMS_Preview_Base {
$exeptions = NULL; $exeptions = NULL;
do { do {
stream_select($read, $write, $exeptions, $timeleft, 200000); stream_select($read, $write, $exeptions, $timeleft, 200000);
if (!empty($read)) { if (!empty($read)) {
$output .= fread($pipes[1], 8192); $output .= fread($pipes[1], 8192);
} }
$timeleft = $timeout - time(); $timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0); } while (!feof($pipes[1]) && $timeleft > 0);
if ($timeleft <= 0) { if ($timeleft <= 0) {
proc_terminate($process); proc_terminate($process);
throw new Exception("command timeout on: " . $cmd); throw new Exception("command timeout on: " . $cmd);
@ -109,7 +109,7 @@ class SeedDMS_Preview_Base {
/** /**
* Check if converter for a given mimetype is set * Check if converter for a given mimetype is set
* *
* @param string $mimetype * @param string $mimetype
* @return boolean true if converter exists, otherwise false * @return boolean true if converter exists, otherwise false
*/ */
function hasConverter($mimetype) { /* {{{ */ function hasConverter($mimetype) { /* {{{ */

View File

@ -101,6 +101,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
try { try {
self::execWithTimeout($cmd, $this->timeout); self::execWithTimeout($cmd, $this->timeout);
} catch(Exception $e) { } catch(Exception $e) {
return false;
} }
} }
return true; return true;

View File

@ -140,6 +140,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
try { try {
self::execWithTimeout($cmd, $this->timeout); self::execWithTimeout($cmd, $this->timeout);
} catch(Exception $e) { } catch(Exception $e) {
return false;
} }
} }
return true; return true;

View File

@ -11,10 +11,10 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2017-03-02</date> <date>2017-09-18</date>
<time>07:14:59</time> <time>07:14:32</time>
<version> <version>
<release>1.2.2</release> <release>1.2.3</release>
<api>1.2.0</api> <api>1.2.0</api>
</version> </version>
<stability> <stability>
@ -23,8 +23,7 @@
</stability> </stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
commands can be set for mimetypes 'xxxx/*' and '*' createPreview() returns false if running the converter command fails
pass mimetype as parameter '%m' to converter
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">
@ -271,5 +270,22 @@ add new previewer which converts document to pdf instead of png
setConverters() overrides exiting converters setConverters() overrides exiting converters
</notes> </notes>
</release> </release>
<release>
<date>2017-03-02</date>
<time>07:14:59</time>
<version>
<release>1.2.2</release>
<api>1.2.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
commands can be set for mimetypes 'xxxx/*' and '*'
pass mimetype as parameter '%m' to converter
</notes>
</release>
</changelog> </changelog>
</package> </package>

View File

@ -771,7 +771,7 @@ switch($command) {
$index = $indexconf['Indexer']::open($settings->_luceneDir); $index = $indexconf['Indexer']::open($settings->_luceneDir);
if($index) { if($index) {
$indexconf['Indexer']::init($settings->_stopWordsFile); $indexconf['Indexer']::init($settings->_stopWordsFile);
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false); $idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout);
if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) { if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) { foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
if (method_exists($hookObj, 'preIndexDocument')) { if (method_exists($hookObj, 'preIndexDocument')) {

View File

@ -73,8 +73,15 @@ if(!empty($_GET["width"]))
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $_GET["width"]); $previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $_GET["width"]);
else else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir); $previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
if(!$previewer->hasPreview($object)) if(!$previewer->hasPreview($object)) {
$previewer->createPreview($object); if(!$previewer->createPreview($object)) {
}
}
if(!$previewer->hasPreview($object)) {
header('Content-Type: image/svg+xml');
readfile('../views/'.$theme.'/images/empty.svg');
exit;
}
header('Content-Type: image/png'); header('Content-Type: image/png');
$previewer->getPreview($object); $previewer->getPreview($object);

View File

@ -1249,7 +1249,7 @@ $(document).ready(function() {
print "<div class=\"input-append\">\n"; print "<div class=\"input-append\">\n";
print "<input readonly type=\"text\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".$dropfolderfile."\">"; print "<input readonly type=\"text\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".$dropfolderfile."\">";
print "<button type=\"button\" class=\"btn\" id=\"clearfilename".$formName."\"><i class=\"icon-remove\"></i></button>"; print "<button type=\"button\" class=\"btn\" id=\"clearfilename".$formName."\"><i class=\"icon-remove\"></i></button>";
print "<a data-target=\"#dropfolderChooser\" href=\"../out/out.DropFolderChooser.php?form=form1&dropfolderfile=".$dropfolderfile."&showfolders=".$showfolders."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".($showfolders ? getMLText("choose_target_folder"): getMLText("choose_target_file"))."…</a>\n"; print "<a data-target=\"#dropfolderChooser\" href=\"../out/out.DropFolderChooser.php?form=form1&dropfolderfile=".urlencode($dropfolderfile)."&showfolders=".$showfolders."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".($showfolders ? getMLText("choose_target_folder"): getMLText("choose_target_file"))."…</a>\n";
print "</div>\n"; print "</div>\n";
?> ?>
<div class="modal hide" id="dropfolderChooser" tabindex="-1" role="dialog" aria-labelledby="dropfolderChooserLabel" aria-hidden="true"> <div class="modal hide" id="dropfolderChooser" tabindex="-1" role="dialog" aria-labelledby="dropfolderChooserLabel" aria-hidden="true">

View File

@ -82,7 +82,7 @@ document.form1.email.focus();
<p><?php printMLText("password_forgotten_text"); ?></p> <p><?php printMLText("password_forgotten_text"); ?></p>
<div class="control-group"> <div class="control-group">
<label class="control-label"><?php printMLText("login");?>:</label> <label class="control-label"><?php printMLText("user_login");?>:</label>
<div class="controls"> <div class="controls">
<input type="text" name="login" id="login"> <input type="text" name="login" id="login">
</div> </div>