Commit ec95dcf05ca812e290e3c215a4ae2b7415153b08

Authored by Conrad Vermeulen
1 parent fb080912

KTS-3236

"Indexing process should skip temporary files as the indexer process is likely to fail resulting in users being confused."
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8346 c91229c3-7414-0410-bfa2-8a42b809f60b
search2/indexing/indexerCore.inc.php
@@ -1012,6 +1012,20 @@ abstract class Indexer @@ -1012,6 +1012,20 @@ abstract class Indexer
1012 $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Processing docid: %d.\n"),$docId), 'info'); 1012 $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Processing docid: %d.\n"),$docId), 'info');
1013 } 1013 }
1014 1014
  1015 + $document = Document::get($docId);
  1016 + if (PEAR::isError($document))
  1017 + {
  1018 + Indexer::unqueueDocument($docId,sprintf(_kt("indexDocuments: Cannot resolve document id %d: %s."),$docId, $document->getMessage()), 'error');
  1019 + continue;
  1020 + }
  1021 +
  1022 + $filename = $document->getFileName();
  1023 + if (substr($filename,0,1) == '~')
  1024 + {
  1025 + Indexer::unqueueDocument($docId,sprintf(_kt("indexDocuments: Filename for document id %d starts with a tilde (~). This is assumed to be a temporary file. This is ignored."),$docId), 'error');
  1026 + continue;
  1027 + }
  1028 +
1015 $removeFromQueue = true; 1029 $removeFromQueue = true;
1016 if ($indexDocument) 1030 if ($indexDocument)
1017 { 1031 {
@@ -1030,12 +1044,7 @@ abstract class Indexer @@ -1030,12 +1044,7 @@ abstract class Indexer
1030 continue; 1044 continue;
1031 } 1045 }
1032 1046
1033 - $document = Document::get($docId);  
1034 - if (PEAR::isError($document))  
1035 - {  
1036 - Indexer::unqueueDocument($docId,sprintf(_kt("indexDocuments: Cannot resolve document id %d: %s."),$docId, $document->getMessage()), 'error');  
1037 - continue;  
1038 - } 1047 +
1039 1048
1040 $version = $document->getMajorVersionNumber() . '.' . $document->getMinorVersionNumber(); 1049 $version = $document->getMajorVersionNumber() . '.' . $document->getMinorVersionNumber();
1041 $sourceFile = $storageManager->temporaryFile($document); 1050 $sourceFile = $storageManager->temporaryFile($document);