[Slashdotjp-dev 1505] [1036] Add fix-poll-discussions - fix discussions. dkid for poll discussion item

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 23日 (月) 19:47:48 JST


Revision: 1036
          http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1036
Author:   tach
Date:     2009-02-23 19:47:48 +0900 (Mon, 23 Feb 2009)

Log Message:
-----------
Add fix-poll-discussions - fix discussions.dkid for poll discussion item

Modified Paths:
--------------
    slashjp/trunk/debian/changelog

Added Paths:
-----------
    slashjp/trunk/bin/fix-poll-discussions


-------------- next part --------------
Added: slashjp/trunk/bin/fix-poll-discussions
===================================================================
--- slashjp/trunk/bin/fix-poll-discussions	                        (rev 0)
+++ slashjp/trunk/bin/fix-poll-discussions	2009-02-23 10:47:48 UTC (rev 1036)
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+#
+# (slash-)fix-poll-discussions - fix discussions.dkid for poll discussion item
+#
+
+use Slash;
+use Slash::Utility;
+use Slash::DB;
+use strict;
+
+my %opts;
+$opts{'u'} ||= 'slash';
+
+createEnvironment($opts{'u'});
+
+my $slashdb = getCurrentDB();
+my $dkid = $slashdb->sqlSelect('dkid', 'discussion_kinds', "name='poll'");
+
+my $where = "polltype='section' AND dkid != $dkid";
+my $other = '';
+
+my $ids = $slashdb->sqlSelectAll(
+	"id",
+	"discussions JOIN pollquestions ON (pollquestions.discussion=discussions.id)",
+	$where,
+	$other
+);
+
+foreach my $id (@$ids) {
+	print STDERR "Fix discussion: $id->[0]\n";
+	$slashdb->sqlUpdate('discussions', { dkid => $dkid }, "id=$id->[0]");
+}


Property changes on: slashjp/trunk/bin/fix-poll-discussions
___________________________________________________________________
Added: svn:executable
   + *

Modified: slashjp/trunk/debian/changelog
===================================================================
--- slashjp/trunk/debian/changelog	2009-02-23 10:15:41 UTC (rev 1035)
+++ slashjp/trunk/debian/changelog	2009-02-23 10:47:48 UTC (rev 1036)
@@ -22,8 +22,9 @@
   * Fix poll URL in discussions table
   * Add fix-discussion-url command to fix url column in discussions table
   * Fix poll discussion kind definition
+  * Add fix-poll-discussions - fix discussions.dkid for poll discussion item
 
- -- Taku YASUI <tach****@osdn*****>  Mon, 23 Feb 2009 10:14:46 +0000
+ -- Taku YASUI <tach****@osdn*****>  Mon, 23 Feb 2009 10:46:34 +0000
 
 slash (2.5.0.233-4) unstable; urgency=low
 



Slashdotjp-dev メーリングリストの案内
Back to archive index