From 43c15ff39953764959595eec47c0ea697186a8b5 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 17 Apr 2019 08:28:46 +0200 Subject: [PATCH] index document even if hook preIndexDocument is not set --- op/op.Ajax.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 3e987b459..44778b452 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -803,15 +803,16 @@ switch($command) { $idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout); $error = $idoc->getErrorMsg(); if(!$error) { + $ires = null; if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) { foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) { if (method_exists($hookObj, 'preIndexDocument')) { - if(false !== ($ires = $hookObj->preIndexDocument(null, $document, $idoc))) { - $ires = $index->addDocument($idoc); - } + $ires = $hookObj->preIndexDocument(null, $document, $idoc); } } } + if(false !== $ires) + $ires = $index->addDocument($idoc); header('Content-Type: application/json'); if(false === $ires) { echo json_encode(array('success'=>false, 'message'=>getMLText('error_document_indexed'), 'data'=>$document->getID()));