예제 #1
0
 public function deleteEntity($id)
 {
     // need special handling for media entities because we must manage the CDN, too
     $entity = $this->getEntity($id);
     if (!is_null($entity["url"]) || strlen($entity["url"]) > 0) {
         $cdn = new Config::$cdn_classname($this->userid, $this->tenantid);
         try {
             $result = $cdn->removeContent($entity["url"]);
         } catch (Exception $ex) {
             // may want to offer alternate handling in future, but for now if we can't delete from CDN we don't delete
             // from data store
             throw new Exception('Unable to delete media: ' . $ex->getMessage());
         }
     }
     if (!is_null($entity["thumbnailurl"]) || strlen($entity["thumbnailurl"]) > 0) {
         $cdn = new Config::$cdn_classname($this->userid, $this->tenantid);
         try {
             $result = $cdn->removeContent($entity["thumbnailurl"]);
         } catch (Exception $ex) {
             // for now: do nothing. Can assume there may not be a thumbnail for all media
         }
     }
     return parent::deleteEntity($id);
 }