diff options
Diffstat (limited to 'bucky2/t/flag-images.pl')
| -rwxr-xr-x | bucky2/t/flag-images.pl | 19 |
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"); + } + } + } |
