Remove product literal strings in "pht()", part 5
[phabricator.git] / src / applications / files / storage / PhabricatorFileExternalRequest.php
blob347d78c0dda0a3362ee801befe66ccdec887f369
1 <?php
3 final class PhabricatorFileExternalRequest extends PhabricatorFileDAO
4 implements
5 PhabricatorDestructibleInterface {
7 protected $uri;
8 protected $uriIndex;
9 protected $ttl;
10 protected $filePHID;
11 protected $isSuccessful;
12 protected $responseMessage;
14 protected function getConfiguration() {
15 return array(
16 self::CONFIG_COLUMN_SCHEMA => array(
17 'uri' => 'text',
18 'uriIndex' => 'bytes12',
19 'ttl' => 'epoch',
20 'filePHID' => 'phid?',
21 'isSuccessful' => 'bool',
22 'responseMessage' => 'text?',
24 self::CONFIG_KEY_SCHEMA => array(
25 'key_uriindex' => array(
26 'columns' => array('uriIndex'),
27 'unique' => true,
29 'key_ttl' => array(
30 'columns' => array('ttl'),
32 'key_file' => array(
33 'columns' => array('filePHID'),
36 ) + parent::getConfiguration();
39 public function save() {
40 $hash = PhabricatorHash::digestForIndex($this->getURI());
41 $this->setURIIndex($hash);
42 return parent::save();
45 /* -( PhabricatorDestructibleInterface )----------------------------------- */
47 public function destroyObjectPermanently(
48 PhabricatorDestructionEngine $engine) {
50 $file_phid = $this->getFilePHID();
51 if ($file_phid) {
52 $file = id(new PhabricatorFileQuery())
53 ->setViewer($engine->getViewer())
54 ->withPHIDs(array($file_phid))
55 ->executeOne();
56 if ($file) {
57 $engine->destroyObject($file);
60 $this->delete();