/** * レコードの削除 * * @param object &$record {@link WordPressUser} object * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function delete(&$record, $force = false) { //ユーザーの削除 if (!parent::delete($record, $force)) { return false; } //ユーザが投稿した記事及び関連情報の削除 $criteria =& new Criteria('post_author', $record->getVar('ID')); $post_handler =& new WordPressPostHandler($this->db, $this->prefix); if (!$post_handler->deleteAll($criteria)) { return false; } //ユーザが作成したリンク情報の削除 $criteria =& new Criteria('link_owner', $record->getVar('ID')); $link_handler =& new WordPressLinkHandler($this->db, $this->prefix); if (!$link_handler->deleteAll($criteria)) { return false; } return true; }
/** * レコードの削除 * * @param object &$record {@link WordPressLinkCategory} object * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function delete(&$record, $force = false) { //cat_IDが1のカテゴリは、削除できない if ($record->getVar('cat_id') == 1) { $this->setError(sprintf(_LANG_WLC_DONOT_DELETE, $record->getVar('cat_name'))); return false; } //カテゴリの削除 if (!parent::delete($record, $force)) { return false; } //削除カテゴリに属するリンクは、Defaultカテゴリに一括変更 $criteria =& new Criteria('link_category', $record->getVar('cat_id')); $link_handler =& new WordPressLinkHandler($this->db, $this->prefix); if (!$link_handler->updateAll('link_category', 1, $criteria, $force)) { return false; } return true; }
/** * レコードの削除 * * @param object &$record {@link WordPressPost} object * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function delete(&$record, $force = false) { //記事の削除 if (!parent::delete($record, $force)) { return false; } //記事に対するコメントの削除 $criteria =& new Criteria('comment_post_ID', $record->getVar('ID')); $comment_handler =& new WordPressCommentHandler($this->db, $this->prefix, $this->module); if (!$comment_handler->deleteAll($criteria, $force)) { return false; } //記事に対するコメントの削除(XOOPSコメント) if ($xoopsOption['wp_use_xoops_comments']) { $criteria =& new CriteriaCompo(new Criteria('com_modid', $xoopsModule->getVar('mid'))); $criteria->add(new Criteria('com_itemid', $record->getVar('ID'))); $xcommentHandler = xoops_gethandler('comment'); if (!$xcommentHandler->deleteAll($criteria)) { return false; } } //記事に関連するカテゴリー情報の削除 $criteria =& new Criteria('post_id', $record->getVar('ID')); $post2cat_handler =& new WordPressPost2CatHandler($this->db, $this->prefix, $this->module); if (!$post2cat_handler->deleteAll($criteria, $force)) { return false; } //記事に関連するメタ情報の削除 $criteria =& new Criteria('post_id', $record->getVar('ID')); $postmeta_handler =& new WordPressPostMetaHandler($this->db, $this->prefix, $this->module); if (!$postmeta_handler->deleteAll($criteria, $force)) { return false; } return true; }
/** * レコードの削除 * * @param object &$record {@link XoopsTableObject} object * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function delete(&$record, $force = false) { $GLOBALS['_xoopsTableCache']->reset($this->tableName, $record->cacheKey()); return parent::delete($record, $force); }
/** * レコードの削除 * * @param object &$record {@link WordPressCategory} object * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function delete(&$record, $force = false) { //cat_IDが1のカテゴリは、削除できない if ($record->getVar('cat_ID') == 1) { $this->setError(sprintf(_LANG_C_DEFAULT_CAT, $record->getVar('cat_name'))); return false; } //カテゴリの削除 if (!parent::delete($record, $force)) { return false; } //削除カテゴリの子カテゴリは、削除カテゴリの親カテゴリの子カテゴリに変更 $criteria =& new Criteria('category_parent', $record->getVar('cat_ID')); if (!$this->updateAll('category_parent', $record->getVar('category_parent'), $criteria, $force)) { return false; } //削除カテゴリに属する記事は、Defaultカテゴリに一括変更 $criteria =& new Criteria('category_id', $record->getVar('cat_ID')); $post2cat_handler =& new WordPressPost2CatHandler($this->db, $this->prefix); if (!$post2cat_handler->updateAll('category_id', 1, $criteria, $force)) { return false; } $this->_cache_by_nicename = array(); return true; }