- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/filelink.php
- Класс: BitrixDiskFileLink
- Вызов: FileLink::deleteProcess
protected function deleteProcess($deletedBy, $withDeletingSharing = true)
{
$this->errorCollection->clear();
$success = EditSessionTable::deleteByFilter(array(
'OBJECT_ID' => $this->id,
));
if(!$success)
{
return false;
}
DocumentOnlyOfficeModelsDocumentSessionTable::deleteBatch([
'OBJECT_ID' => $this->id,
]);
TrackedObjectTable::deleteBatch([
'OBJECT_ID' => $this->id,
]);
$success = ExternalLinkTable::deleteByFilter(array(
'OBJECT_ID' => $this->id,
));
if($withDeletingSharing)
{
foreach($this->getSharingsAsLink() as $sharing)
{
$sharing->delete($deletedBy, false);
}
//with status unreplied, declined (not approved)
$success = SharingTable::deleteByFilter(array(
'REAL_OBJECT_ID' => $this->id,
));
}
if(!$success)
{
return false;
}
SimpleRightTable::deleteBatch(array('OBJECT_ID' => $this->id));
$success = RightTable::deleteByFilter(array(
'OBJECT_ID' => $this->id,
));
if(!$success)
{
return false;
}
Driver::getInstance()->getDeletedLogManager()->mark($this, $deletedBy);
$resultDelete = FileTable::delete($this->id);
if(!$resultDelete->isSuccess())
{
return false;
}
$event = new Event(Driver::INTERNAL_MODULE_ID, "onAfterDeleteFile", array($this->getId(), $deletedBy, array(
'STORAGE_ID' => $this->getStorageId(),
)));
$event->send();
return true;
}