1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 18:32:41 +01:00
phorge-phorge/src/applications/files/query/PhabricatorFileBundleLoader.php
epriestley dd206a5b69 Viewerize ArcBundle file loading callbacks
Summary: Ref T603. Clean these up and move them to a single place.

Test Plan:
  - Downloaded a raw diff.
  - Enabled "attach diffs", created a revision, got an email with a diff.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7179
2013-09-30 12:21:33 -07:00

27 lines
551 B
PHP

<?php
/**
* Callback provider for loading @{class@arcanist:ArcanistBundle} file data
* stored in the Files application.
*/
final class PhabricatorFileBundleLoader {
private $viewer;
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
}
public function loadFileData($phid) {
$file = id(new PhabricatorFileQuery())
->setViewer($this->viewer)
->withPHIDs(array($phid))
->executeOne();
if (!$file) {
return null;
}
return $file->loadFileData();
}
}