/[LeafOK_CVS]/lbbs/src/section_list_loader.c
ViewVC logotype

Diff of /lbbs/src/section_list_loader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.15 by sysadm, Sat May 31 10:23:23 2025 UTC Revision 1.16 by sysadm, Sat May 31 12:00:00 2025 UTC
# Line 169  int append_articles_from_db(int32_t star Line 169  int append_articles_from_db(int32_t star
169          ARTICLE *p_topic;          ARTICLE *p_topic;
170          SECTION_LIST *p_section = NULL;          SECTION_LIST *p_section = NULL;
171          int32_t last_sid = 0;          int32_t last_sid = 0;
172            char sub_ip[IP_ADDR_LEN];
173          int article_count = 0;          int article_count = 0;
174          int ret = 0;          int ret = 0;
175          int i;          int i;
# Line 183  int append_articles_from_db(int32_t star Line 184  int append_articles_from_db(int32_t star
184          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
185                           "SELECT bbs.AID, TID, SID, bbs.CID, UID, visible, excerption, ontop, `lock`, "                           "SELECT bbs.AID, TID, SID, bbs.CID, UID, visible, excerption, ontop, `lock`, "
186                           "transship, username, nickname, title, UNIX_TIMESTAMP(sub_dt) AS sub_dt, "                           "transship, username, nickname, title, UNIX_TIMESTAMP(sub_dt) AS sub_dt, "
187                           "bbs_content.content "                           "sub_ip, bbs_content.content "
188                           "FROM bbs INNER JOIN bbs_content ON bbs.CID = bbs_content.CID "                           "FROM bbs INNER JOIN bbs_content ON bbs.CID = bbs_content.CID "
189                           "WHERE bbs.AID >= %d ORDER BY bbs.AID LIMIT %d",                           "WHERE bbs.AID >= %d ORDER BY bbs.AID LIMIT %d",
190                           start_aid, article_count_limit);                           start_aid, article_count_limit);
# Line 236  int append_articles_from_db(int32_t star Line 237  int append_articles_from_db(int32_t star
237    
238                  article.sub_dt = atol(row[i++]);                  article.sub_dt = atol(row[i++]);
239    
240                    strncpy(sub_ip, row[i++], sizeof(sub_ip) - 1);
241                    sub_ip[sizeof(sub_ip) - 1] = '\0';
242                    ip_mask(sub_ip, 1, '*');
243    
244                  // release lock of last section if different from current one                  // release lock of last section if different from current one
245                  if (!global_lock && article.sid != last_sid && last_sid != 0)                  if (!global_lock && article.sid != last_sid && last_sid != 0)
246                  {                  {
# Line 288  int append_articles_from_db(int32_t star Line 293  int append_articles_from_db(int32_t star
293    
294                  article_count++;                  article_count++;
295    
296                  if (article_cache_generate(VAR_ARTICLE_CACHE_DIR, &article, p_section, row[i++], 0) < 0)                  if (article_cache_generate(VAR_ARTICLE_CACHE_DIR, &article, p_section, row[i++], sub_ip, 0) < 0)
297                  {                  {
298                          log_error("article_cache_generate(aid=%d, cid=%d) error\n", article.aid, article.cid);                          log_error("article_cache_generate(aid=%d, cid=%d) error\n", article.aid, article.cid);
299                          ret = -4;                          ret = -4;
# Line 371  int apply_article_op_log_from_db(int op_ Line 376  int apply_article_op_log_from_db(int op_
376          ARTICLE *p_article;          ARTICLE *p_article;
377          SECTION_LIST *p_section = NULL;          SECTION_LIST *p_section = NULL;
378          SECTION_LIST *p_section_dest;          SECTION_LIST *p_section_dest;
379            char sub_ip[IP_ADDR_LEN];
380          int32_t last_sid = 0;          int32_t last_sid = 0;
381          int32_t sid_dest;          int32_t sid_dest;
382          int op_count = 0;          int op_count = 0;
# Line 467  int apply_article_op_log_from_db(int op_ Line 473  int apply_article_op_log_from_db(int op_
473                          break;                          break;
474                  case 'M': // Modify article                  case 'M': // Modify article
475                          snprintf(sql, sizeof(sql),                          snprintf(sql, sizeof(sql),
476                                           "SELECT bbs.CID, bbs_content.content "                                           "SELECT bbs.CID, sub_ip, bbs_content.content "
477                                           "FROM bbs INNER JOIN bbs_content ON bbs.CID = bbs_content.CID "                                           "FROM bbs INNER JOIN bbs_content ON bbs.CID = bbs_content.CID "
478                                           "WHERE bbs.AID = %d",                                           "WHERE bbs.AID = %d",
479                                           p_article->aid);                                           p_article->aid);
# Line 488  int apply_article_op_log_from_db(int op_ Line 494  int apply_article_op_log_from_db(int op_
494                          {                          {
495                                  p_article->cid = atoi(row2[0]);                                  p_article->cid = atoi(row2[0]);
496    
497                                  if (article_cache_generate(VAR_ARTICLE_CACHE_DIR, p_article, p_section, row2[1], 0) < 0)                                  strncpy(sub_ip, row2[1], sizeof(sub_ip) - 1);
498                                    sub_ip[sizeof(sub_ip) - 1] = '\0';
499                                    ip_mask(sub_ip, 1, '*');
500    
501                                    if (article_cache_generate(VAR_ARTICLE_CACHE_DIR, p_article, p_section, row2[2], sub_ip, 0) < 0)
502                                  {                                  {
503                                          log_error("article_cache_generate(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid);                                          log_error("article_cache_generate(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid);
504                                          ret = -4;                                          ret = -4;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1