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

This commit is contained in:
Uwe Steinmann 2021-05-10 09:03:15 +02:00
commit 266ae182f0
9 changed files with 91 additions and 16 deletions

View File

@ -210,6 +210,7 @@
- fix php error setting mandatory workflow when uploading documents via webdav
- typeahead search for folders can search in subfolders
- new theme based on bootstrap 4, including many improvements on small displays
- propperly check for translation of html email body (Closes: #510)
--------------------------------------------------------------------------------
Changes in version 5.1.22

View File

@ -40,9 +40,11 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
protected $cmd;
/**
* Run a shell command
*
* @param $cmd
* @param int $timeout
* @return string
* @return array
* @throws Exception
*/
static function execWithTimeout($cmd, $timeout=2) { /* {{{ */
@ -54,7 +56,11 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
$pipes = array();
$timeout += time();
$process = proc_open($cmd, $descriptorspec, $pipes);
// Putting an 'exec' before the command will not fork the command
// and therefore not create any child process. proc_terminate will
// then reliably terminate the cmd and not just shell. See notes of
// https://www.php.net/manual/de/function.proc-terminate.php
$process = proc_open('exec '.$cmd, $descriptorspec, $pipes);
if (!is_resource($process)) {
throw new Exception("proc_open failed on: " . $cmd);
}
@ -79,11 +85,15 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
$timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
if ($timeleft <= 0) {
proc_terminate($process);
throw new Exception("command timeout on: " . $cmd);
} else {
return array('stdout'=>$output, 'stderr'=>$error);
$return_value = proc_close($process);
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
}
} /* }}} */

View File

@ -11,11 +11,11 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2020-12-12</date>
<date>2021-05-10</date>
<time>08:55:43</time>
<version>
<release>1.1.16</release>
<api>1.1.16</api>
<release>1.1.17</release>
<api>1.1.17</api>
</version>
<stability>
<release>stable</release>
@ -23,7 +23,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- add indexing of folders
- close pipes in execWithTimeout(), also return exit code of command
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -352,5 +352,21 @@ Index users with at least read access on the document
and SeedDMS_Lucene_Indexer::open()
</notes>
</release>
<release>
<date>2020-12-12</date>
<time>08:55:43</time>
<version>
<release>1.1.16</release>
<api>1.1.16</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- add indexing of folders
</notes>
</release>
</changelog>
</package>

View File

@ -71,6 +71,14 @@ class SeedDMS_Preview_Base {
$this->xsendfile = $xsendfile;
} /* }}} */
/**
* Run a shell command
*
* @param $cmd
* @param int $timeout
* @return array
* @throws Exception
*/
static function execWithTimeout($cmd, $timeout=5) { /* {{{ */
$descriptorspec = array(
0 => array("pipe", "r"),
@ -109,11 +117,15 @@ class SeedDMS_Preview_Base {
$timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
if ($timeleft <= 0) {
proc_terminate($process);
throw new Exception("command timeout on: " . $cmd);
} else {
return array('stdout'=>$output, 'stderr'=>$error);
$return_value = proc_close($process);
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
}
} /* }}} */

View File

@ -128,6 +128,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
}
return true;
}
$new = false;
return true;
} /* }}} */

View File

@ -14,8 +14,8 @@
<date>2020-12-23</date>
<time>09:49:39</time>
<version>
<release>1.3.2</release>
<api>1.3.1</api>
<release>1.3.3</release>
<api>1.3.3</api>
</version>
<stability>
<release>stable</release>
@ -23,8 +23,9 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
set header Content-Length
update package description
- close pipes in execWithTimeout(), also return exit code of command
- createPreview() has optional parameter by referenz to return true if a
preview image was actually created
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -453,5 +454,22 @@ add new methode getPreviewFile()
add parameter $target to SeedDMS_Preview_pdfPreviewer::hasRawPreview() and SeedDMS_Preview_pdfPreviewer::getRawPreview()
</notes>
</release>
<release>
<date>2020-12-23</date>
<time>09:49:39</time>
<version>
<release>1.3.2</release>
<api>1.3.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
set header Content-Length
update package description
</notes>
</release>
</changelog>
</package>

View File

@ -44,6 +44,14 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
*/
protected $cmd;
/**
* Run a shell command
*
* @param $cmd
* @param int $timeout
* @return array
* @throws Exception
*/
static function execWithTimeout($cmd, $timeout=2) { /* {{{ */
$descriptorspec = array(
0 => array("pipe", "r"),
@ -53,7 +61,11 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
$pipes = array();
$timeout += time();
$process = proc_open($cmd, $descriptorspec, $pipes);
// Putting an 'exec' before the command will not fork the command
// and therefore not create any child process. proc_terminate will
// then reliably terminate the cmd and not just shell. See notes of
// https://www.php.net/manual/de/function.proc-terminate.php
$process = proc_open('exec '.$cmd, $descriptorspec, $pipes);
if (!is_resource($process)) {
throw new Exception("proc_open failed on: " . $cmd);
}
@ -78,11 +90,15 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
$timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
if ($timeleft <= 0) {
proc_terminate($process);
throw new Exception("command timeout on: " . $cmd);
} else {
return array('stdout'=>$output, 'stderr'=>$error);
$return_value = proc_close($process);
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
}
} /* }}} */

View File

@ -11,7 +11,7 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2021-04-19</date>
<date>2021-05-10</date>
<time>08:57:44</time>
<version>
<release>1.0.16</release>
@ -23,6 +23,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- close pipes in execWithTimeout(), also return exit code of command
- add support for fts5 (make it the default)
</notes>
<contents>

View File

@ -133,7 +133,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
}
$bodyhtml = '';
if(isset($params['__body_html__']) || getMLText($messagekey.'_html')) {
if(isset($params['__body_html__']) || getMLText($messagekey.'_html', $params, "", $lang)) {
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
if(!isset($params['__header_html__']))
$bodyhtml .= getMLText("email_header_html", $params, "", $lang)."\r\n\r\n";