mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
callable can be passed for retrieving text content
This commit is contained in:
parent
eefb0f5ad3
commit
05d7c709ab
|
@ -182,7 +182,15 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
|||
if(file_exists($path)) {
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
if(is_object($convcmd) && (get_class($convcmd) == 'SeedDMS_ConversionMgr')) {
|
||||
if(is_callable($convcmd)) {
|
||||
$result = $convcmd($document);
|
||||
if($result['content']) {
|
||||
self::setContent($result['content']);
|
||||
} elseif($result['content'] === false) {
|
||||
$this->errormsg = $result['errormsg'];
|
||||
}
|
||||
$this->cmd = $result['cmd'];
|
||||
} elseif(is_object($convcmd) && (get_class($convcmd) == 'SeedDMS_ConversionMgr')) {
|
||||
if($service = $convcmd->getService($mimetype, 'text/plain')) {
|
||||
$content = $convcmd->convert($path, $mimetype, 'text/plain');
|
||||
if($content) {
|
||||
|
|
|
@ -183,7 +183,15 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
|||
if(file_exists($path)) {
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
if(is_object($convcmd) && (get_class($convcmd) == 'SeedDMS_ConversionMgr')) {
|
||||
if(is_callable($convcmd)) {
|
||||
$result = $convcmd($document);
|
||||
if($result['content']) {
|
||||
self::setContent($result['content']);
|
||||
} elseif($result['content'] === false) {
|
||||
$this->errormsg = $result['errormsg'];
|
||||
}
|
||||
$this->cmd = $result['cmd'];
|
||||
} elseif(is_object($convcmd) && (get_class($convcmd) == 'SeedDMS_ConversionMgr')) {
|
||||
if($service = $convcmd->getService($mimetype, 'text/plain')) {
|
||||
$content = $convcmd->convert($path, $mimetype, 'text/plain');
|
||||
if($content) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user