@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
3/**
4 * Callback provider for loading @{class@arcanist:ArcanistBundle} file data
5 * stored in the Files application.
6 */
7final class PhabricatorFileBundleLoader extends Phobject {
8
9 private $viewer;
10
11 public function setViewer(PhabricatorUser $viewer) {
12 $this->viewer = $viewer;
13 return $this;
14 }
15
16 public function loadFileData($phid) {
17 $file = id(new PhabricatorFileQuery())
18 ->setViewer($this->viewer)
19 ->withPHIDs(array($phid))
20 ->executeOne();
21 if (!$file) {
22 return null;
23 }
24 return $file->loadFileData();
25 }
26
27}