/** * Trigger event AfterItemDelete after calling parent method. * * @todo fp> delete related stuff: comments, cats, file links... * * @return boolean true on success */ function dbdelete() { global $DB, $Plugins; // remember ID, because parent method resets it to 0 $old_ID = $this->ID; $DB->begin(); if ($r = parent::dbdelete()) { // Empty pre-rendered content cache: $DB->query('DELETE FROM T_items__prerendering WHERE itpr_itm_ID = ' . $this->ID); $this->content_prerendered = NULL; $DB->commit(); // re-set the ID for the Plugin event $this->ID = $old_ID; $Plugins->trigger_event('AfterItemDelete', $params = array('Item' => &$this)); $this->ID = 0; } else { $DB->rollback(); } return $r; }
/** * Trigger event AfterItemDelete after calling parent method. * * @todo fp> delete related stuff: comments, cats, file links... * * @return boolean true on success */ function dbdelete() { global $DB, $Plugins; // remember ID, because parent method resets it to 0 $old_ID = $this->ID; // Load the blog $Blog =& $this->get_Blog(); $DB->begin(); if ($r = parent::dbdelete()) { // re-set the ID for the Plugin event & for a deleting of the prerendered content $this->ID = $old_ID; $DB->commit(); $Plugins->trigger_event('AfterItemDelete', $params = array('Item' => &$this)); $this->ID = 0; // BLOCK CACHE INVALIDATION: BlockCache::invalidate_key('cont_coll_ID', $Blog->ID); // Content has changed if ($this->is_intro() || $this->is_featured()) { // Content of intro or featured post has changed BlockCache::invalidate_key('intro_feat_coll_ID', $Blog->ID); } // set_coll_ID // Settings have not changed } else { $DB->rollback(); } return $r; }
/** * Trigger event AfterItemDelete after calling parent method. * * @todo fp> delete related stuff: comments, cats, file links... * * @return boolean true on success */ function dbdelete() { global $DB, $Plugins; // Get list of comments that are going to be deleted $comments_list = implode(',', $DB->get_col(' SELECT comment_ID FROM T_comments WHERE comment_post_ID = ' . $DB->quote($this->ID))); // remember ID, because parent method resets it to 0 $old_ID = $this->ID; $DB->begin(); if ($r = parent::dbdelete()) { // re-set the ID for the Plugin event & for a deleting of the prerendered content $this->ID = $old_ID; $this->delete_prerendered_content(); if (!empty($comments_list)) { // Delete dependencies of the comments $DB->query("DELETE FROM T_comments__votes\n\t\t\t\t WHERE cmvt_cmt_ID IN ({$comments_list})"); } $DB->commit(); $Plugins->trigger_event('AfterItemDelete', $params = array('Item' => &$this)); $this->ID = 0; } else { $DB->rollback(); } return $r; }