- update full text index after adding a document

This commit is contained in:
steinm 2012-10-05 19:52:24 +00:00
parent c0b77febf9
commit b8daa34d73

View File

@ -165,6 +165,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
$cats[] = $dms->getDocumentCategory($catid);
}
}
$res = $folder->addDocument($name, $comment, $expires, $user, $keywords,
$cats, $userfiletmp, basename($userfilename),
$fileType, $userfiletype, $sequence,
@ -181,9 +182,39 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
}
}
}
// Send notification to subscribers.
if($settings->_enableFullSearch) {
if(!empty($settings->_luceneClassDir))
require_once($settings->_luceneClassDir.'/Lucene.php');
else
require_once('LetoDMS/Lucene.php');
$index = LetoDMS_Lucene_Indexer::open($settings->_luceneDir);
LetoDMS_Lucene_Indexer::init($settings->_stopWordsFile);
$index->addDocument(new LetoDMS_Lucene_IndexedDocument($dms, $document, $settings->_convcmd ? $settings->_convcmd : null, true));
}
/* Add a default notification for the owner of the document */
if($settings->_enableOwnerNotification) {
$res = $document->addNotify($user->getID(), true);
}
// Send notification to subscribers of folder.
if($notifier) {
$folder->getNotifyList();
$notifyList = $folder->getNotifyList();
if($settings->_enableNotificationAppRev) {
/* Reviewers and approvers will be informed about the new document */
foreach($reviewers['i'] as $reviewerid) {
$notifyList['users'][] = $dms->getUser($reviewerid);
}
foreach($approvers['i'] as $approverid) {
$notifyList['users'][] = $dms->getUser($approverid);
}
foreach($reviewers['g'] as $reviewergrpid) {
$notifyList['groups'][] = $dms->getGroup($reviewergrpid);
}
foreach($approvers['g'] as $approvergrpid) {
$notifyList['groups'][] = $dms->getGroup($approvergrpid);
}
}
$subject = "###SITENAME###: ".$folder->_name." - ".getMLText("new_document_email");
$message = getMLText("new_document_email")."\r\n";
$message .=
@ -193,11 +224,9 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
getMLText("comment_for_current_version").": ".$version_comment."\r\n".
"URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$document->getID()."\r\n";
$subject=$subject;
$message=$message;
$notifier->toList($user, $folder->_notifyList["users"], $subject, $message);
foreach ($folder->_notifyList["groups"] as $grp) {
$notifier->toList($user, $notifyList["users"], $subject, $message);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message);
}
}