diff --git a/plugins/ktstandard/PDFGeneratorAction.php b/plugins/ktstandard/PDFGeneratorAction.php index 5868384..b5422f0 100644 --- a/plugins/ktstandard/PDFGeneratorAction.php +++ b/plugins/ktstandard/PDFGeneratorAction.php @@ -200,6 +200,10 @@ class PDFGeneratorAction extends KTDocumentAction { $iMimeTypeId = $oDocument->getMimeTypeID(); $mimetypename = KTMime::getMimeTypeName($iMimeTypeId); // mime type name + // the pdf converter uses the mime type and not the extension. + return $mimetypename; + + /* $sTable = KTUtil::getTableName('mimetypes'); $sQuery = "SELECT filetypes FROM " . $sTable . " WHERE mimetypes = ?"; $aQuery = array($sQuery, array($mimetypename)); @@ -211,6 +215,7 @@ class PDFGeneratorAction extends KTDocumentAction { } return _kt('Unknown Type'); + */ } /** diff --git a/plugins/pdfConverter/pdfConverter.php b/plugins/pdfConverter/pdfConverter.php index 4930c3e..2123499 100644 --- a/plugins/pdfConverter/pdfConverter.php +++ b/plugins/pdfConverter/pdfConverter.php @@ -31,6 +31,7 @@ require_once(KT_DIR . '/search2/indexing/lib/XmlRpcLucene.inc.php'); class pdfConverter extends BaseProcessor { public $order = 2; + protected $namespace = 'pdf.converter.processor'; public function pdfConverter() { @@ -70,14 +71,41 @@ class pdfConverter extends BaseProcessor */ public function getSupportedMimeTypes() { - $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw', - // 'html', 'htm', - 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc', - 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl', - 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg', - 'otg', 'std', 'asc'); - - return $aAcceptedMimeTypes; +// $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw', +// // 'html', 'htm', +// 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc', +// 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl', +// 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg', +// 'otg', 'std', 'asc'); + + // taken from the original list of accepted types in the pdf generator action + $mime_types = array(); + $mime_types[] = 'text/plain'; + $mime_types[] = 'text/rtf'; + $mime_types[] = 'text/xml'; + $mime_types[] = 'text/csv'; + $mime_types[] = 'chemical/x-pdb'; + $mime_types[] = 'application/msword'; + $mime_types[] = 'application/vnd.ms-powerpoint'; + $mime_types[] = 'application/vnd.ms-excel'; + $mime_types[] = 'application/vnd.sun.xml.writer'; + $mime_types[] = 'application/vnd.sun.xml.writer.template'; + $mime_types[] = 'application/vnd.sun.xml.calc'; + $mime_types[] = 'application/vnd.sun.xml.calc.template'; + $mime_types[] = 'application/vnd.sun.xml.draw'; + $mime_types[] = 'application/vnd.sun.xml.draw.template'; + $mime_types[] = 'application/vnd.sun.xml.impress'; + $mime_types[] = 'application/vnd.sun.xml.impress.template'; + $mime_types[] = 'application/vnd.oasis.opendocument.text'; + $mime_types[] = 'application/vnd.oasis.opendocument.text-template'; + $mime_types[] = 'application/vnd.oasis.opendocument.graphics'; + $mime_types[] = 'application/vnd.oasis.opendocument.graphics-template'; + $mime_types[] = 'application/vnd.oasis.opendocument.presentation'; + $mime_types[] = 'application/vnd.oasis.opendocument.presentation-template'; + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet'; + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet-template'; + + return $mime_types; } function convertFile($filename) @@ -97,7 +125,7 @@ class pdfConverter extends BaseProcessor // Ensure the PDF directory exists if(!file_exists($dir)){ - mkdir($dir, '0755'); + mkdir($dir, 0755); } $pdfFile = $dir .'/'. $this->document->iId.'.pdf'; diff --git a/search2/bin/cronDocumentProcessor.php b/search2/bin/cronDocumentProcessor.php index 4c2b57a..3e68a83 100644 --- a/search2/bin/cronDocumentProcessor.php +++ b/search2/bin/cronDocumentProcessor.php @@ -42,5 +42,5 @@ require_once(realpath('../../config/dmsDefaults.php')); KTUtil::call_page('search2/documentProcessor/bin/documentProcessor.php'); - +exit(0); ?> \ No newline at end of file diff --git a/search2/documentProcessor/documentProcessor.inc.php b/search2/documentProcessor/documentProcessor.inc.php index 336a097..65a72f3 100644 --- a/search2/documentProcessor/documentProcessor.inc.php +++ b/search2/documentProcessor/documentProcessor.inc.php @@ -180,8 +180,11 @@ class DocumentProcessor // loop through processors if($this->processors !== false){ foreach($this->processors as $processor){ + $default->log->debug('documentProcessor: running processor: '.$processor->getNamespace()); + // Check document mime type against supported types if(!$this->isSupportedMimeType($item['mimetypes'], $processor->getSupportedMimeTypes())){ + $default->log->debug('documentProcessor: not a supported mimetype: '.$item['mimetypes']); continue; } @@ -192,6 +195,9 @@ class DocumentProcessor } } + // update the indexer statistics + $this->indexer->updateIndexStats(); + $default->log->debug('documentProcessor: stopping'); } @@ -220,6 +226,7 @@ abstract class BaseProcessor { public $order; protected $document; + protected $namespace; public function BaseProcessor() { @@ -227,6 +234,16 @@ abstract class BaseProcessor } /** + * Returns the namespace of the processor + * + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** * Set the document object * * @param unknown_type $document