/[refeed]/trunk/export/dump.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/export/dump.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (show annotations)
Mon Oct 15 15:18:52 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 636 byte(s)
export published items
1 #!/usr/local/bin/perl -w
2
3 use DBI;
4 use File::Slurp;
5
6 use strict;
7
8 my $connect = "DBI:mysql:database=reblog";
9 my $sql=qq{
10 select
11 id,title,content
12 from items
13 join items_userdata on items_userdata.item_id = items.id
14 where items_userdata.label = 'published'
15 };
16
17 my $dbh = DBI->connect("$connect","","") || die $DBI::errstr;
18
19 my $sth = $dbh->prepare("$sql") || die $dbh->errstr();
20 $sth->execute() || die $sth->errstr();
21
22 print "#",join("\t",@{ $sth->{NAME} }),"\n";
23 while (my $row = $sth->fetchrow_hashref() ) {
24
25 my $c = $row->{content};
26 $c =~ s!</*[^>]+>!!gs;
27
28 write_file( 'data/' . $row->{id}, $c );
29
30 warn "saved ", $row->{id}, $/;
31 }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26