-
Notifications
You must be signed in to change notification settings - Fork 1
/
put_data_back.pl
executable file
·49 lines (43 loc) · 1.14 KB
/
put_data_back.pl
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl
use Mysql;
require "config.txt";
$ENV{'MYSQL_TCP_PORT'} = $dbport;
$dbh = Mysql->connect($host,$dbname,$user,$passwd);
print ("Inserting SWF urls\n");
open (IN, "<swf.txt");
while (<IN>) {
chop();
$line = $_;
$sth = $dbh->query("insert ignore into flashurl values ('','$line','2001-01-01 00:00:00','2001-01-01 00:00:00','','','')");
}
close IN;
print ("Updating bad crawl urls\n");
open (IN, "<bad.txt");
while (<IN>) {
chop();
$line = $_;
($id,$url) = split(/\|/,$line);
print ("BAD: $url\n");
$sth = $dbh->query("update crawlurl set state = 999, last_modified = now() where id = '$id'");
}
close IN;
print ("Updating good crawl urls\n");
open (IN, "<good.txt");
while (<IN>) {
chop();
$line = $_;
($id,$url) = split(/\|/,$line);
print ("GOOD: $url\n");
$sth = $dbh->query("update crawlurl set state = 1, last_modified = now() where id = '$id'");
}
close IN;
print ("Inserting NEW crawl urls\n");
open (IN, "<urls.txt");
while (<IN>) {
chop();
$line = $_;
($url,$depth) = split(/\|/,$line);
$depth++;
$sth = $dbh->query("insert ignore into crawlurl values ('','$url','$depth','2001-01-01 00:00:00','','','')");
}
close IN;