do not index document if preIndexDocument returns false

This commit is contained in:
Uwe Steinmann 2019-01-17 18:28:58 +01:00
parent e0bbc4bab5
commit ba49c866cb

View File

@ -806,12 +806,14 @@ switch($command) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
if (method_exists($hookObj, 'preIndexDocument')) {
$hookObj->preIndexDocument(null, $document, $idoc);
if(false !== ($ires = $hookObj->preIndexDocument(null, $document, $idoc))) {
$ires = $index->addDocument($idoc);
}
}
}
}
header('Content-Type: application/json');
if(false === $index->addDocument($idoc)) {
if(false === $ires) {
echo json_encode(array('success'=>false, 'message'=>getMLText('error_document_indexed'), 'data'=>$document->getID()));
} else {
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_indexed'), 'data'=>$document->getID(), 'cmd'=>$idoc->getCmd()));