コード例 #1
0
 public function delete()
 {
     $engine = $this->instantiateStorageEngine();
     $ret = parent::delete();
     $engine->deleteFile($this->getStorageHandle());
     return $ret;
 }
コード例 #2
0
 public function delete()
 {
     // We want to delete all the rows which mark this file as the transformation
     // of some other file (since we're getting rid of it). We also delete all
     // the transformations of this file, so that a user who deletes an image
     // doesn't need to separately hunt down and delete a bunch of thumbnails and
     // resizes of it.
     $outbound_xforms = id(new PhabricatorFileQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withTransforms(array(array('originalPHID' => $this->getPHID(), 'transform' => true)))->execute();
     foreach ($outbound_xforms as $outbound_xform) {
         $outbound_xform->delete();
     }
     $inbound_xforms = id(new PhabricatorTransformedFile())->loadAllWhere('transformedPHID = %s', $this->getPHID());
     $this->openTransaction();
     foreach ($inbound_xforms as $inbound_xform) {
         $inbound_xform->delete();
     }
     $ret = parent::delete();
     $this->saveTransaction();
     $this->deleteFileDataIfUnused($this->instantiateStorageEngine(), $this->getStorageEngine(), $this->getStorageHandle());
     return $ret;
 }