@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<?php
2
3final class PhabricatorRepositoryGitLFSRef
4 extends PhabricatorRepositoryDAO
5 implements
6 PhabricatorPolicyInterface,
7 PhabricatorDestructibleInterface {
8
9 protected $repositoryPHID;
10 protected $objectHash;
11 protected $byteSize;
12 protected $authorPHID;
13 protected $filePHID;
14
15 protected function getConfiguration() {
16 return array(
17 self::CONFIG_COLUMN_SCHEMA => array(
18 'objectHash' => 'bytes64',
19 'byteSize' => 'uint64',
20 ),
21 self::CONFIG_KEY_SCHEMA => array(
22 'key_hash' => array(
23 'columns' => array('repositoryPHID', 'objectHash'),
24 'unique' => true,
25 ),
26 ),
27 ) + parent::getConfiguration();
28 }
29
30
31/* -( PhabricatorPolicyInterface )----------------------------------------- */
32
33
34 public function getCapabilities() {
35 return array(
36 PhabricatorPolicyCapability::CAN_VIEW,
37 );
38 }
39
40 public function getPolicy($capability) {
41 return PhabricatorPolicies::getMostOpenPolicy();
42 }
43
44 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
45 return false;
46 }
47
48
49/* -( PhabricatorDestructibleInterface )----------------------------------- */
50
51
52 public function destroyObjectPermanently(
53 PhabricatorDestructionEngine $engine) {
54
55 $file_phid = $this->getFilePHID();
56
57 $file = id(new PhabricatorFileQuery())
58 ->setViewer($engine->getViewer())
59 ->withPHIDs(array($file_phid))
60 ->executeOne();
61 if ($file) {
62 $engine->destroyObject($file);
63 }
64
65 $this->delete();
66 }
67
68}