svnno****@sourc*****
svnno****@sourc*****
2009年 2月 23日 (月) 20:02:26 JST
Revision: 1037 http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1037 Author: tach Date: 2009-02-23 20:02:26 +0900 (Mon, 23 Feb 2009) Log Message: ----------- Fix for polls discussion on fix-discussion-url Modified Paths: -------------- slashjp/trunk/bin/fix-discussion-url -------------- next part -------------- Modified: slashjp/trunk/bin/fix-discussion-url =================================================================== --- slashjp/trunk/bin/fix-discussion-url 2009-02-23 10:47:48 UTC (rev 1036) +++ slashjp/trunk/bin/fix-discussion-url 2009-02-23 11:02:26 UTC (rev 1037) @@ -36,16 +36,16 @@ my $nickname = fixparam($slashdb->getUser($uid, 'nickname')); $url = "$gSkin->{rootdir}/~$nickname/journal/$id"; } elsif ($discussion->{kind} eq "poll") { - next unless ($discussion->{url} =~ m!/\bqid=(\d+?)\b!); - my $qid = $1; - $url = "$gSkin->{rootdir}/polls/$qid?aid=-1"; + if (my $qid = $slashdb->sqlSelect('qid', 'pollquestions', "discussion=$discussion->{id}")) { + $url = "$gSkin->{rootdir}/polls/$qid?aid=-1"; + } } else { next; } - if ($url) { + if ($url && $url ne $discussion->{url}) { + print STDERR "BEFORE: $discussion->{url}\n"; + print STDERR "AFTER : $url\n\n"; $slashdb->sqlUpdate('discussions', { url => $url }, "id=$discussion->{id}"); } - print "BEFORE: $discussion->{url}\n"; - print "AFTER : $url\n\n"; }