From e76b691e78e273226cba9284cb8cd22a423319ed Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:23:25 -0500 Subject: bucky2 --- bucky2/t/flag-images.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 bucky2/t/flag-images.pl (limited to 'bucky2/t/flag-images.pl') 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"); + } + } + } -- cgit v1.2.3-70-g09d2