mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 05:01:43 +00:00
add hooks updateDocument::(postUpdateDocument|preUpdateDocument|preIndexDocument)
This commit is contained in:
parent
31074ab8e7
commit
cbd9b8fa83
|
@ -237,12 +237,27 @@ if ($_FILES['userfile']['error'] == 0) {
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) {
|
||||||
|
if (method_exists($hookObj, 'preUpdateDocument')) {
|
||||||
|
$hookObj->preUpdateDocument(array('name'=>&$name, 'comment'=>&$comment));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$filesize = SeedDMS_Core_File::fileSize($userfiletmp);
|
$filesize = SeedDMS_Core_File::fileSize($userfiletmp);
|
||||||
$contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes, $workflow);
|
$contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes, $workflow);
|
||||||
if (is_bool($contentResult) && !$contentResult) {
|
if (is_bool($contentResult) && !$contentResult) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) {
|
||||||
|
if (method_exists($hookObj, 'postUpdateDocument')) {
|
||||||
|
$hookObj->postUpdateDocument($document);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if($settings->_enableFullSearch) {
|
if($settings->_enableFullSearch) {
|
||||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||||
if($index) {
|
if($index) {
|
||||||
|
@ -251,7 +266,15 @@ if ($_FILES['userfile']['error'] == 0) {
|
||||||
$index->delete($hit->id);
|
$index->delete($hit->id);
|
||||||
}
|
}
|
||||||
$indexconf['Indexer']::init($settings->_stopWordsFile);
|
$indexconf['Indexer']::init($settings->_stopWordsFile);
|
||||||
$index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText)));
|
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText));
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) {
|
||||||
|
if (method_exists($hookObj, 'preIndexDocument')) {
|
||||||
|
$hookObj->preIndexDocument($document, $idoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$index->addDocument($idoc);
|
||||||
$index->commit();
|
$index->commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user