/** * テーブルの条件検索による複数レコード削除 * * @param object $criteria {@link XoopsTableObject} 検索条件 * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function deleteAll($criteria = null, $force = false) { $GLOBALS['_xoopsTableCache']->clear($this->tableName); $this->_fullCached = false; return parent::deleteAll($record, $force); }
/** * テーブルの条件検索による複数レコード削除 * * @param object $criteria {@link CriteriaElement} 検索条件 * @param bool $force POSTメソッド以外で強制更新する場合はture * * @return bool 成功の時は TRUE */ function &deleteAll($criteria = null, $force = false) { //条件に合致する記事ID一覧の取得 $posts =& $this->getObjects($criteria); $IDs = array(); foreach ($posts as $post) { $IDs[] = $post->getVar('ID'); } if (!parent::deleteAll($criteria, $id_as_key)) { return false; } if ($IDs) { $IDs = "(" . implode(',', $IDs) . ")"; //記事に対するコメントの削除 $criteria =& new Criteria('comment_post_ID', $IDs, 'IN'); $comment_handler =& new WordPressCommentHandler($this->db, $this->prefix, $this->module); if (!$comment_handler->deleteAll($criteria, $force)) { return false; } //記事に関連するカテゴリー情報の削除 $criteria =& new Criteria('post_id', $IDs, 'IN'); $post2cat_handler =& new WordPressPost2CatHandler($this->db, $this->prefix, $this->module); if (!$post2cat_handler->deleteAll($criteria, $force)) { return false; } //記事に関連するメタ情報の削除 $criteria =& new Criteria('post_id', $IDs, 'IN'); $postmeta_handler =& new WordPressPostMetaHandler($this->db, $this->prefix, $this->module); if (!$postmeta_handler->deleteAll($criteria, $force)) { return false; } } }