mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
Merge branch 'seeddms-5.0.x' into seeddms-5.1.x
This commit is contained in:
commit
7e59084b25
|
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
<email>uwe@steinmann.cx</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2016-04-28</date>
|
||||
<time>08:11:19</time>
|
||||
<date>2017-03-01</date>
|
||||
<time>15:55:32</time>
|
||||
<version>
|
||||
<release>1.1.9</release>
|
||||
<api>1.1.7</api>
|
||||
<release>1.1.10</release>
|
||||
<api>1.1.10</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
|
@ -23,8 +23,7 @@
|
|||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
pass variables to stream_select() to fullfill strict standards.
|
||||
make all functions in Indexer.php static
|
||||
catch exception in execWithTimeout()
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
@ -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
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<date>2016-04-28</date>
|
||||
<time>08:11:19</time>
|
||||
<version>
|
||||
<release>1.1.9</release>
|
||||
<api>1.1.7</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
pass variables to stream_select() to fullfill strict standards.
|
||||
make all functions in Indexer.php static
|
||||
</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
<email>uwe@steinmann.cx</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2016-11-15</date>
|
||||
<time>21:00:26</time>
|
||||
<date>2017-03-02</date>
|
||||
<time>07:14:59</time>
|
||||
<version>
|
||||
<release>1.2.1</release>
|
||||
<release>1.2.2</release>
|
||||
<api>1.2.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
|
@ -23,7 +23,8 @@
|
|||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
setConverters() overrides exiting converters
|
||||
commands can be set for mimetypes 'xxxx/*' and '*'
|
||||
pass mimetype as parameter '%m' to converter
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
@ -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
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<date>2016-11-15</date>
|
||||
<time>21:00:26</time>
|
||||
<version>
|
||||
<release>1.2.1</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>
|
||||
setConverters() overrides exiting converters
|
||||
</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
<email>uwe@steinmann.cx</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2016-03-29</date>
|
||||
<time>08:09:48</time>
|
||||
<date>2017-03-01</date>
|
||||
<time>15:53:24</time>
|
||||
<version>
|
||||
<release>1.0.6</release>
|
||||
<api>1.0.1</api>
|
||||
<release>1.0.7</release>
|
||||
<api>1.0.7</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
|
@ -23,7 +23,7 @@
|
|||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
fix calculation of timeout (see bug #269)
|
||||
catch exception in execWithTimeout()
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
@ -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
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<date>2016-03-29</date>
|
||||
<time>08:09:48</time>
|
||||
<version>
|
||||
<release>1.0.6</release>
|
||||
<api>1.0.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
fix calculation of timeout (see bug #269)
|
||||
</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
|
|
|
@ -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"]);
|
||||
}
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue
Block a user