Differential D25051 Diff 267 src/applications/files/engineextension/PhabricatorFileAttachmentDestructionEngineExtension.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/engineextension/PhabricatorFileAttachmentDestructionEngineExtension.php
- This file was added.
<?php | |||||
final class PhabricatorFileAttachmentDestructionEngineExtension | |||||
extends PhabricatorDestructionEngineExtension { | |||||
avivey: I might not have enough coffee yet, but what and when is triggering this extension? | |||||
Done Inline ActionsDylsss: https://we.phorge.it/source/phorge/browse/master/src/applications/system/engine/PhabricatorDest… | |||||
const EXTENSIONKEY = 'attachments'; | |||||
public function getExtensionName() { | |||||
return pht('File Attachments'); | |||||
} | |||||
public function canDestroyObject( | |||||
PhabricatorDestructionEngine $engine, | |||||
$object) { | |||||
return ($object instanceof PhabricatorFile); | |||||
} | |||||
public function destroyObject( | |||||
PhabricatorDestructionEngine $engine, | |||||
$object) { | |||||
$file_phid = $object->getPHID(); | |||||
$attachments = id(new PhabricatorFileAttachmentQuery()) | |||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | |||||
->withFilePHIDs(array($file_phid)) | |||||
->execute(); | |||||
mpull($attachments, 'delete'); | |||||
} | |||||
} |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
I might not have enough coffee yet, but what and when is triggering this extension?