Skip to content

Commit

Permalink
Item8402: syntax errors
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/BlogPlugin@16693 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed May 3, 2013
1 parent 3a84409 commit 3d73720
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions lib/Foswiki/Plugins/BlogPlugin/Converter.pm
Expand Up @@ -431,14 +431,14 @@ sub convertBlogEntry {

$newTopic->putKeyed("PREFERENCE", { name => "DISPLAYCOMMENTS", title => "DISPLAYCOMMENTS", type => "Local", value => "on" });

my @authors = map {Foswiki:Func::getCanonicalUserID($_) || $_} split(/\s*,\s*/, $meta->get("FIELD", "BlogAuthor")->{value} || '');
my @authors = map {Foswiki::Func::getCanonicalUserID($_) || $_} split(/\s*,\s*/, $meta->get("FIELD", "BlogAuthor")->{value} || '');
@authors = ('UnknownUser') unless @authors;
#print STDERR "authors=@author\n";
#print STDERR "authors=@authors\n";

push @fields, {
name => 'Author',
title => 'Author',
value => join(", ", @authors);
value => join(", ", @authors),
};

$newTopic->putAll("FIELD", @fields);
Expand All @@ -447,14 +447,24 @@ sub convertBlogEntry {
$date = Foswiki::Time::parseTime($date);

# save it once, and then ...
$newTopic->save(forcedate => $date, author => $authors[0]);

try {
$newTopic->save(forcedate => $date, author => $authors[0]);
} catch Error::Simple with {
my $error = shift;
print STDERR "ERROR: $error\n";
};

# ... force a second revision to freeze the create time and author
$newTopic->save(forcedate => $date, author => $author, forcenewrevision => 1);
try {
$newTopic->save(forcedate => $date, author => $authors[0], forcenewrevision => 1);
} catch Error::Simple with {
my $error = shift;
print STDERR "ERROR: $error\n";
};

foreach my $attachment ($meta->find('FILEATTACHMENT')) {
print STDERR "### copying attachment $attachment->{name}\n";
$meta->copyAttachment($attachment->{name}, $newTopic, user => $author);
$meta->copyAttachment($attachment->{name}, $newTopic, user => $authors[0]);
}
}

Expand Down

0 comments on commit 3d73720

Please sign in to comment.