Commit d97e4e67902b74ab00d7d71e7de88ccdcfd1b30e

Authored by Megan
1 parent ea81ffbd

Fixed errors with incorrect mime type array. Added some extra debug statements.

Committed by: Megan Watson
Reviewed by: Kevin Cyster
plugins/ktstandard/PDFGeneratorAction.php
... ... @@ -200,6 +200,10 @@ class PDFGeneratorAction extends KTDocumentAction {
200 200 $iMimeTypeId = $oDocument->getMimeTypeID();
201 201 $mimetypename = KTMime::getMimeTypeName($iMimeTypeId); // mime type name
202 202  
  203 + // the pdf converter uses the mime type and not the extension.
  204 + return $mimetypename;
  205 +
  206 + /*
203 207 $sTable = KTUtil::getTableName('mimetypes');
204 208 $sQuery = "SELECT filetypes FROM " . $sTable . " WHERE mimetypes = ?";
205 209 $aQuery = array($sQuery, array($mimetypename));
... ... @@ -211,6 +215,7 @@ class PDFGeneratorAction extends KTDocumentAction {
211 215 }
212 216  
213 217 return _kt('Unknown Type');
  218 + */
214 219 }
215 220  
216 221 /**
... ...
plugins/pdfConverter/pdfConverter.php
... ... @@ -31,6 +31,7 @@ require_once(KT_DIR . '/search2/indexing/lib/XmlRpcLucene.inc.php');
31 31 class pdfConverter extends BaseProcessor
32 32 {
33 33 public $order = 2;
  34 + protected $namespace = 'pdf.converter.processor';
34 35  
35 36 public function pdfConverter()
36 37 {
... ... @@ -70,14 +71,41 @@ class pdfConverter extends BaseProcessor
70 71 */
71 72 public function getSupportedMimeTypes()
72 73 {
73   - $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw',
74   - // 'html', 'htm',
75   - 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc',
76   - 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl',
77   - 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg',
78   - 'otg', 'std', 'asc');
79   -
80   - return $aAcceptedMimeTypes;
  74 +// $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw',
  75 +// // 'html', 'htm',
  76 +// 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc',
  77 +// 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl',
  78 +// 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg',
  79 +// 'otg', 'std', 'asc');
  80 +
  81 + // taken from the original list of accepted types in the pdf generator action
  82 + $mime_types = array();
  83 + $mime_types[] = 'text/plain';
  84 + $mime_types[] = 'text/rtf';
  85 + $mime_types[] = 'text/xml';
  86 + $mime_types[] = 'text/csv';
  87 + $mime_types[] = 'chemical/x-pdb';
  88 + $mime_types[] = 'application/msword';
  89 + $mime_types[] = 'application/vnd.ms-powerpoint';
  90 + $mime_types[] = 'application/vnd.ms-excel';
  91 + $mime_types[] = 'application/vnd.sun.xml.writer';
  92 + $mime_types[] = 'application/vnd.sun.xml.writer.template';
  93 + $mime_types[] = 'application/vnd.sun.xml.calc';
  94 + $mime_types[] = 'application/vnd.sun.xml.calc.template';
  95 + $mime_types[] = 'application/vnd.sun.xml.draw';
  96 + $mime_types[] = 'application/vnd.sun.xml.draw.template';
  97 + $mime_types[] = 'application/vnd.sun.xml.impress';
  98 + $mime_types[] = 'application/vnd.sun.xml.impress.template';
  99 + $mime_types[] = 'application/vnd.oasis.opendocument.text';
  100 + $mime_types[] = 'application/vnd.oasis.opendocument.text-template';
  101 + $mime_types[] = 'application/vnd.oasis.opendocument.graphics';
  102 + $mime_types[] = 'application/vnd.oasis.opendocument.graphics-template';
  103 + $mime_types[] = 'application/vnd.oasis.opendocument.presentation';
  104 + $mime_types[] = 'application/vnd.oasis.opendocument.presentation-template';
  105 + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet';
  106 + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet-template';
  107 +
  108 + return $mime_types;
81 109 }
82 110  
83 111 function convertFile($filename)
... ... @@ -97,7 +125,7 @@ class pdfConverter extends BaseProcessor
97 125  
98 126 // Ensure the PDF directory exists
99 127 if(!file_exists($dir)){
100   - mkdir($dir, '0755');
  128 + mkdir($dir, 0755);
101 129 }
102 130  
103 131 $pdfFile = $dir .'/'. $this->document->iId.'.pdf';
... ...
search2/bin/cronDocumentProcessor.php
... ... @@ -42,5 +42,5 @@ require_once(realpath('../../config/dmsDefaults.php'));
42 42  
43 43 KTUtil::call_page('search2/documentProcessor/bin/documentProcessor.php');
44 44  
45   -
  45 +exit(0);
46 46 ?>
47 47 \ No newline at end of file
... ...
search2/documentProcessor/documentProcessor.inc.php
... ... @@ -180,8 +180,11 @@ class DocumentProcessor
180 180 // loop through processors
181 181 if($this->processors !== false){
182 182 foreach($this->processors as $processor){
  183 + $default->log->debug('documentProcessor: running processor: '.$processor->getNamespace());
  184 +
183 185 // Check document mime type against supported types
184 186 if(!$this->isSupportedMimeType($item['mimetypes'], $processor->getSupportedMimeTypes())){
  187 + $default->log->debug('documentProcessor: not a supported mimetype: '.$item['mimetypes']);
185 188 continue;
186 189 }
187 190  
... ... @@ -192,6 +195,9 @@ class DocumentProcessor
192 195 }
193 196 }
194 197  
  198 + // update the indexer statistics
  199 + $this->indexer->updateIndexStats();
  200 +
195 201 $default->log->debug('documentProcessor: stopping');
196 202 }
197 203  
... ... @@ -220,6 +226,7 @@ abstract class BaseProcessor
220 226 {
221 227 public $order;
222 228 protected $document;
  229 + protected $namespace;
223 230  
224 231 public function BaseProcessor()
225 232 {
... ... @@ -227,6 +234,16 @@ abstract class BaseProcessor
227 234 }
228 235  
229 236 /**
  237 + * Returns the namespace of the processor
  238 + *
  239 + * @return string
  240 + */
  241 + public function getNamespace()
  242 + {
  243 + return $this->namespace;
  244 + }
  245 +
  246 + /**
230 247 * Set the document object
231 248 *
232 249 * @param unknown_type $document
... ...