ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 6631


Ignore:
Timestamp:
Apr 18, 2008, 7:35:34 PM (14 years ago)
Author:
ebihara
Message:

#2090:merged work/toraneko/prj_dbtuning/ (thanks to toraneko)

Location:
OpenPNE/trunk
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE/trunk/webapp/lib/db/commu.php

    r6630 r6631  
    525525                " order by r_datetime desc ";
    526526    } else {
    527         $sql = "SELECT cct.c_commu_topic_id , cct.name, MAX(cctc.r_datetime) as r_datetime , cct.c_commu_id " .
    528                 " , cctc.image_filename1, cctc.image_filename2, cctc.image_filename3 " .
    529                 " FROM c_commu_topic_comment as cctc , c_commu_topic as cct" .
    530                 " WHERE cctc.c_commu_topic_id = cct.c_commu_topic_id " .
    531                 " AND cct.event_flag = ?".
    532                 " AND cct.c_commu_id = ?".
    533                 " group by cct.c_commu_topic_id " .
     527        $sql = "SELECT c_commu_topic_id , name, r_datetime_comment as r_datetime , c_commu_id " .
     528                " FROM c_commu_topic" .
     529                " WHERE event_flag = ? AND c_commu_id = ?".
    534530                " order by r_datetime desc ";
    535531    }
     
    539535    foreach ($list as $key => $value) {
    540536        $list[$key]['count_comments'] = db_commu_get_max_number4topic($value['c_commu_topic_id']);
     537        $last_comment = db_commu_get_last_c_topic_comment($value['c_commu_topic_id']);
     538        $list[$key]['image_filename1'] = $last_comment['image_filename1'];
     539        $list[$key]['image_filename2'] = $last_comment['image_filename2'];
     540        $list[$key]['image_filename3'] = $last_comment['image_filename3'];
    541541    }
    542542    return $list;
     
    841841                ' AND cctc.r_datetime=sub_cct_tbl.r_datetime' .
    842842            ' ORDER BY r_datetime DESC';
     843        $params = array();
    843844    } else {
    844         $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
    845             ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
    846             ' GROUP BY cctc.c_commu_topic_id'.
     845        $sql = 'SELECT a.c_commu_topic_id, a.c_commu_id, a.r_datetime_comment as r_datetime, a.c_member_id,'.
     846            ' a.name as c_commu_topic_name'.
     847            ' FROM c_commu_topic as a INNER JOIN c_commu_member as b USING(c_commu_id)'.
     848            ' WHERE b.c_member_id = ?'.
    847849            ' ORDER BY r_datetime DESC';
    848     }
    849     $c_commu_topic_list = db_get_all_limit($sql, 0, $limit);
     850        $params = array(intval($c_member_id));
     851    }
     852    $c_commu_topic_list = db_get_all_limit($sql, 0, $limit, $params);
    850853
    851854    foreach ($c_commu_topic_list as $key => $value) {
     
    853856        $c_commu_topic_list[$key]['nickname'] = $c_member['nickname'];
    854857
    855         $sql = 'SELECT number, image_filename1, image_filename2, image_filename3' .
    856                ' FROM c_commu_topic_comment' .
    857                ' WHERE c_commu_topic_id = ? AND r_datetime = ?';
    858         $params = array(intval($value['c_commu_topic_id']), $value['r_datetime']);
    859         $temp = db_get_row($sql, $params);
     858        $temp = db_commu_get_last_c_topic_comment($value['c_commu_topic_id']);
    860859
    861860        $sql = 'SELECT name AS c_commu_name FROM c_commu WHERE c_commu_id = ?';
    862861        $c_commu_name = db_get_one($sql, $value['c_commu_id']);
    863 
    864         $sql = 'SELECT name FROM c_commu_topic WHERE c_commu_topic_id = ?';
    865         $c_commu_topic_name = db_get_one($sql, $value['c_commu_topic_id']);
    866862
    867863        //最新の書き込み番号
     
    873869        $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3'];
    874870        $c_commu_topic_list[$key]['c_commu_name'] = $c_commu_name;
    875         $c_commu_topic_list[$key]['c_commu_topic_name'] = $c_commu_topic_name;
    876871    }
    877872
     
    904899                ' AND cctc.r_datetime=sub_cct_tbl.r_datetime' .
    905900            ' ORDER BY r_datetime DESC';
     901        $params = array();
    906902    } else {
    907         $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
    908             ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
    909             ' GROUP BY cctc.c_commu_topic_id'.
     903        $sql = 'SELECT a.c_commu_topic_id, a.c_commu_id, a.r_datetime_comment as r_datetime, a.c_member_id,'.
     904            ' a.name as c_commu_topic_name'.
     905            ' FROM c_commu_topic as a INNER JOIN c_commu_member as b USING(c_commu_id)'.
     906            ' WHERE b.c_member_id = ?'.
    910907            ' ORDER BY r_datetime DESC';
    911     }
    912     $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit);
     908        $params = array(intval($c_member_id));
     909    }
     910    $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit, $params);
    913911
    914912    foreach ($c_commu_topic_list as $key => $value) {
     
    916914        $c_commu_topic_list[$key]['nickname'] = $c_member['nickname'];
    917915
    918         $sql = 'SELECT number, image_filename1, image_filename2, image_filename3' .
    919                ' FROM c_commu_topic_comment ' .
    920                ' WHERE c_commu_topic_id = ? AND r_datetime = ?';
    921         $params = array(intval($value['c_commu_topic_id']), $value['r_datetime']);
    922         $temp = db_get_row($sql, $params);
     916        $temp = db_commu_get_last_c_topic_comment($value['c_commu_topic_id']);
    923917
    924918        $sql = 'SELECT name AS c_commu_name FROM c_commu WHERE c_commu_id = ?';
    925919        $c_commu_name = db_get_one($sql, $value['c_commu_id']);
    926 
    927         $sql = 'SELECT name FROM c_commu_topic WHERE c_commu_topic_id = ?';
    928         $c_commu_topic_name = db_get_one($sql, $value['c_commu_topic_id']);
    929920
    930921        //最新の書き込み番号
     
    936927        $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3'];
    937928        $c_commu_topic_list[$key]['c_commu_name'] = $c_commu_name;
    938         $c_commu_topic_list[$key]['c_commu_topic_name'] = $c_commu_topic_name;
    939929    }
    940930
     
    25142504        'r_datetime' => db_now(),
    25152505        'r_date' => db_now(),
     2506        'r_datetime_comment' => db_now(),
    25162507    );
    25172508
     
    26052596        'r_datetime'  => db_now(),
    26062597        'r_date'      => db_now(),
     2598        'r_datetime_comment'  => db_now(),
    26072599    );
    26082600
     
    26382630{
    26392631    cache_drop_c_commu_list4c_member_id($comment['c_member_id']);
     2632
     2633    db_commu_update_c_commu_topic_r_datetime_comment(intval($comment['c_commu_topic_id']));
    26402634
    26412635    $data = array(
     
    29492943            $c_commu_id = 0)
    29502944{
     2945    if(!$search_word){
     2946        return db_commu_new_topic_list($page_size,$page,$type,$c_commu_id);
     2947    }
     2948
    29512949    if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
    29522950        $select = 'SELECT distinct on (ct.c_commu_topic_id) c.name AS commu_name, c.image_filename AS commu_image'
     
    29542952    } else {
    29552953        $select = 'SELECT c.name AS commu_name, c.image_filename AS commu_image'
    2956                 . ', ct.*, MAX(ctc.r_datetime) AS max_datetime';
     2954                . ', ct.*, ct.r_datetime AS max_datetime';
    29572955    }
    29582956
     
    30143012        $sql = 'SELECT body FROM c_commu_topic_comment WHERE number = 0 AND c_commu_topic_id = ?';
    30153013        $list[$key]['body'] = db_get_one($sql, $p);
    3016         $sql = 'SELECT MAX(number) FROM c_commu_topic_comment WHERE c_commu_topic_id = ?';
    3017         $list[$key]['max_number'] = db_get_one($sql, $p);
     3014        $number = db_commu_get_max_number4topic($value['c_commu_topic_id']);
     3015        $list[$key]['max_number'] = $number;
    30183016    }
    30193017
     
    30333031}
    30343032
     3033/*
     3034 * トピック書き込み時間(r_datetime_comment)を更新する
     3035 */
     3036function db_commu_update_c_commu_topic_r_datetime_comment($c_commu_topic_id)
     3037{
     3038    $data = array(
     3039        'r_datetime_comment' => db_now(),
     3040    );
     3041    $where = array(
     3042        'c_commu_topic_id' => intval($c_commu_topic_id),
     3043    );
     3044    return db_update('c_commu_topic', $data, $where);
     3045}
     3046
     3047/*
     3048 * 最終書き込みコメントの情報取得
     3049 */
     3050function db_commu_get_last_c_topic_comment($c_commu_topic_id)
     3051{
     3052    $sql = 'SELECT * FROM c_commu_topic_comment WHERE c_commu_topic_id = ? ORDER BY r_datetime DESC';
     3053    $params = array(intval($c_commu_topic_id));
     3054    return db_get_row($sql,$params);
     3055}
     3056
     3057/**
     3058 * トピック検索簡易版(キーワード無し)
     3059 */
     3060function db_commu_new_topic_list(
     3061            $page_size,
     3062            $page,
     3063            $type = 'all',
     3064            $c_commu_id = 0)
     3065{
     3066    $select = 'SELECT c.name AS commu_name, c.image_filename AS commu_image'
     3067            . ' ,ct.*, ct.r_datetime AS max_datetime'
     3068            . ' FROM c_commu AS c'
     3069            . ' INNER JOIN c_commu_topic AS ct USING(c_commu_id) ';
     3070
     3071    $params = array();
     3072    $where = ' WHERE 1';
     3073
     3074    if ($c_commu_id) {
     3075        $where .= ' AND ct.c_commu_id = ?';
     3076        $params[] = $c_commu_id;
     3077    } else {
     3078        $where .= " AND c.public_flag IN ('public', 'auth_sns')";
     3079    }
     3080    switch ($type) {
     3081    case 'topic':
     3082        $where .= ' AND event_flag = 0';
     3083        break;
     3084    case 'event':
     3085        $where .= ' AND event_flag = 1';
     3086        break;
     3087    case 'all':
     3088    default:
     3089        break;
     3090    }
     3091    $order = ' ORDER BY max_datetime DESC';
     3092
     3093    $sql = $select .$where . $order;
     3094    $list = db_get_all_page($sql, $page, $page_size, $params);
     3095
     3096    foreach ($list as $key => $value) {
     3097        $p = array((int)$value['c_commu_topic_id']);
     3098        $sql = 'SELECT body FROM c_commu_topic_comment WHERE number = 0 AND c_commu_topic_id = ?';
     3099        $list[$key]['body'] = db_get_one($sql, $p);
     3100        $number = db_commu_get_max_number4topic($value['c_commu_topic_id']);
     3101        $list[$key]['max_number'] = $number;
     3102    }
     3103
     3104    $sql = 'SELECT COUNT(c_commu_topic_id) FROM c_commu'
     3105         . ' AS c INNER JOIN c_commu_topic USING(c_commu_id)' . $where;
     3106    $total_num = db_get_one($sql, $params);
     3107
     3108    if ($total_num != 0) {
     3109        $total_page_num =  ceil($total_num / $page_size);
     3110        $next = ($page < $total_page_num);
     3111        $prev = ($page > 1);
     3112    }
     3113
     3114    $start_num = ($page - 1) * $page_size + 1;
     3115    $end_num   = $start_num + $page_size - 1 >= $total_num ? $total_num : $start_num + $page_size - 1;
     3116
     3117    return array($list, $prev, $next, $total_num, $start_num, $end_num);
     3118}
     3119
    30353120?>
  • OpenPNE/trunk/webapp/lib/db/diary.php

    r6630 r6631  
    421421    $ids = implode(',', array_map('intval', $friends));
    422422
    423     $hint = db_mysql_hint('USE INDEX (r_datetime_c_member_id, r_datetime)');
     423    $hint = db_mysql_hint('USE INDEX (c_member_id_r_datetime_public_flag)');
    424424    $sql = 'SELECT * FROM c_diary' . $hint .
    425425            ' WHERE c_member_id IN (' . $ids . ')' .
     
    509509    $ids = implode(',', array_map('intval', $friends));
    510510
    511     $hint = db_mysql_hint('USE INDEX (r_datetime_c_member_id, r_datetime)');
     511    $hint = db_mysql_hint('USE INDEX (c_member_id_r_datetime_public_flag)');
    512512    $sql = 'SELECT * FROM c_diary' . $hint .
    513513            ' WHERE c_member_id IN (' . $ids . ')' .
    514514            ' AND public_flag <> \'private\'' .
    515515            ' ORDER BY c_diary.r_datetime DESC';
    516 
    517516    $c_diary_friend_list = db_get_all_limit($sql, 0, $limit);
    518517
     
    544543    $is_recurred = false;
    545544
    546     $date = date('Y-m-d 00:00:00', strtotime('-15 days'));
    547 
    548     $blocked = db_member_access_block_list4c_member_id_to($c_member_id);
    549     $blocked[] = $c_member_id;
    550     $except_ids = implode(',', $blocked);
    551 
    552     $sql = 'SELECT c_diary_comment.c_diary_id' .
    553             ' FROM c_diary_comment INNER JOIN c_diary USING (c_diary_id)' .
    554             ' WHERE c_diary_comment.c_member_id = ?' .
    555             ' AND c_diary_comment.r_datetime > ?' .
    556             ' AND c_diary.c_member_id NOT IN (' . $except_ids . ')' .
    557             ' AND c_diary.public_flag <> \'private\'';
    558     $params = array(intval($c_member_id), $date);
    559     $c_diary_id_list = db_get_col($sql, $params);
    560     $c_diary_id_list = array_unique($c_diary_id_list);
    561     if (!$c_diary_id_list) {
    562         return array();
    563     }
    564 
    565     $ids = implode(',', $c_diary_id_list);
    566     $sql = 'SELECT c_diary_id, MAX(r_datetime) as maxdate' .
    567            ' FROM c_diary_comment' .
    568            ' WHERE c_diary_id IN (' . $ids . ')' .
    569            ' GROUP BY c_diary_id' .
     545    $sql = 'SELECT c_diary_id, r_datetime as maxdate' .
     546           ' FROM c_diary_comment_summary' .
     547           ' WHERE c_member_id = ?' .
    570548           ' ORDER BY maxdate DESC';
    571     $list = db_get_assoc_limit($sql, 0, $limit);
     549    $list = db_get_assoc_limit($sql, 0, $limit, array(intval($c_member_id)));
    572550
    573551    $result = array();
     
    587565function p_h_diary_comment_list_c_diary_my_comment_list4c_member_id($c_member_id, $page, $page_size)
    588566{
    589     $blocked = db_member_access_block_list4c_member_id_to($c_member_id);
    590     $blocked[] = $c_member_id;
    591     $except_ids = implode(',', $blocked);
    592 
    593     $friends = db_friend_c_member_id_list($c_member_id);
    594     $friend_ids = implode(',', $friends);
    595 
    596     if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
    597         $sql = 'SELECT d.c_diary_id' .
    598                 ', d.subject' .
    599                 ', d.c_member_id' .
    600                 ', sub_diary_tbl.r_datetime' .
    601                 ', sub_diary_tbl.num_comment' .
    602             ' FROM c_diary AS d' .
    603                 ', ( SELECT dc.c_diary_id' .
    604                         ', MAX(dc.r_datetime) AS r_datetime' .
    605                         ', COUNT(DISTINCT dc.c_diary_comment_id) AS num_comment' .
    606                     ' FROM c_diary AS d' .
    607                         ' INNER JOIN c_diary_comment AS dc USING (c_diary_id)' .
    608                         ', c_diary_comment AS mydc' .
    609                     ' WHERE mydc.c_member_id = ?' .
    610                         ' AND mydc.c_diary_id = d.c_diary_id' .
    611                         ' AND mydc.c_member_id <> d.c_member_id' .
    612                         ' AND d.c_member_id NOT IN (' . $except_ids . ')' .
    613                         ' AND (d.public_flag = \'public\'';
    614         if ($friend_ids) {
    615             $sql .= ' OR (d.public_flag = \'friend\' AND d.c_member_id IN (' . $friend_ids . '))';
    616         }
    617         $sql .= ')' .
    618                     ' GROUP BY dc.c_diary_id' .
    619                 ') as sub_diary_tbl' .
    620             ' WHERE' .
    621                 ' sub_diary_tbl.c_diary_id = d.c_diary_id' .
    622             ' ORDER BY r_datetime DESC';
    623     } else {
    624         $sql = 'SELECT d.c_diary_id' .
    625                 ', d.subject' .
    626                 ', d.c_member_id' .
    627                 ', MAX(dc.r_datetime) AS r_datetime' .
    628                 ', COUNT(DISTINCT dc.c_diary_comment_id) AS num_comment' .
    629             ' FROM c_diary AS d' .
    630                 ' INNER JOIN c_diary_comment AS dc USING (c_diary_id)' .
    631                 ', c_diary_comment AS mydc' .
    632             ' WHERE mydc.c_member_id = ?' .
    633                 ' AND mydc.c_diary_id = d.c_diary_id' .
    634                 ' AND mydc.c_member_id <> d.c_member_id' .
    635                 ' AND d.c_member_id NOT IN (' . $except_ids . ')' .
    636                 ' AND (d.public_flag = \'public\'';
    637         if ($friend_ids) {
    638             $sql .= ' OR (d.public_flag = \'friend\' AND d.c_member_id IN (' . $friend_ids . '))';
    639         }
    640         $sql .= ')' .
    641             ' GROUP BY dc.c_diary_id' .
    642             ' ORDER BY r_datetime DESC';
    643     }
    644 
     567    $sql = 'SELECT c_diary_id, c_member_id, r_datetime' .
     568           ' FROM c_diary_comment_summary' .
     569           ' WHERE c_member_id = ?' .
     570           ' ORDER BY r_datetime DESC';
    645571    $params = array(intval($c_member_id));
    646572    $list = db_get_all_page($sql, $page, $page_size, $params);
     
    648574    foreach ($list as $key => $value) {
    649575        $list[$key] += db_member_c_member4c_member_id_LIGHT($value['c_member_id']);
    650     }
    651 
    652     $sql = 'SELECT COUNT(DISTINCT d.c_diary_id)' .
    653         ' FROM c_diary AS d' .
    654             ' INNER JOIN c_diary_comment AS dc USING (c_diary_id)' .
    655             ', c_diary_comment AS mydc' .
    656         ' WHERE mydc.c_member_id = ?' .
    657             ' AND mydc.c_diary_id = d.c_diary_id' .
    658             ' AND mydc.c_member_id <> d.c_member_id' .
    659             ' AND d.c_member_id NOT IN (' . $except_ids . ')' .
    660             ' AND (d.public_flag = \'public\'';
    661     if ($friend_ids) {
    662         $sql .= ' OR (d.public_flag = \'friend\' AND d.c_member_id IN (' . $friend_ids . '))';
    663     }
    664     $sql .= ')';
    665 
     576        $diary = db_diary_get_c_diary4id($value['c_diary_id']);
     577        $list[$key]['subject'] = $diary['subject'];
     578        $list[$key]['num_comment'] = db_diary_count_c_diary_comment4c_diary_id($value['c_diary_id']);
     579    }
     580
     581    $sql = 'SELECT c_diary_id' .
     582           ' FROM c_diary_comment_summary' .
     583           ' WHERE c_member_id = ?';
     584    $params = array(intval($c_member_id));
    666585    $total_num = db_get_one($sql, $params);
    667586
     
    11251044    }
    11261045
     1046    $sql = 'DELETE FROM c_diary_comment_summary WHERE c_diary_id = ?';
     1047    db_query($sql, $params);
     1048
    11271049    $sql = 'DELETE FROM c_diary_comment WHERE c_diary_id = ?';
    11281050    db_query($sql, $params);
     
    12591181}
    12601182
     1183/**
     1184 * 日記コメント記入履歴の追加
     1185 *
     1186 * @param  int    $c_member_id
     1187 * @param  int    $c_diary_id
     1188 */
     1189function db_diary_insert_c_diary_comment_summary($c_member_id, $c_diary_id)
     1190{
     1191    $sql = 'SELECT c_diary_id FROM c_diary_comment_summary'
     1192         . ' WHERE c_member_id = ? AND c_diary_id = ?';
     1193    $params = array(intval($c_member_id),intval($c_diary_id));
     1194    $summary_id = db_get_one($sql,$params,'main');
     1195    if(!$summary_id){
     1196        $data = array(
     1197            'c_member_id' => intval($c_member_id),
     1198            'c_diary_id' => intval($c_diary_id),
     1199            'r_datetime' => db_now(),
     1200        );
     1201        $ins_id = db_insert('c_diary_comment_summary', $data);
     1202    }
     1203}
     1204
     1205/**
     1206 * 日記コメント記入履歴の更新
     1207 *
     1208 * @param  int    $c_diary_id
     1209 */
     1210function db_diary_update_c_diary_comment_summary($c_diary_id)
     1211{
     1212    $data = array(
     1213        'r_datetime' => db_now(),
     1214    );
     1215    $where = array('c_diary_id' => intval($c_diary_id));
     1216    $rtn = db_update('c_diary_comment_summary',$data,$where);
     1217    return array($ins_id,$rtn);
     1218}
     1219
     1220
     1221/**
     1222 * 日記コメント記入履歴の削除
     1223 *
     1224 * @param  int    $c_member_id
     1225 * @param  int    $c_diary_id
     1226 * 該当c_diary_idへのコメント数が0なら、日記コメント記入履歴も削除する。
     1227 *
     1228 */
     1229function db_diary_delete_c_diary_comment_summary($c_member_id, $c_diary_id)
     1230{
     1231    // 投稿したコメントの有無
     1232    $sql = 'SELECT COUNT(c_diary_comment_id) FROM c_diary_comment'
     1233         . ' WHERE c_member_id = ? AND c_diary_id = ?';
     1234    $params = array(intval($c_member_id),intval($c_diary_id));
     1235    $count = db_get_one($sql,$params,'main');
     1236    // コメントが無ければ履歴削除
     1237    if(!$count){
     1238        $sql = 'DELETE FROM c_diary_comment_summary'
     1239             . ' WHERE c_member_id = ? AND c_diary_id = ?';
     1240        $params = array(intval($c_member_id),intval($c_diary_id));
     1241        db_query($sql, $params);
     1242    }
     1243    $sql = 'SELECT * FROM c_diary_comment WHERE c_diary_id = ?'
     1244         . ' ORDER BY c_diary_comment_id DESC';
     1245    $params = array(intval($c_diary_id));
     1246    $comment = db_get_row($sql,$params,'main');
     1247    // 最新コメントの日付で履歴更新
     1248    $data = array(
     1249        'r_datetime' => $comment['r_datetime'],
     1250    );
     1251    $where = array('c_diary_id' => intval($c_diary_id));
     1252    $rtn = db_update('c_diary_comment_summary',$data,$where);
     1253}
     1254
    12611255?>
  • OpenPNE/trunk/webapp/lib/db/rss.php

    r6630 r6631  
    3636    $ids = implode(',', array_map('intval', $friends));
    3737
    38     $hint = db_mysql_hint('USE INDEX (r_datetime_c_member_id, r_datetime)');
     38    $hint = db_mysql_hint('USE INDEX (c_member_id_r_datetime)');
    3939    $sql = 'SELECT * FROM c_rss_cache' . $hint .
    4040            ' WHERE c_member_id IN (' . $ids . ')' .
  • OpenPNE/trunk/webapp/lib/mail/sns.php

    r6630 r6631  
    425425        //日記コメント書き込み
    426426        $ins_id = db_diary_insert_c_diary_comment($this->c_member_id, $c_diary_id, $body);
     427
     428        //日記コメント記入履歴追加
     429        if ($u != $target_c_member_id) {
     430            db_diary_insert_c_diary_comment_summary($u,$target_c_diary_id);
     431        }
     432        //日記コメント記入履歴更新
     433        db_diary_update_c_diary_comment_summary($target_c_diary_id);
    427434
    428435        // 写真登録
  • OpenPNE/trunk/webapp/modules/ktai/do/fh_diary_delete_c_diary_comment.php

    r4933 r6631  
    3434        db_diary_delete_c_diary_comment($target_c_diary_comment_id, $u);
    3535
     36        //コメント記入履歴削除実行
     37        db_diary_delete_c_diary_comment_summary($target_c_member_id,$c_diary_comment['c_diary_id']);
     38
    3639        $p = array('target_c_diary_id' => $c_diary['c_diary_id']);
    3740        openpne_redirect('ktai', 'page_fh_diary', $p);
  • OpenPNE/trunk/webapp/modules/ktai/do/fh_diary_insert_c_diary_comment.php

    r6454 r6631  
    4444
    4545        $insert_id = db_diary_insert_c_diary_comment($u, $target_c_diary_id, $body);
     46
     47        //日記コメント記入履歴追加
     48        if ($u != $target_c_member_id) {
     49            db_diary_insert_c_diary_comment_summary($u,$target_c_diary_id);
     50        }
     51        //日記コメント記入履歴更新
     52        db_diary_update_c_diary_comment_summary($target_c_diary_id);
     53
    4654        //日記コメントが書き込まれたので日記自体を未読扱いにする
    4755        db_diary_update_c_diary_is_checked($target_c_diary_id, 0);
  • OpenPNE/trunk/webapp/modules/pc/do/fh_diary_delete_c_diary_comment.php

    r4933 r6631  
    3535            //コメント削除実行
    3636            db_diary_delete_c_diary_comment($val, $u);
     37
     38            //コメント記入履歴削除実行
     39            db_diary_delete_c_diary_comment_summary($target_c_diary_comment['c_member_id'],$target_c_diary_id);
    3740        }
    3841
  • OpenPNE/trunk/webapp/modules/pc/do/fh_diary_insert_c_diary_comment.php

    r6454 r6631  
    5656        db_diary_insert_c_diary_comment_images($c_diary_comment_id, $filename_1, $filename_2, $filename_3);
    5757
     58        //日記コメント記入履歴更新
     59        if ($u != $target_c_member_id) {
     60            db_diary_insert_c_diary_comment_summary($u,$target_c_diary_id);
     61        }
     62        db_diary_update_c_diary_comment_summary($target_c_diary_id);
     63
    5864        //日記コメントが書き込まれたので日記自体を未読扱いにする
    5965        db_diary_update_c_diary_is_checked($target_c_diary_id, 0);
Note: See TracChangeset for help on using the changeset viewer.