mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
call the hook and let it do everything
only if the hook returns null, than proceed with the regular removal
This commit is contained in:
parent
5af3ceef36
commit
d1c11c04aa
|
@ -31,28 +31,32 @@ class SeedDMS_Controller_RemoveDocument extends SeedDMS_Controller_Common {
|
||||||
|
|
||||||
$folder = $document->getFolder();
|
$folder = $document->getFolder();
|
||||||
|
|
||||||
/* Get the notify list before removing the document */
|
/* Get the document id and name before removing the document */
|
||||||
$docname = $document->getName();
|
$docname = $document->getName();
|
||||||
$documentid = $document->getID();
|
$documentid = $document->getID();
|
||||||
|
|
||||||
if(!$this->callHook('preRemoveDocument')) {
|
if(!$this->callHook('preRemoveDocument')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$document->remove()) {
|
$result = $this->callHook('removeDocument', $document);
|
||||||
return false;
|
if($result === null) {
|
||||||
} else {
|
if (!$document->remove()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(!$this->callHook('postRemoveDocument')) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove the document from the fulltext index */
|
||||||
|
if($index && $hits = $index->find('document_id:'.$documentid)) {
|
||||||
|
$hit = $hits[0];
|
||||||
|
$index->delete($hit->id);
|
||||||
|
$index->commit();
|
||||||
|
}
|
||||||
|
|
||||||
if(!$this->callHook('postRemoveDocument')) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the document from the fulltext index */
|
|
||||||
if($index && $hits = $index->find('document_id:'.$documentid)) {
|
|
||||||
$hit = $hits[0];
|
|
||||||
$index->delete($hit->id);
|
|
||||||
$index->commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user