コード例 #1
0
ファイル: Manager.php プロジェクト: raz0rsdge/horde
 /**
  * @param Whups_Query $query The query to delete.
  */
 public function delete(Whups_Query $query)
 {
     if (!$query->id) {
         // Queries that aren't saved yet shouldn't be able to be deleted.
         return;
     }
     try {
         $share = $this->_shareManager->getShareById($query->id);
         $this->_shareManager->removeShare($share);
     } catch (Exception $e) {
         throw new Whups_Exception($e);
     }
     $GLOBALS['whups_driver']->deleteQuery($query->id);
 }
コード例 #2
0
ファイル: Storage.php プロジェクト: raz0rsdge/horde
 /**
  * Removes an Ansel_Gallery.
  *
  * @param Ansel_Gallery $gallery  The gallery to delete
  *
  * @throws Ansel_Exception
  */
 public function removeGallery(Ansel_Gallery $gallery)
 {
     // Get any children and empty them
     $children = $gallery->getChildren(null, null, true);
     foreach ($children as $child) {
         $this->emptyGallery($child);
         $child->setTags(array());
     }
     // Now empty the selected gallery of images
     $this->emptyGallery($gallery);
     // Clear all the tags.
     $gallery->setTags(array());
     // Get the parent, if it exists, before we delete the gallery.
     $parent = $gallery->getParent();
     $id = $gallery->id;
     // Delete the gallery from storage
     try {
         $this->_shares->removeShare($gallery->getShare());
     } catch (Horde_Share_Exception $e) {
         throw new Ansel_Exception($e);
     } catch (Horde_Exception_NotFound $e) {
         throw new Ansel_Exception($e);
     }
     // Expire the cache
     if ($GLOBALS['conf']['ansel_cache']['usecache']) {
         $GLOBALS['injector']->getInstance('Horde_Cache')->expire('Ansel_Gallery' . $id);
     }
     // See if we need to clear the has_subgalleries field
     if ($parent instanceof Ansel_Gallery) {
         if (!$parent->countChildren($GLOBALS['registry']->getAuth(), Horde_Perms::SHOW, false)) {
             $parent->set('has_subgalleries', 0, true);
             if ($GLOBALS['conf']['ansel_cache']['usecache']) {
                 $GLOBALS['injector']->getInstance('Horde_Cache')->expire('Ansel_Gallery' . $parent->id);
             }
         }
     }
 }