mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
check if file to be indexed exists
This commit is contained in:
parent
8409b7e518
commit
b7deb84279
|
@ -158,29 +158,31 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
|||
}
|
||||
if($version && !$nocontent) {
|
||||
$path = $dms->contentDir . $version->getPath();
|
||||
$content = '';
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($_convcmd[$mimetype])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd[$mimeparts[0].'/*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd['*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
}
|
||||
if($cmd) {
|
||||
$this->cmd = $cmd;
|
||||
try {
|
||||
$content = self::execWithTimeout($cmd, $timeout);
|
||||
if($content['stdout']) {
|
||||
$this->addField(Zend_Search_Lucene_Field::UnStored('content', $content['stdout'], 'utf-8'));
|
||||
if(file_exists($path)) {
|
||||
$content = '';
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($_convcmd[$mimetype])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd[$mimeparts[0].'/*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd['*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
}
|
||||
if($cmd) {
|
||||
$this->cmd = $cmd;
|
||||
try {
|
||||
$content = self::execWithTimeout($cmd, $timeout);
|
||||
if($content['stdout']) {
|
||||
$this->addField(Zend_Search_Lucene_Field::UnStored('content', $content['stdout'], 'utf-8'));
|
||||
}
|
||||
if($content['stderr']) {
|
||||
$this->errormsg = $content['stderr'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
if($content['stderr']) {
|
||||
$this->errormsg = $content['stderr'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,29 +152,31 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
|||
}
|
||||
if($version && !$nocontent) {
|
||||
$path = $dms->contentDir . $version->getPath();
|
||||
$content = '';
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($_convcmd[$mimetype])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd[$mimeparts[0].'/*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd['*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
}
|
||||
if($cmd) {
|
||||
$this->cmd = $cmd;
|
||||
try {
|
||||
$content = self::execWithTimeout($cmd, $timeout);
|
||||
if($content['stdout']) {
|
||||
$this->addField('content', $content['stdout'], 'unstored');
|
||||
if(file_exists($path)) {
|
||||
$content = '';
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($_convcmd[$mimetype])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd[$mimeparts[0].'/*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
} elseif(isset($_convcmd['*'])) {
|
||||
$cmd = sprintf($_convcmd[$mimetype], $path);
|
||||
}
|
||||
if($cmd) {
|
||||
$this->cmd = $cmd;
|
||||
try {
|
||||
$content = self::execWithTimeout($cmd, $timeout);
|
||||
if($content['stdout']) {
|
||||
$this->addField('content', $content['stdout'], 'unstored');
|
||||
}
|
||||
if($content['stderr']) {
|
||||
$this->errormsg = $content['stderr'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
if($content['stderr']) {
|
||||
$this->errormsg = $content['stderr'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user