/** * Delete content object and all related records * * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ function expunge() { global $gBitSystem, $gLibertySystem; $ret = FALSE; if ($this->isValid()) { $this->StartTrans(); $this->expungeComments(); // services, filters and cache $this->invokeServices('content_expunge_function', $this); if ($this->getField('format_guid') && ($func = $gLibertySystem->getPluginFunction($this->getField('format_guid'), 'expunge_function'))) { $func($this->mContentId); } $this->filterData($this->mInfo['data'], $this->mInfo, 'expunge'); LibertyContent::expungeCacheFile($this->mContentId); // remove favorites - this probably should be a content_expunge_function in users $this->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "users_favorites_map` WHERE `favorite_content_id`=?", array($this->mContentId)); // remove entries in the history $this->expungeVersion(); // Remove individual permissions for this object if they exist $query = "delete from `" . BIT_DB_PREFIX . "liberty_content_permissions` where `content_id`=?"; $result = $this->mDb->query($query, array($this->mContentId)); // Remove aliases $this->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "liberty_aliases` WHERE `content_id`=?", array($this->mContentId)); // Remove structures // it's not this simple. what about orphans? needs real work. :( xoxo - spider // $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_structures` WHERE `content_id` = ?"; // $result = $this->mDb->query( $query, array( $this->mContentId ) ); // Remove any queued data processing (images, movies, etc.) $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_process_queue` WHERE `content_id` = ?"; $result = $this->mDb->query($query, array($this->mContentId)); // Remove data $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_data` WHERE `content_id` = ?"; $result = $this->mDb->query($query, array($this->mContentId)); // Remove hits $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_hits` WHERE `content_id` = ?"; $result = $this->mDb->query($query, array($this->mContentId)); // Remove content preferences $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_prefs` WHERE `content_id` = ?"; $result = $this->mDb->query($query, array($this->mContentId)); // Remove content links $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_links` WHERE `to_content_id` = ? or `from_content_id` = ?"; $result = $this->mDb->query($query, array($this->mContentId, $this->mContentId)); // Remove content $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content` WHERE `content_id` = ?"; $result = $this->mDb->query($query, array($this->mContentId)); $this->mLogs['content_expunge'] = "Deleted"; $this->storeActionLog(); $this->CompleteTrans(); $ret = TRUE; parent::expunge(); } return $ret; }