/** * トピック削除 */ function kanshi_db_commu_delete_c_commu_topic($c_commu_topic_id) { if (db_commu_c_commu_topic4c_commu_topic_id($c_commu_topic_id)) { //function cacheの削除 cache_drop_c_commu_topic($c_commu_topic_id); // c_commu_topic_comment(画像) $sql = 'SELECT image_filename1, image_filename2, image_filename3, filename' . ' FROM c_commu_topic_comment WHERE c_commu_topic_id = ?'; $params = array(intval($c_commu_topic_id)); $topic_comment_list = db_get_all($sql, $params); foreach ($topic_comment_list as $topic_comment) { image_data_delete($topic_comment['image_filename1']); image_data_delete($topic_comment['image_filename2']); image_data_delete($topic_comment['image_filename3']); db_file_delete_c_file($topic_comment['filename']); } $sql = 'DELETE FROM c_commu_topic_comment WHERE c_commu_topic_id = ?'; db_query($sql, $params); $sql = 'DELETE FROM c_event_member WHERE c_commu_topic_id = ?'; db_query($sql, $params); $sql = 'DELETE FROM c_commu_topic WHERE c_commu_topic_id = ?'; if (db_query($sql, $params)) { return array(1, 0, ''); } else { return array(0, 2, 'DB更新エラー'); } } else { // return array(0, 99, '既に削除されているか存在しません'); // 監視ツールがリトライを行ってしまう為、成功フラグを返してしまう return array(1, 0, ''); } }
/** * コミュニティ情報取得関連のfunction cacheを削除する */ function cache_drop_c_commu($c_commu_id) { $c_commu_id = (int) $c_commu_id; pne_cache_drop('db_commu_c_commu4c_commu_id_k', $c_commu_id); pne_cache_drop('db_commu_c_commu_member_list_random4c_commu_id', $c_commu_id, 5); pne_cache_drop('db_commu_c_commu_member_list4c_commu_id', $c_commu_id, 9); pne_cache_drop('db_commu_c_commu4c_commu_id2', $c_commu_id); $c_commu_id = (string) $c_commu_id; pne_cache_drop('db_commu_c_commu4c_commu_id_k', $c_commu_id); pne_cache_drop('db_commu_c_commu_member_list_random4c_commu_id', $c_commu_id, 5); pne_cache_drop('db_commu_c_commu_member_list4c_commu_id', $c_commu_id, 9); pne_cache_drop('db_commu_c_commu4c_commu_id2', $c_commu_id); $c_commu_topic_list = db_commu_new_topic_comment4c_commu_id($c_commu_id, 7); $c_commu_event_list = db_commu_new_topic_comment4c_commu_id($c_commu_id, 7, 1); $c_commu_bbs_list = array_merge($c_commu_topic_list, $c_commu_event_list); foreach ($c_commu_bbs_list as $c_commu_topic_id) { $c_commu_topic_id = (int) $c_commu_topic_id; cache_drop_c_commu_topic($c_commu_topic_id); $c_commu_topic_id = (string) $c_commu_topic_id; cache_drop_c_commu_topic($c_commu_topic_id); } $c_commu_member_total_num = db_commu_count_c_commu_member_list4c_commu_id($c_commu_id); $c_commu_member_list = db_commu_c_member_list4c_commu_id($c_commu_id, 1, $c_commu_member_total_num); foreach ($c_commu_member_list[0] as $c_member) { cache_drop_c_commu_list4c_member_id($c_member['c_member_id']); } }
function db_commu_insert_c_commu_topic($topic) { //function cacheの削除 cache_drop_c_commu_topic($topic['c_commu_id']); cache_drop_c_commu_list4c_member_id($topic['c_member_id']); // タイトルと本文中に書いてあるURLがSNS内でありセッションパラメータを含んでいた場合は削除 $topic['name'] = db_ktai_delete_url_session_parameter($topic['name']); $data = array('c_commu_id' => intval($topic['c_commu_id']), 'c_member_id' => intval($topic['c_member_id']), 'name' => $topic['name'], 'event_flag' => (bool) $topic['event_flag'], 'capacity' => intval($topic['capacity']), 'r_datetime' => db_now(), 'r_date' => db_now(), 'u_datetime' => db_now()); if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') { $open_date = '0000-01-01'; $invite_period = '0000-01-01'; } else { $open_date = '0000-00-00'; $invite_period = '0000-00-00'; } if (isset($topic['open_date']) && $topic['open_date']) { $open_date = $topic['open_date']; } if (isset($topic['invite_period']) && $topic['invite_period']) { $invite_period = $topic['invite_period']; } if ($data['event_flag']) { $data += array('open_date' => $open_date, 'open_date_comment' => db_ktai_delete_url_session_parameter($topic['open_date_comment']), 'open_pref_id' => intval($topic['open_pref_id']), 'open_pref_comment' => db_ktai_delete_url_session_parameter($topic['open_pref_comment']), 'invite_period' => $invite_period); } return db_insert('c_commu_topic', $data); }