Skip to content

Commit

Permalink
Item1918: TagMe import: do not import tags from Trash or tags from no…
Browse files Browse the repository at this point in the history
…n-existing topics.

git-svn-id: http://svn.foswiki.org/trunk/TagsPlugin@8313 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OliverKrueger authored and OliverKrueger committed Jul 26, 2010
1 parent f272a36 commit d9018bd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,25 @@ sub do {
# loop through all topics / files
use Foswiki::Plugins::TagsPlugin::Tag;
foreach my $webTopic (@list) {

my ($web, $topic) = Foswiki::Func::normalizeWebTopicName( "", $webTopic );
$webTopic =~ s/[\/\\]/\./g;
$web =~ s/[\/\\]/\./g;

# do not import garbage
if ($web =~ m/^Trash/) {
Foswiki::Func::writeDebug("TagsPlugin::TagMe-Import: skipping topic from Trash: $webTopic");
$retval .= "<br /> $webTopic (skipping, trash topic)";
next;
};

# do not import legacy
if (not Foswiki::Func::topicExists( $web, $topic )) {
Foswiki::Func::writeDebug("TagsPlugin::TagMe-Import: skipping nonexisting $webTopic");
$retval .= "<br /> $webTopic (skipping, non-existsing)";
next;
};

my $text = Foswiki::Func::readFile("$workAreaDir/_tags_$webTopic.txt");
my @tagInfo = grep { /^[0-9]/ } split( /\n/, $text );
foreach my $line (@tagInfo) {
Expand Down

0 comments on commit d9018bd

Please sign in to comment.