Path: blob/master/src/applications/files/storage/PhabricatorFileExternalRequest.php
12242 views
<?php12final class PhabricatorFileExternalRequest extends PhabricatorFileDAO3implements4PhabricatorDestructibleInterface {56protected $uri;7protected $uriIndex;8protected $ttl;9protected $filePHID;10protected $isSuccessful;11protected $responseMessage;1213protected function getConfiguration() {14return array(15self::CONFIG_COLUMN_SCHEMA => array(16'uri' => 'text',17'uriIndex' => 'bytes12',18'ttl' => 'epoch',19'filePHID' => 'phid?',20'isSuccessful' => 'bool',21'responseMessage' => 'text?',22),23self::CONFIG_KEY_SCHEMA => array(24'key_uriindex' => array(25'columns' => array('uriIndex'),26'unique' => true,27),28'key_ttl' => array(29'columns' => array('ttl'),30),31'key_file' => array(32'columns' => array('filePHID'),33),34),35) + parent::getConfiguration();36}3738public function save() {39$hash = PhabricatorHash::digestForIndex($this->getURI());40$this->setURIIndex($hash);41return parent::save();42}4344/* -( PhabricatorDestructibleInterface )----------------------------------- */4546public function destroyObjectPermanently(47PhabricatorDestructionEngine $engine) {4849$file_phid = $this->getFilePHID();50if ($file_phid) {51$file = id(new PhabricatorFileQuery())52->setViewer($engine->getViewer())53->withPHIDs(array($file_phid))54->executeOne();55if ($file) {56$engine->destroyObject($file);57}58}59$this->delete();60}6162}636465