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
--------------------------------------------------------------------------------
- use cmd timeout when indexing documents (Closes #344)
--------------------------------------------------------------------------------
Changes in version 5.0.13
@ -152,6 +153,7 @@
--------------------------------------------------------------------------------
Changes in version 4.3.37
--------------------------------------------------------------------------------
- fix label in password forgotten form (Closes #346)
--------------------------------------------------------------------------------
Changes in version 4.3.36

View File

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

View File

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

View File

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

View File

@ -11,10 +11,10 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2017-03-02</date>
<time>07:14:59</time>
<date>2017-09-18</date>
<time>07:14:32</time>
<version>
<release>1.2.2</release>
<release>1.2.3</release>
<api>1.2.0</api>
</version>
<stability>
@ -23,8 +23,7 @@
</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
createPreview() returns false if running the converter command fails
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -271,5 +270,22 @@ add new previewer which converts document to pdf instead of png
setConverters() overrides exiting converters
</notes>
</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>
</package>

View File

@ -771,7 +771,7 @@ switch($command) {
$index = $indexconf['Indexer']::open($settings->_luceneDir);
if($index) {
$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'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
if (method_exists($hookObj, 'preIndexDocument')) {

View File

@ -73,8 +73,15 @@ if(!empty($_GET["width"]))
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $_GET["width"]);
else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
if(!$previewer->hasPreview($object))
$previewer->createPreview($object);
if(!$previewer->hasPreview($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');
$previewer->getPreview($object);

View File

@ -1249,7 +1249,7 @@ $(document).ready(function() {
print "<div class=\"input-append\">\n";
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 "<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";
?>
<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>
<div class="control-group">
<label class="control-label"><?php printMLText("login");?>:</label>
<label class="control-label"><?php printMLText("user_login");?>:</label>
<div class="controls">
<input type="text" name="login" id="login">
</div>