@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implement DestructibleInterface on GitLFS refs

Summary: Ref T7789. Make sure these get cleaned up when a repository is destroyed.

Test Plan:
- Created a new repository.
- Pushed some LFS data to it.
- Used `bin/remove destroy` to nuke it.
- Verified the LFS stuff was cleaned up and the underlying files were destroyed (`SELECT * FROM repository_gitlfsref`, etc).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7789

Differential Revision: https://secure.phabricator.com/D15493

+31 -1
+1
src/__phutil_library_map__.php
··· 7672 7672 'PhabricatorRepositoryGitLFSRef' => array( 7673 7673 'PhabricatorRepositoryDAO', 7674 7674 'PhabricatorPolicyInterface', 7675 + 'PhabricatorDestructibleInterface', 7675 7676 ), 7676 7677 'PhabricatorRepositoryGitLFSRefQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 7677 7678 'PhabricatorRepositoryGraphCache' => 'Phobject',
+8
src/applications/repository/storage/PhabricatorRepository.php
··· 2435 2435 $engine->destroyObject($atom); 2436 2436 } 2437 2437 2438 + $lfs_refs = id(new PhabricatorRepositoryGitLFSRefQuery()) 2439 + ->setViewer($engine->getViewer()) 2440 + ->withRepositoryPHIDs(array($phid)) 2441 + ->execute(); 2442 + foreach ($lfs_refs as $ref) { 2443 + $engine->destroyObject($ref); 2444 + } 2445 + 2438 2446 $this->saveTransaction(); 2439 2447 } 2440 2448
+22 -1
src/applications/repository/storage/PhabricatorRepositoryGitLFSRef.php
··· 2 2 3 3 final class PhabricatorRepositoryGitLFSRef 4 4 extends PhabricatorRepositoryDAO 5 - implements PhabricatorPolicyInterface { 5 + implements 6 + PhabricatorPolicyInterface, 7 + PhabricatorDestructibleInterface { 6 8 7 9 protected $repositoryPHID; 8 10 protected $objectHash; ··· 47 49 return null; 48 50 } 49 51 52 + 53 + /* -( PhabricatorDestructibleInterface )----------------------------------- */ 54 + 55 + 56 + public function destroyObjectPermanently( 57 + PhabricatorDestructionEngine $engine) { 58 + 59 + $file_phid = $this->getFilePHID(); 60 + 61 + $file = id(new PhabricatorFileQuery()) 62 + ->setViewer($engine->getViewer()) 63 + ->withPHIDs(array($file_phid)) 64 + ->executeOne(); 65 + if ($file) { 66 + $engine->destroyObject($file); 67 + } 68 + 69 + $this->delete(); 70 + } 50 71 51 72 }