diff --git a/SeedDMS_Lucene/Lucene/IndexedDocument.php b/SeedDMS_Lucene/Lucene/IndexedDocument.php index 874bfd149..54dbb2676 100644 --- a/SeedDMS_Lucene/Lucene/IndexedDocument.php +++ b/SeedDMS_Lucene/Lucene/IndexedDocument.php @@ -31,24 +31,25 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { 2 => array("pipe", "w") ); $pipes = array(); - - $timeout += time(); + + $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]); + $write = NULL; + $exeptions = NULL; do { - $timeleft = $timeout - time(); - $read = array($pipes[1]); - $write = NULL; - $exeptions = NULL; 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) { @@ -127,19 +128,12 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { $mimetype = $version->getMimeType(); if(isset($_convcmd[$mimetype])) { $cmd = sprintf($_convcmd[$mimetype], $path); - $content = self::execWithTimeout($cmd, $timeout); - /* - $fp = popen($cmd, 'r'); - if($fp) { - $content = ''; - while(!feof($fp)) { - $content .= fread($fp, 2048); + try { + $content = self::execWithTimeout($cmd, $timeout); + if($content) { + $this->addField(Zend_Search_Lucene_Field::UnStored('content', $content, 'utf-8')); } - pclose($fp); - } - */ - if($content) { - $this->addField(Zend_Search_Lucene_Field::UnStored('content', $content, 'utf-8')); + } catch (Exception $e) { } } } diff --git a/SeedDMS_Lucene/package.xml b/SeedDMS_Lucene/package.xml index 3f5e3d45c..774715d7b 100644 --- a/SeedDMS_Lucene/package.xml +++ b/SeedDMS_Lucene/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2016-04-28 - + 2017-03-01 + - 1.1.9 - 1.1.7 + 1.1.10 + 1.1.10 stable @@ -23,8 +23,7 @@ GPL License -pass variables to stream_select() to fullfill strict standards. -make all functions in Indexer.php static +catch exception in execWithTimeout() @@ -235,5 +234,22 @@ add command for indexing postѕcript files set last parameter of stream_select() to 200000 micro sec. in case the timeout in sec. is set to 0 + + 2016-04-28 + + + 1.1.9 + 1.1.7 + + + stable + stable + + GPL License + +pass variables to stream_select() to fullfill strict standards. +make all functions in Indexer.php static + + diff --git a/SeedDMS_Preview/Preview/PdfPreviewer.php b/SeedDMS_Preview/Preview/PdfPreviewer.php index 10005afc7..f3c618b9f 100644 --- a/SeedDMS_Preview/Preview/PdfPreviewer.php +++ b/SeedDMS_Preview/Preview/PdfPreviewer.php @@ -89,8 +89,13 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base { $target = $this->previewDir.$dir.md5($infile); if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) { $cmd = ''; + $mimeparts = explode('/', $mimetype, 2); if(isset($this->converters[$mimetype])) { - $cmd = str_replace(array('%f', '%o'), array($infile, $target.'.pdf'), $this->converters[$mimetype]); + $cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters[$mimetype]); + } elseif(isset($this->converters[$mimeparts[0].'/*'])) { + $cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters[$mimeparts[0].'/*']); + } elseif(isset($this->converters['*'])) { + $cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters['*']); } if($cmd) { try { diff --git a/SeedDMS_Preview/Preview/Previewer.php b/SeedDMS_Preview/Preview/Previewer.php index 8c9b67713..970fcdb95 100644 --- a/SeedDMS_Preview/Preview/Previewer.php +++ b/SeedDMS_Preview/Preview/Previewer.php @@ -106,9 +106,15 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base { $target = $this->previewDir.$dir.md5($infile).'-'.$width; if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) { $cmd = ''; + $mimeparts = explode('/', $mimetype, 2); if(isset($this->converters[$mimetype])) { - $cmd = str_replace(array('%w', '%f', '%o'), array($width, $infile, $target.'.png'), $this->converters[$mimetype]); + $cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters[$mimetype]); + } elseif(isset($this->converters[$mimeparts[0].'/*'])) { + $cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters[$mimeparts[0].'/*']); + } elseif(isset($this->converters['*'])) { + $cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters['*']); } + /* switch($mimetype) { case "image/png": @@ -131,7 +137,6 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base { } */ if($cmd) { - //exec($cmd); try { self::execWithTimeout($cmd, $this->timeout); } catch(Exception $e) { diff --git a/SeedDMS_Preview/package.xml b/SeedDMS_Preview/package.xml index 6422fe77c..71eb627ba 100644 --- a/SeedDMS_Preview/package.xml +++ b/SeedDMS_Preview/package.xml @@ -11,10 +11,10 @@ uwe@steinmann.cx yes - 2016-11-15 - + 2017-03-02 + - 1.2.1 + 1.2.2 1.2.0 @@ -23,7 +23,8 @@ GPL License -setConverters() overrides exiting converters +commands can be set for mimetypes 'xxxx/*' and '*' +pass mimetype as parameter '%m' to converter @@ -254,5 +255,21 @@ check if cache dir exists before deleting it in deleteDocumentPreviews() add new previewer which converts document to pdf instead of png + + 2016-11-15 + + + 1.2.1 + 1.2.0 + + + stable + stable + + GPL License + +setConverters() overrides exiting converters + + diff --git a/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php b/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php index ed664da77..5d2914074 100644 --- a/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php +++ b/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php @@ -37,7 +37,7 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { ); $pipes = array(); - $timeout += time(); + $timeout += time(); $process = proc_open($cmd, $descriptorspec, $pipes); if (!is_resource($process)) { throw new Exception("proc_open failed on: " . $cmd); @@ -53,7 +53,7 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { if (!empty($read)) { $output .= fread($pipes[1], 8192); - } + } $timeleft = $timeout - time(); } while (!feof($pipes[1]) && $timeleft > 0); @@ -133,9 +133,12 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { $mimetype = $version->getMimeType(); if(isset($_convcmd[$mimetype])) { $cmd = sprintf($_convcmd[$mimetype], $path); - $content = self::execWithTimeout($cmd, $timeout); - if($content) { - $this->addField('content', $content, 'unstored'); + try { + $content = self::execWithTimeout($cmd, $timeout); + if($content) { + $this->addField('content', $content, 'unstored'); + } + } catch (Exception $e) { } } } diff --git a/SeedDMS_SQLiteFTS/package.xml b/SeedDMS_SQLiteFTS/package.xml index 9cb06a0d0..62167bb8e 100644 --- a/SeedDMS_SQLiteFTS/package.xml +++ b/SeedDMS_SQLiteFTS/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2016-03-29 - + 2017-03-01 + - 1.0.6 - 1.0.1 + 1.0.7 + 1.0.7 stable @@ -23,7 +23,7 @@ GPL License -fix calculation of timeout (see bug #269) +catch exception in execWithTimeout() @@ -162,5 +162,21 @@ make it work with sqlite3 < 3.8.0 set last parameter of stream_select() to 200000 micro sec. in case the timeout in sec. is set to 0 + + 2016-03-29 + + + 1.0.6 + 1.0.1 + + + stable + stable + + GPL License + +fix calculation of timeout (see bug #269) + + diff --git a/op/op.Settings.php b/op/op.Settings.php index 0ff28d117..a82d7b0c7 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -188,7 +188,7 @@ if ($action == "saveSettings") // SETTINGS - ADVANCED - INDEX CMD $settings->_converters['fulltext'] = $_POST["converters"]; - $newmimetype = preg_replace('#[^A-Za-z0-9_/+.-]+#', '', $_POST["converters_newmimetype"]); + $newmimetype = preg_replace('#[^A-Za-z0-9_/+.-*]+#', '', $_POST["converters_newmimetype"]); if($newmimetype && trim($_POST["converters_newcmd"])) { $settings->_converters['fulltext'][$newmimetype] = trim($_POST["converters_newcmd"]); } diff --git a/views/bootstrap/class.Indexer.php b/views/bootstrap/class.Indexer.php index aa3a459ce..78e6bf93a 100644 --- a/views/bootstrap/class.Indexer.php +++ b/views/bootstrap/class.Indexer.php @@ -62,6 +62,7 @@ function check_queue() { data: {command: 'indexdocument', id: docid}, beforeSend: function() { queue_count++; // Add request to the counter + $('.queue-bar').css('width', (queue_count*100/MAX_REQUESTS)+'%'); }, error: function(xhr, textstatus) { noty({