summaryrefslogtreecommitdiff
path: root/bucky2/t/flag-images.pl
diff options
context:
space:
mode:
authorJules Laplace <carbon@melanarchy.org>2013-08-02 17:23:25 -0500
committerJules Laplace <carbon@melanarchy.org>2013-08-02 17:23:25 -0500
commite76b691e78e273226cba9284cb8cd22a423319ed (patch)
treea58d22f69869fe2bf3885f81bdda4952f87ff6d7 /bucky2/t/flag-images.pl
parent753f60c7d4769fa72d3b910e491f37db6f130898 (diff)
bucky2
Diffstat (limited to 'bucky2/t/flag-images.pl')
-rwxr-xr-xbucky2/t/flag-images.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/bucky2/t/flag-images.pl b/bucky2/t/flag-images.pl
new file mode 100755
index 0000000..7962cab
--- /dev/null
+++ b/bucky2/t/flag-images.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+use lib "../lib";
+use Bucky;
+my $bucky = new Bucky;
+my $threads = $bucky->db->select("thread");
+foreach my $thread (@$threads)
+ {
+ next if $thread->{'flagged'};
+ my $threadid = $thread->{'id'};
+ my $files = $bucky->db->select("file", { thread => $threadid });
+ foreach my $file (@$files)
+ {
+ if ($file->{'filename'} =~ /(gif|jpg)$/i)
+ {
+ my $id = $file->{'id'};
+ $bucky->db->execute("UPDATE threads SET flagged=$id WHERE id=$threadid");
+ }
+ }
+ }