18 |
|
|
19 |
#$verbose = 1; |
#$verbose = 1; |
20 |
my $debug = 0; |
my $debug = 0; |
21 |
|
my $force = 0; |
22 |
|
|
23 |
my $result = GetOptions( |
my $result = GetOptions( |
24 |
"collection=s" => \$collection, |
"collection=s" => \$collection, |
27 |
"debug!" => \$debug, |
"debug!" => \$debug, |
28 |
"exclude=s" => \$exclude, |
"exclude=s" => \$exclude, |
29 |
"node=s" => \$node_url, |
"node=s" => \$node_url, |
30 |
|
"force!" => \$force, |
31 |
); |
); |
32 |
|
|
33 |
my $dir = shift @ARGV || die "usage: $0 [dir]"; |
my $dir = shift @ARGV || die "usage: $0 [dir]"; |
101 |
# create a document object |
# create a document object |
102 |
my $doc = HyperEstraier::Document->new; |
my $doc = HyperEstraier::Document->new; |
103 |
|
|
104 |
my $title = $1 if ($contents =~ m#<title>(.+)</title>#is); |
my $title = $1 if ($contents =~ m#<title>(.+?)</title>#is); |
105 |
|
|
106 |
# chop long titles to 100 chars |
# chop long titles to 100 chars |
107 |
$title = substr($title, 0, 100) . '...' if ($title && length($title) > 100); |
$title = substr($title, 0, 100) . '...' if ($title && length($title) > 100); |
136 |
my $path = $_; |
my $path = $_; |
137 |
my $contents; |
my $contents; |
138 |
|
|
139 |
return if (-l $path || $path =~ m#/.svn# || $path =~ m/(~|.bak)$/); |
return if (! $force && -l $path || $path =~ m#/.svn# || $path =~ m/(~|.bak)$/); |
140 |
|
|
141 |
my $mtime = (stat($path))[9]; |
my $mtime = (stat($path))[9]; |
142 |
my $mtime_db = $db->get_doc_attr_by_uri("file:///$path", '@mtime') || -2; |
my $mtime_db = $db->get_doc_attr_by_uri("file:///$path", '@mtime') || -2; |
143 |
|
|
144 |
if ($mtime == $mtime_db) { |
if ($mtime == $mtime_db) { |
145 |
print STDERR "# same: $path $mtime\n" if ($verbose); |
print STDERR "# same: $path $mtime\n" if ($verbose); |
146 |
return; |
return unless($force); |
147 |
} else { |
} else { |
148 |
print STDERR "# changed: $path $mtime != $mtime_db\n" if ($debug); |
print STDERR "# changed: $path $mtime != $mtime_db\n" if ($debug); |
149 |
} |
} |