removeAllAttachments() public method

Removes all attachments to $pageId from the VFS backend.
public removeAllAttachments ( integer $pageId )
$pageId integer The Id of the page to remove attachments from.
Esempio n. 1
0
 /**
  * Removes all attachments from a page.
  *
  * @param integer $pageId  A page ID.
  *
  * @throws Wicked_Exception
  */
 public function removeAllAttachments($pageId)
 {
     /* Try to delete from the VFS first. */
     $result = parent::removeAllAttachments($pageId);
     $params = array((int) $pageId);
     try {
         $this->_db->beginDbTransaction();
         /* First try against the current attachments table. */
         $result = $this->_db->delete('DELETE FROM ' . $this->_params['attachmenttable'] . ' WHERE page_id = ?', $params);
         /* Now try against the attachment history table. $params is
          * unchanged. */
         $this->_db->delete('DELETE FROM ' . $this->_params['attachmenthistorytable'] . ' WHERE page_id = ?', $params);
         $this->_db->commitDbTransaction();
     } catch (Horde_Db_Exception $e) {
         $this->_db->rollbackDbTransaction();
         throw new Wicked_Exception($e);
     }
 }