summaryrefslogtreecommitdiff
path: root/bin/flushrms.pl
blob: 058b58260a0cb03fdd9f9d5969b73a6cb4c6d129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl

use localbucky;
use lib "/var/www/vhosts/carbonpictures.com/bucky/lib";
use Bucky1;

$dbh = DBI->connect ("DBI:mysql:$BUCKY_DB:localhost;mysql_read_default_file=$BUCKY_DB_CNF");

# $DEBUG = 1;

$threads = get_threads();
$fucker = "";
$max = 1;

foreach $t (@$threads)
	{
	$fucker = add_key($fucker, $t->{id});
	$max = $t->{id} if ($t->{id} > $max);
	}

for ($i = 32; $i <= $max; $i++)
	{
	if (-e "$data_path/$i" && !check_key($fucker, $i))
		{
		print "Deleting $i\n";
		system("/bin/rm", "-rf", "$data_path/$i");
		}
	}

$dbh->disconnect();