예제 #1
0
파일: Photo.php 프로젝트: robeendey/ce
 protected function _postDelete()
 {
     // This is dangerous, what if something throws an exception in postDelete
     // after the files are deleted?
     try {
         $file = $this->api()->getApi('storage', 'storage')->get($this->file_id, null);
         //$file->remove();
         $file = $this->api()->getApi('storage', 'storage')->get($this->file_id, 'thumb.normal');
         //$file->remove();
         //$file = $this->api()->getApi('storage', 'storage')->get($this->file_id, 'croppable');
         //$file->remove();
         $album = $this->getCollection();
         $nextPhoto = $this->getNextCollectible();
         if ($album instanceof Core_Model_Item_Collection && $nextPhoto instanceof Core_Model_Item_Collectible && (int) $album->photo_id == (int) $this->getIdentity()) {
             $album->photo_id = $nextPhoto->getIdentity();
             $album->save();
         }
     } catch (Exception $e) {
         // @todo should we completely silence the errors?
         //throw $e;
     }
     parent::_postDelete();
 }
예제 #2
0
파일: Photo.php 프로젝트: hoalangoc/ftf
 protected function _postDelete()
 {
     // This is dangerous, what if something throws an exception in
     // postDelete
     // after the files are deleted?
     try {
         $file = Engine_Api::_()->getApi('storage', 'storage')->get($this->file_id, null);
         if ($file) {
             $file->remove();
         }
         $file = Engine_Api::_()->getApi('storage', 'storage')->get($this->file_id, 'thumb.normal');
         if ($file) {
             $file->remove();
         }
         // $file = Engine_Api::_()->getApi('storage',
         // 'storage')->get($this->file_id, 'croppable');
         // $file->remove();
         $album = $this->getCollection();
         $nextPhoto = $this->getNextCollectible();
         if ($album instanceof Core_Model_Item_Collection && $nextPhoto instanceof Core_Model_Item_Collectible && (int) $album->photo_id == (int) $this->getIdentity()) {
             $album->photo_id = $nextPhoto->getIdentity();
             $album->save();
         }
         $photoColorTbl = Engine_Api::_()->getDbTable("photocolors", "advalbum");
         $where = $photoColorTbl->getAdapter()->quoteInto('photo_id = ?', $this->getIdentity());
         $photoColorTbl->delete($where);
     } catch (Exception $e) {
         // @todo should we completely silence the errors?
         // throw $e;
     }
     parent::_postDelete();
 }