mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
call hooks like in AddDocument
This commit is contained in:
parent
d9a8f35a6a
commit
35fa67ae93
|
@ -56,8 +56,8 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
|
|||
$workflow = $this->getParam('workflow');
|
||||
$maxsizeforfulltext = $this->getParam('maxsizeforfulltext');
|
||||
|
||||
$result = $this->callHook('updateDocument');
|
||||
if($result === null) {
|
||||
$content = $this->callHook('updateDocument');
|
||||
if($content === null) {
|
||||
$filesize = SeedDMS_Core_File::fileSize($userfiletmp);
|
||||
if($contentResult=$document->addContent($comment, $user, $userfiletmp, utf8_basename($userfilename), $filetype, $userfiletype, $reviewers, $approvers, $version=0, $attributes, $workflow)) {
|
||||
|
||||
|
@ -67,28 +67,33 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
|
|||
}
|
||||
}
|
||||
|
||||
if($index) {
|
||||
$lucenesearch = new $indexconf['Search']($index);
|
||||
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
|
||||
$index->delete($hit->id);
|
||||
}
|
||||
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText));
|
||||
if(!$this->callHook('preIndexDocument', $document, $idoc)) {
|
||||
}
|
||||
$index->addDocument($idoc);
|
||||
$index->commit();
|
||||
}
|
||||
|
||||
if(!$this->callHook('postUpdateDocument', $document, $contentResult->getContent())) {
|
||||
}
|
||||
$result = $contentResult->getContent();
|
||||
$content = $contentResult->getContent();
|
||||
} else {
|
||||
$this->errormsg = 'error_update_document';
|
||||
$result = false;
|
||||
}
|
||||
} elseif($result === false) {
|
||||
if(empty($this->errormsg))
|
||||
$this->errormsg = 'hook_updateDocument_failed';
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
if($index && $content) {
|
||||
$lucenesearch = new $indexconf['Search']($index);
|
||||
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
|
||||
$index->delete($hit->id);
|
||||
}
|
||||
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText));
|
||||
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
|
||||
$index->addDocument($idoc);
|
||||
$index->commit();
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->callHook('postUpdateDocument', $document, $content)) {
|
||||
}
|
||||
|
||||
return $content;
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user