[[PageOutline]] = Username mapping tool for !MediaWiki export = [wiki:"What is SourceForge.net?" SourceForge.net] provides !MediaWiki service as part of our [wiki:"Hosted Apps"] offering. Some projects have an existing !MediaWiki install which they want to move to !SourceForge.net. Our !MediaWiki service does support import, but there is a pitfall. When you have an external !MediaWiki install, that install probably has usernames which do not map to !SourceForge.net user accounts. We provide this page as instructions for realigning your !MediaWiki install against the !SourceForge.net user accounts of your developer team. Data conversion may be performed as follows: 1. Export the page from your existing !MediaWiki install. 1. Save the perl script, as shown below, in a file named mediawiki-convert.pl 1. Run the script below, as follows, to process and modify all included usernames to their matching !SourceForge.net user account:`$ ./mediawiki-convert.pl EXPORT_FILENAME > NEW_EXPORT_FILENAME` 1. Import the data to your new !MediaWiki install at !SourceForge.net. Should a problem be noted with the user mapping it can be fixed by deleting the page and running this convert script as documented or by manually tweaking the contents of the XML file. {{{ #!/usr/bin/perl -w my %users; my $text; # Store stdin and process for usernames open(FH, $ARGV[0]) or die "Cannot open $ARGV[0]\n"; while() { $text .= $_; if($_ =~ m/(.+)<\/username>/) { $users{$1} = ''; } } close(FH); # Prompt for replacement values print STDERR " You will now be prompted with a set of usernames, respond with the name of the SourceForge.net user that should be mapped to the username in question:\n"; foreach(keys(%users)) { print STDERR "$_: "; my $tmp = ; chomp($tmp); $tmp = lc($tmp); $tmp = ucfirst($tmp); $users{$_} = $tmp; } foreach(keys(%users)) { $text =~ s/$_<\/username>/$users{$_}<\/username>/gs; } print $text; }}} = Getting Help = * [wiki:"Support"] * [wiki:"Request an enhancement"] [[Include(__footer)]]