Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (33 sloc) 0.999 kB
#!/usr/bin/perl
use warnings;
use strict;
use Slash::Test shift || 'slash';
my $limit = shift;
my $offset = shift;
local $| = 1;
my $firehose = getObject("Slash::FireHose");
my $journal = getObject("Slash::Journal");
printf STDERR "Fetching IDs ...\n";
my $slashdb = getCurrentDB();
my $limitstr;
if ($limit && $offset) {
$limitstr = "LIMIT $offset,$limit";
} elsif ($limit) {
$limitstr = "LIMIT $limit";
}
my $ids = $slashdb->sqlSelectColArrayref('id', 'journals', '', ($limitstr || ()));
my $i = 0;
my %ids;
printf STDERR "\nImporting %d journals\n", scalar(@$ids);
for my $id (@$ids) {
printf "\r%d", ++$i;
my $introtext = $journal->getIntrotext($id);
$journal->sqlUpdate('journals_text',
{ introtext => $introtext },
"id = " . $journal->sqlQuote($id)
);
$ids{$id} = $firehose->createUpdateItemFromJournal($id);
}
printf STDERR "\nImported %d journals\n", scalar(keys %ids);
my $string = join '; ', map { "$_:$ids{$_}" } sort { $a <=> $b } keys %ids;
print "\n$string\nDone\n";
Jump to Line
Something went wrong with that request. Please try again.