February 19, 2004

MySQL導入に伴う"Recent Comments"不具合の回避


MySQLにデータを移したらRecent Commentsが消えてしまったで調べてみたらどうやら不具合っぽいので修正。


BLOG質問箱 : リーセントコメント+コメント日付
http://www.mylog.jp/blogs/q-box/archives/001017.html

※コメントに修正方法がかかれていました。気がつかなかった・・。


lib/MT/Template/Context.pmの636行目:

修正前
} elsif (my $n = $args->{recently_commented_on}) {
  $args{'join'} = [ 'MT::Comment', 'entry_id',
    { blog_id => $blog_id },
    { 'sort' => 'created_on',
     direction => 'descend',
     unique => 1,
     limit => $n } ];
  $no_resort = 1;
}


修正後
} elsif (my $n = $args->{recently_commented_on}) {
  $args{'join'} = [ 'MT::Comment', 'entry_id',
    { blog_id => $blog_id }, { unique => 1 } ];
  $args{'sort'} = 'created_on';
  $args{direction} = 'descend';
  $args{limit} = $n;
  $no_resort = 1;
}


修正後、サイトのRebuild。


この記事へのトラックバックURL

http://app.blog.livedoor.jp/cpiblog00035/tb.cgi/4081569