From 162353b5e04d6255ff7ec9f056e2fcc55179c7ab Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 10 Apr 2018 19:13:57 +0200 Subject: [PATCH 1/2] increase timeout of noty error --- views/bootstrap/class.Indexer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.Indexer.php b/views/bootstrap/class.Indexer.php index 9c850df45..2ef1c4bee 100644 --- a/views/bootstrap/class.Indexer.php +++ b/views/bootstrap/class.Indexer.php @@ -82,11 +82,11 @@ function check_queue() { $('#status_'+data.data).html(''); noty({ text: data.message, - type: (data.success) ? 'success' : 'error', + type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', - timeout: 1500, + timeout: 25000, }); } }, From 9fb899a61ad301d6fdf49c01ef4a246606f4a666 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 11 Apr 2018 15:31:35 +0200 Subject: [PATCH 2/2] better error reporting when indexing fails --- SeedDMS_Lucene/Lucene/IndexedDocument.php | 22 ++++++++++++++++ SeedDMS_Lucene/package.xml | 24 +++++++++++++++--- .../SQLiteFTS/IndexedDocument.php | 25 +++++++++++++++++++ SeedDMS_SQLiteFTS/package.xml | 24 +++++++++++++++--- op/op.Ajax.php | 2 +- views/bootstrap/class.Indexer.php | 2 +- 6 files changed, 89 insertions(+), 10 deletions(-) diff --git a/SeedDMS_Lucene/Lucene/IndexedDocument.php b/SeedDMS_Lucene/Lucene/IndexedDocument.php index c20acdf9f..237150097 100644 --- a/SeedDMS_Lucene/Lucene/IndexedDocument.php +++ b/SeedDMS_Lucene/Lucene/IndexedDocument.php @@ -29,6 +29,16 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { */ protected $errormsg; + /** + * @var string + */ + protected $mimetype; + + /** + * @var string + */ + protected $cmd; + /** * @param $cmd * @param int $timeout @@ -88,6 +98,8 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { */ public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) { /* {{{ */ $this->errormsg = ''; + $this->cmd = ''; + $this->mimetype = ''; $_convcmd = array( 'application/pdf' => 'pdftotext -enc UTF-8 -nopgbrk %s - |sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'', 'application/postscript' => 'ps2pdf14 %s - | pdftotext -enc UTF-8 -nopgbrk - - | sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'', @@ -148,6 +160,7 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { $path = $dms->contentDir . $version->getPath(); $content = ''; $mimetype = $version->getMimeType(); + $this->mimetype = $mimetype; $cmd = ''; $mimeparts = explode('/', $mimetype, 2); if(isset($_convcmd[$mimetype])) { @@ -158,6 +171,7 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { $cmd = sprintf($_convcmd[$mimetype], $path); } if($cmd) { + $this->cmd = $cmd; try { $content = self::execWithTimeout($cmd, $timeout); if($content['stdout']) { @@ -175,5 +189,13 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { public function getErrorMsg() { /* {{{ */ return $this->errormsg; } /* }}} */ + + public function getMimeType() { /* {{{ */ + return $this->mimetype; + } /* }}} */ + + public function getCmd() { /* {{{ */ + return $this->cmd; + } /* }}} */ } ?> diff --git a/SeedDMS_Lucene/package.xml b/SeedDMS_Lucene/package.xml index f0dd0f558..4f55862ad 100644 --- a/SeedDMS_Lucene/package.xml +++ b/SeedDMS_Lucene/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2018-01-30 + 2018-04-11 - 1.1.12 - 1.1.12 + 1.1.13 + 1.1.13 stable @@ -23,7 +23,7 @@ GPL License -execWithTimeout() reads data from stderr and saves it into error msg +IndexedDocument() remembers cmd and mimetype @@ -283,5 +283,21 @@ catch exception in execWithTimeout() allow conversion commands for mimetypes with wildcards + + 2018-01-30 + + + 1.1.12 + 1.1.12 + + + stable + stable + + GPL License + +execWithTimeout() reads data from stderr and saves it into error msg + + diff --git a/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php b/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php index cf40b4a95..fb87503b8 100644 --- a/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php +++ b/SeedDMS_SQLiteFTS/SQLiteFTS/IndexedDocument.php @@ -29,8 +29,21 @@ require_once('Document.php'); */ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { + /** + * @var string + */ protected $errormsg; + /** + * @var string + */ + protected $mimetype; + + /** + * @var string + */ + protected $cmd; + static function execWithTimeout($cmd, $timeout=2) { /* {{{ */ $descriptorspec = array( 0 => array("pipe", "r"), @@ -79,6 +92,8 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { */ public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) { /* {{{ */ $this->errormsg = ''; + $this->cmd = ''; + $this->mimetype = ''; $_convcmd = array( 'application/pdf' => 'pdftotext -enc UTF-8 -nopgbrk %s - |sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'', 'application/postscript' => 'ps2pdf14 %s - | pdftotext -enc UTF-8 -nopgbrk - - | sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'', @@ -139,6 +154,7 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { $path = $dms->contentDir . $version->getPath(); $content = ''; $mimetype = $version->getMimeType(); + $this->mimetype = $mimetype; $cmd = ''; $mimeparts = explode('/', $mimetype, 2); if(isset($_convcmd[$mimetype])) { @@ -149,6 +165,7 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { $cmd = sprintf($_convcmd[$mimetype], $path); } if($cmd) { + $this->cmd = $cmd; try { $content = self::execWithTimeout($cmd, $timeout); if($content['stdout']) { @@ -166,5 +183,13 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document { public function getErrorMsg() { /* {{{ */ return $this->errormsg; } /* }}} */ + + public function getMimeType() { /* {{{ */ + return $this->mimetype; + } /* }}} */ + + public function getCmd() { /* {{{ */ + return $this->cmd; + } /* }}} */ } ?> diff --git a/SeedDMS_SQLiteFTS/package.xml b/SeedDMS_SQLiteFTS/package.xml index f83232424..ed2256393 100644 --- a/SeedDMS_SQLiteFTS/package.xml +++ b/SeedDMS_SQLiteFTS/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2018-01-30 + 2018-04-11 - 1.0.9 - 1.0.9 + 1.0.10 + 1.0.10 stable @@ -23,7 +23,7 @@ GPL License -execWithTimeout() reads data from stderr and saves it into error msg +IndexedDocument() remembers cmd and mimetype @@ -210,5 +210,21 @@ catch exception in execWithTimeout() allow conversion commands for mimetypes with wildcards + + 2018-01-30 + + + 1.0.9 + 1.0.9 + + + stable + stable + + GPL License + +execWithTimeout() reads data from stderr and saves it into error msg + + diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 0fa50486a..24cfccf3b 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -805,7 +805,7 @@ switch($command) { echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_indexed'), 'data'=>$document->getID())); } else { header('Content-Type: application/json'); - echo json_encode(array('success'=>false, 'message'=>$error, 'data'=>$document->getID())); + echo json_encode(array('success'=>false, 'message'=>$error, 'data'=>$document->getID(), 'mimetype'=>$idoc->getMimeType(), 'cmd'=>$idoc->getCmd())); } } else { header('Content-Type: application/json'); diff --git a/views/bootstrap/class.Indexer.php b/views/bootstrap/class.Indexer.php index 2ef1c4bee..de392db62 100644 --- a/views/bootstrap/class.Indexer.php +++ b/views/bootstrap/class.Indexer.php @@ -81,7 +81,7 @@ function check_queue() { } else { $('#status_'+data.data).html(''); noty({ - text: data.message, + text: '

Docid: ' + data.data + ' (' + data.mimetype + ')

' + '

Cmd: ' + data.cmd + '

' + data.message, type: 'error', dismissQueue: true, layout: 'topRight',