diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 34ec91844d..02a011ec72 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -7672,6 +7672,7 @@ phutil_register_library_map(array( 'PhabricatorRepositoryGitLFSRef' => array( 'PhabricatorRepositoryDAO', 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorRepositoryGitLFSRefQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorRepositoryGraphCache' => 'Phobject', diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index fbc8e38193..7068657acc 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -2435,6 +2435,14 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO $engine->destroyObject($atom); } + $lfs_refs = id(new PhabricatorRepositoryGitLFSRefQuery()) + ->setViewer($engine->getViewer()) + ->withRepositoryPHIDs(array($phid)) + ->execute(); + foreach ($lfs_refs as $ref) { + $engine->destroyObject($ref); + } + $this->saveTransaction(); } diff --git a/src/applications/repository/storage/PhabricatorRepositoryGitLFSRef.php b/src/applications/repository/storage/PhabricatorRepositoryGitLFSRef.php index c049b4897a..507af99cb4 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryGitLFSRef.php +++ b/src/applications/repository/storage/PhabricatorRepositoryGitLFSRef.php @@ -2,7 +2,9 @@ final class PhabricatorRepositoryGitLFSRef extends PhabricatorRepositoryDAO - implements PhabricatorPolicyInterface { + implements + PhabricatorPolicyInterface, + PhabricatorDestructibleInterface { protected $repositoryPHID; protected $objectHash; @@ -48,4 +50,23 @@ final class PhabricatorRepositoryGitLFSRef } +/* -( PhabricatorDestructibleInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $file_phid = $this->getFilePHID(); + + $file = id(new PhabricatorFileQuery()) + ->setViewer($engine->getViewer()) + ->withPHIDs(array($file_phid)) + ->executeOne(); + if ($file) { + $engine->destroyObject($file); + } + + $this->delete(); + } + }