Revision history for MigrateFromWackoWiki
Additions:
=====Migrating from Wackowiki to Wikkawiki=====
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
I've written the following script which makes a valiant effort to import an existing Wacko database into a newly-created Wikka database. Please note that I have tested this script only on Wacko version R3.5 and Wikka version 1.1.6.0; results may vary when using other versions.
%%(perl)
#! /usr/bin/perl
#
# wacko_import.pl: An import utility to import a Wacko site into a
# *NEWLY CREATED* Wikka site
#
# Usage: Modify the parameters at the start of the script, between the
# ### markers. Immediately after installing Wikka 1.1.6.0, execute this
# script.
#
# Notes: This script is intended to be used against a newly-created
# Wikka database, and has been tested with Wacko R3.5 and Wikka 1.1.6.
# Results with any other version might be unpredictable. Whatever you
# do, ALWAYS BACK UP YOUR DATABASE FIRST!
#
# Copyright (c) 2005 Brian Koontz <brian@pongonova.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public Licence for more details:
#
# http://www.gnu.org/copyleft/gpl.html
#
#####################################################################
use strict;
use DBI();
### Modify these ###
# Wacko DB
my $wacko_database = "wacko";
my $wacko_host = "127.0.0.1";
my $wacko_username = "wackouser";
my $wacko_password = "wacko_pass";
my $wacko_table_prefix = "wacko"; # No underscore!
# Wikka DB
my $wikka_database = "wikka";
my $wikka_host = "127.0.0.1";
my $wikka_username = "wikkauser";
my $wikka_password = "wikka_pass";
my $wikka_table_prefix = "wikka"; #No underscore!
my $RaiseError = 1;
### End modifications ###
# These pages are created by default during a Wikka install. To avoid
# conflict with existing Wacko pages with the same name, any Wacko
# page that is imported and matches one of these will have a "2"
# appended (click PageIndex to view these after importing).
my @reserved_pages = qw( HomePage RecentChanges RecentlyCommented
UserSettings PageIndex WikkaReleaseNotes WikkaDocumentation
WantedPages OrphanedPages TextSearch TextSearchExpanded MyPages
MyChanges InterWiki PasswordForgotten WikiCategory CategoryWiki
CategoryCategory FormattingRules HighScores OwnedPages SandBox );
# Connect to DBs
my $wacko_dbh = DBI->connect("DBI:mysql:database=$wacko_database; host=$wacko_host",
"$wacko_username", "$wacko_password",
{'RaiseError' => $RaiseError});
my $wikka_dbh = DBI->connect("DBI:mysql:database=$wikka_database; host=$wikka_host",
"$wikka_username", "$wikka_password",
{'RaiseError' => $RaiseError});
#
# Convert acls table
#
# Wacko cols: page_tag(250) supertag privilege list
# Wikka cols: page_tag(75) read_acl write_acl comment_acl
my $sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_acls");
$sth->execute();
my $aclref = {};
while(my @row = $sth->fetchrow_array) {
$row[3] = "+" if $row[3] =~ /\$/;
$aclref->{substr($row[0],0,75)}->{$row[2]} = $row[3];
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_acls VALUES (?,?,?,?)");
foreach(sort keys %$aclref) {
$sth->execute($_,
$aclref->{$_}->{"read"},
$aclref->{$_}->{"write"},
$aclref->{$_}->{"comment"});
}
#
# Convert comments table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id page_tag(75) time comment user
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $commentsref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
next if $row[1] !~ /^Comment/;
push(@$tmpref, ''); # id
push(@$tmpref, substr($row[10],0,75)); # page_tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # comment
push(@$tmpref, $row[7]); # user
push(@$commentsref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_comments VALUES (?,?,?,?,?)");
foreach my $comment (@$commentsref) {
$sth->execute(@$comment);
}
#
# Convert links table
#
# Wacko cols: from_tag(250) to_tag(250)
# Wikka cols: from_tag(250) to_tag(250)
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_links");
$sth->execute();
my $linksref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # from_tag
push(@$tmpref, substr($row[1],0,75)); # from_tag
push(@$linksref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_links VALUES (?,?)");
foreach my $link (@$linksref) {
$sth->execute(@$link);
}
#
# Convert pages table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id tag(75) time body owner user latest note handler
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $pagesref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, ''); # id
my $page_title = substr($row[1],0,73);
next if $page_title =~ /^Comment/; # Don't process comments as pages!
if(scalar(grep /$page_title/, @reserved_pages)) {
# Duplicate page name, so rename incoming page
$page_title .= "2";
}
push(@$tmpref, $page_title); # tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # body
push(@$tmpref, $row[6]); # owner
push(@$tmpref, $row[7]); # user
push(@$tmpref, $row[8]); # latest
push(@$tmpref, ''); # note
push(@$tmpref, $row[9]); # handler
push(@$pagesref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_pages VALUES (?,?,?,?,?,?,?,?,?)");
foreach my $page (@$pagesref) {
$sth->execute(@$page);
}
#
# Convert links table
#
# Wacko cols: page_tag(250) referrer time
# Wikka cols: page_tag(250) referrer time
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_referrers");
$sth->execute();
my $referrersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # page_tag
push(@$tmpref, $row[1]); # referrer
push(@$tmpref, $row[2]); # time
push(@$referrersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_referrers VALUES (?,?,?)");
foreach my $referrer (@$referrersref) {
$sth->execute(@$referrer);
}
#
# Convert users table
#
# Wacko cols: name(80) password email motto revisioncount changescount
# doubleclickedit signuptime show_comments bookmarks lang
# show_spaces showdatetime typografica
# Wikka cols: name(75) password email revisioncount changescount
# doubleclickedit signuptime show_comments
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_users");
$sth->execute();
my $usersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # name
push(@$tmpref, $row[1]); # password
push(@$tmpref, $row[2]); # email
push(@$tmpref, $row[4]); # revisioncount
push(@$tmpref, $row[5]); # changescount
push(@$tmpref, $row[6]); # doubleclickedit
push(@$tmpref, $row[7]); # signuptime
push(@$tmpref, $row[8]); # signuptime
push(@$usersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_users VALUES (?,?,?,?,?,?,?,?)");
foreach my $user (@$usersref) {
eval {$sth->execute(@$user)};
if($@) { next; }
}
# Close DB
$wacko_dbh->disconnect();
$wikka_dbh->disconnect();
%%
CategoryUserContributions
CategoryDocumentation
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
I've written the following script which makes a valiant effort to import an existing Wacko database into a newly-created Wikka database. Please note that I have tested this script only on Wacko version R3.5 and Wikka version 1.1.6.0; results may vary when using other versions.
%%(perl)
#! /usr/bin/perl
#
# wacko_import.pl: An import utility to import a Wacko site into a
# *NEWLY CREATED* Wikka site
#
# Usage: Modify the parameters at the start of the script, between the
# ### markers. Immediately after installing Wikka 1.1.6.0, execute this
# script.
#
# Notes: This script is intended to be used against a newly-created
# Wikka database, and has been tested with Wacko R3.5 and Wikka 1.1.6.
# Results with any other version might be unpredictable. Whatever you
# do, ALWAYS BACK UP YOUR DATABASE FIRST!
#
# Copyright (c) 2005 Brian Koontz <brian@pongonova.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public Licence for more details:
#
# http://www.gnu.org/copyleft/gpl.html
#
#####################################################################
use strict;
use DBI();
### Modify these ###
# Wacko DB
my $wacko_database = "wacko";
my $wacko_host = "127.0.0.1";
my $wacko_username = "wackouser";
my $wacko_password = "wacko_pass";
my $wacko_table_prefix = "wacko"; # No underscore!
# Wikka DB
my $wikka_database = "wikka";
my $wikka_host = "127.0.0.1";
my $wikka_username = "wikkauser";
my $wikka_password = "wikka_pass";
my $wikka_table_prefix = "wikka"; #No underscore!
my $RaiseError = 1;
### End modifications ###
# These pages are created by default during a Wikka install. To avoid
# conflict with existing Wacko pages with the same name, any Wacko
# page that is imported and matches one of these will have a "2"
# appended (click PageIndex to view these after importing).
my @reserved_pages = qw( HomePage RecentChanges RecentlyCommented
UserSettings PageIndex WikkaReleaseNotes WikkaDocumentation
WantedPages OrphanedPages TextSearch TextSearchExpanded MyPages
MyChanges InterWiki PasswordForgotten WikiCategory CategoryWiki
CategoryCategory FormattingRules HighScores OwnedPages SandBox );
# Connect to DBs
my $wacko_dbh = DBI->connect("DBI:mysql:database=$wacko_database; host=$wacko_host",
"$wacko_username", "$wacko_password",
{'RaiseError' => $RaiseError});
my $wikka_dbh = DBI->connect("DBI:mysql:database=$wikka_database; host=$wikka_host",
"$wikka_username", "$wikka_password",
{'RaiseError' => $RaiseError});
#
# Convert acls table
#
# Wacko cols: page_tag(250) supertag privilege list
# Wikka cols: page_tag(75) read_acl write_acl comment_acl
my $sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_acls");
$sth->execute();
my $aclref = {};
while(my @row = $sth->fetchrow_array) {
$row[3] = "+" if $row[3] =~ /\$/;
$aclref->{substr($row[0],0,75)}->{$row[2]} = $row[3];
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_acls VALUES (?,?,?,?)");
foreach(sort keys %$aclref) {
$sth->execute($_,
$aclref->{$_}->{"read"},
$aclref->{$_}->{"write"},
$aclref->{$_}->{"comment"});
}
#
# Convert comments table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id page_tag(75) time comment user
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $commentsref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
next if $row[1] !~ /^Comment/;
push(@$tmpref, ''); # id
push(@$tmpref, substr($row[10],0,75)); # page_tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # comment
push(@$tmpref, $row[7]); # user
push(@$commentsref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_comments VALUES (?,?,?,?,?)");
foreach my $comment (@$commentsref) {
$sth->execute(@$comment);
}
#
# Convert links table
#
# Wacko cols: from_tag(250) to_tag(250)
# Wikka cols: from_tag(250) to_tag(250)
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_links");
$sth->execute();
my $linksref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # from_tag
push(@$tmpref, substr($row[1],0,75)); # from_tag
push(@$linksref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_links VALUES (?,?)");
foreach my $link (@$linksref) {
$sth->execute(@$link);
}
#
# Convert pages table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id tag(75) time body owner user latest note handler
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $pagesref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, ''); # id
my $page_title = substr($row[1],0,73);
next if $page_title =~ /^Comment/; # Don't process comments as pages!
if(scalar(grep /$page_title/, @reserved_pages)) {
# Duplicate page name, so rename incoming page
$page_title .= "2";
}
push(@$tmpref, $page_title); # tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # body
push(@$tmpref, $row[6]); # owner
push(@$tmpref, $row[7]); # user
push(@$tmpref, $row[8]); # latest
push(@$tmpref, ''); # note
push(@$tmpref, $row[9]); # handler
push(@$pagesref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_pages VALUES (?,?,?,?,?,?,?,?,?)");
foreach my $page (@$pagesref) {
$sth->execute(@$page);
}
#
# Convert links table
#
# Wacko cols: page_tag(250) referrer time
# Wikka cols: page_tag(250) referrer time
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_referrers");
$sth->execute();
my $referrersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # page_tag
push(@$tmpref, $row[1]); # referrer
push(@$tmpref, $row[2]); # time
push(@$referrersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_referrers VALUES (?,?,?)");
foreach my $referrer (@$referrersref) {
$sth->execute(@$referrer);
}
#
# Convert users table
#
# Wacko cols: name(80) password email motto revisioncount changescount
# doubleclickedit signuptime show_comments bookmarks lang
# show_spaces showdatetime typografica
# Wikka cols: name(75) password email revisioncount changescount
# doubleclickedit signuptime show_comments
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_users");
$sth->execute();
my $usersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # name
push(@$tmpref, $row[1]); # password
push(@$tmpref, $row[2]); # email
push(@$tmpref, $row[4]); # revisioncount
push(@$tmpref, $row[5]); # changescount
push(@$tmpref, $row[6]); # doubleclickedit
push(@$tmpref, $row[7]); # signuptime
push(@$tmpref, $row[8]); # signuptime
push(@$usersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_users VALUES (?,?,?,?,?,?,?,?)");
foreach my $user (@$usersref) {
eval {$sth->execute(@$user)};
if($@) { next; }
}
# Close DB
$wacko_dbh->disconnect();
$wikka_dbh->disconnect();
%%
CategoryUserContributions
CategoryDocumentation
Deletions:
This page can now be found on the [[Docs:MigratingFromWackoWiki Wikka Documentation Server]].
Thanks for updating your bookmarks!
An archive of [[http://wikkawiki.org/MigrateFromWackoWiki/revisions
old revisions of this page]] is still available for reference.<<
::c::
CategoryMigratedDocs
Additions:
An archive of [[http://wikkawiki.org/MigrateFromWackoWiki/revisions
Deletions:
Additions:
This page can now be found on the [[Docs:MigratingFromWackoWiki Wikka Documentation Server]].
An archive of [[http://wikkawiki.org/MigratingFromWackoWiki/revisions
An archive of [[http://wikkawiki.org/MigratingFromWackoWiki/revisions
Deletions:
An archive of [[http://wikkawiki.org/MigrateFromWackoWiki/revisions
Additions:
<<===This page has moved===
This page can now be found on the [[Docs:MigrateFromWackoWiki Wikka Documentation Server]].
Thanks for updating your bookmarks!
An archive of [[http://wikkawiki.org/MigrateFromWackoWiki/revisions
old revisions of this page]] is still available for reference.<<
::c::
CategoryMigratedDocs
This page can now be found on the [[Docs:MigrateFromWackoWiki Wikka Documentation Server]].
Thanks for updating your bookmarks!
An archive of [[http://wikkawiki.org/MigrateFromWackoWiki/revisions
old revisions of this page]] is still available for reference.<<
::c::
CategoryMigratedDocs
Deletions:
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
I've written the following script which makes a valiant effort to import an existing Wacko database into a newly-created Wikka database. Please note that I have tested this script only on Wacko version R3.5 and Wikka version 1.1.6.0; results may vary when using other versions.
%%(perl)
#! /usr/bin/perl
#
# wacko_import.pl: An import utility to import a Wacko site into a
# *NEWLY CREATED* Wikka site
#
# Usage: Modify the parameters at the start of the script, between the
# ### markers. Immediately after installing Wikka 1.1.6.0, execute this
# script.
#
# Notes: This script is intended to be used against a newly-created
# Wikka database, and has been tested with Wacko R3.5 and Wikka 1.1.6.
# Results with any other version might be unpredictable. Whatever you
# do, ALWAYS BACK UP YOUR DATABASE FIRST!
#
# Copyright (c) 2005 Brian Koontz <brian@pongonova.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public Licence for more details:
#
# http://www.gnu.org/copyleft/gpl.html
#
#####################################################################
use strict;
use DBI();
### Modify these ###
# Wacko DB
my $wacko_database = "wacko";
my $wacko_host = "127.0.0.1";
my $wacko_username = "wackouser";
my $wacko_password = "wacko_pass";
my $wacko_table_prefix = "wacko"; # No underscore!
# Wikka DB
my $wikka_database = "wikka";
my $wikka_host = "127.0.0.1";
my $wikka_username = "wikkauser";
my $wikka_password = "wikka_pass";
my $wikka_table_prefix = "wikka"; #No underscore!
my $RaiseError = 1;
### End modifications ###
# These pages are created by default during a Wikka install. To avoid
# conflict with existing Wacko pages with the same name, any Wacko
# page that is imported and matches one of these will have a "2"
# appended (click PageIndex to view these after importing).
my @reserved_pages = qw( HomePage RecentChanges RecentlyCommented
UserSettings PageIndex WikkaReleaseNotes WikkaDocumentation
WantedPages OrphanedPages TextSearch TextSearchExpanded MyPages
MyChanges InterWiki PasswordForgotten WikiCategory CategoryWiki
CategoryCategory FormattingRules HighScores OwnedPages SandBox );
# Connect to DBs
my $wacko_dbh = DBI->connect("DBI:mysql:database=$wacko_database; host=$wacko_host",
"$wacko_username", "$wacko_password",
{'RaiseError' => $RaiseError});
my $wikka_dbh = DBI->connect("DBI:mysql:database=$wikka_database; host=$wikka_host",
"$wikka_username", "$wikka_password",
{'RaiseError' => $RaiseError});
#
# Convert acls table
#
# Wacko cols: page_tag(250) supertag privilege list
# Wikka cols: page_tag(75) read_acl write_acl comment_acl
my $sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_acls");
$sth->execute();
my $aclref = {};
while(my @row = $sth->fetchrow_array) {
$row[3] = "+" if $row[3] =~ /\$/;
$aclref->{substr($row[0],0,75)}->{$row[2]} = $row[3];
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_acls VALUES (?,?,?,?)");
foreach(sort keys %$aclref) {
$sth->execute($_,
$aclref->{$_}->{"read"},
$aclref->{$_}->{"write"},
$aclref->{$_}->{"comment"});
}
#
# Convert comments table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id page_tag(75) time comment user
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $commentsref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
next if $row[1] !~ /^Comment/;
push(@$tmpref, ''); # id
push(@$tmpref, substr($row[10],0,75)); # page_tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # comment
push(@$tmpref, $row[7]); # user
push(@$commentsref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_comments VALUES (?,?,?,?,?)");
foreach my $comment (@$commentsref) {
$sth->execute(@$comment);
}
#
# Convert links table
#
# Wacko cols: from_tag(250) to_tag(250)
# Wikka cols: from_tag(250) to_tag(250)
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_links");
$sth->execute();
my $linksref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # from_tag
push(@$tmpref, substr($row[1],0,75)); # from_tag
push(@$linksref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_links VALUES (?,?)");
foreach my $link (@$linksref) {
$sth->execute(@$link);
}
#
# Convert pages table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id tag(75) time body owner user latest note handler
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $pagesref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, ''); # id
my $page_title = substr($row[1],0,73);
next if $page_title =~ /^Comment/; # Don't process comments as pages!
if(scalar(grep /$page_title/, @reserved_pages)) {
# Duplicate page name, so rename incoming page
$page_title .= "2";
}
push(@$tmpref, $page_title); # tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # body
push(@$tmpref, $row[6]); # owner
push(@$tmpref, $row[7]); # user
push(@$tmpref, $row[8]); # latest
push(@$tmpref, ''); # note
push(@$tmpref, $row[9]); # handler
push(@$pagesref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_pages VALUES (?,?,?,?,?,?,?,?,?)");
foreach my $page (@$pagesref) {
$sth->execute(@$page);
}
#
# Convert links table
#
# Wacko cols: page_tag(250) referrer time
# Wikka cols: page_tag(250) referrer time
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_referrers");
$sth->execute();
my $referrersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # page_tag
push(@$tmpref, $row[1]); # referrer
push(@$tmpref, $row[2]); # time
push(@$referrersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_referrers VALUES (?,?,?)");
foreach my $referrer (@$referrersref) {
$sth->execute(@$referrer);
}
#
# Convert users table
#
# Wacko cols: name(80) password email motto revisioncount changescount
# doubleclickedit signuptime show_comments bookmarks lang
# show_spaces showdatetime typografica
# Wikka cols: name(75) password email revisioncount changescount
# doubleclickedit signuptime show_comments
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_users");
$sth->execute();
my $usersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # name
push(@$tmpref, $row[1]); # password
push(@$tmpref, $row[2]); # email
push(@$tmpref, $row[4]); # revisioncount
push(@$tmpref, $row[5]); # changescount
push(@$tmpref, $row[6]); # doubleclickedit
push(@$tmpref, $row[7]); # signuptime
push(@$tmpref, $row[8]); # signuptime
push(@$usersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_users VALUES (?,?,?,?,?,?,?,?)");
foreach my $user (@$usersref) {
eval {$sth->execute(@$user)};
if($@) { next; }
}
# Close DB
$wacko_dbh->disconnect();
$wikka_dbh->disconnect();
%%
CategoryUserContributions
CategoryDocumentation
Additions:
CategoryDocumentation
Additions:
----
CategoryUserContributions
CategoryUserContributions
Additions:
I've written the following script which makes a valiant effort to import an existing Wacko database into a newly-created Wikka database. Please note that I have tested this script only on Wacko version R3.5 and Wikka version 1.1.6.0; results may vary when using other versions.
%%(perl)
#! /usr/bin/perl
#
# wacko_import.pl: An import utility to import a Wacko site into a
# *NEWLY CREATED* Wikka site
#
# Usage: Modify the parameters at the start of the script, between the
# ### markers. Immediately after installing Wikka 1.1.6.0, execute this
# script.
#
# Notes: This script is intended to be used against a newly-created
# Wikka database, and has been tested with Wacko R3.5 and Wikka 1.1.6.
# Results with any other version might be unpredictable. Whatever you
# do, ALWAYS BACK UP YOUR DATABASE FIRST!
#
# Copyright (c) 2005 Brian Koontz <brian@pongonova.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public Licence for more details:
#
# http://www.gnu.org/copyleft/gpl.html
#
#####################################################################
use strict;
use DBI();
### Modify these ###
# Wacko DB
my $wacko_database = "wacko";
my $wacko_host = "127.0.0.1";
my $wacko_username = "wackouser";
my $wacko_password = "wacko_pass";
my $wacko_table_prefix = "wacko"; # No underscore!
# Wikka DB
my $wikka_database = "wikka";
my $wikka_host = "127.0.0.1";
my $wikka_username = "wikkauser";
my $wikka_password = "wikka_pass";
my $wikka_table_prefix = "wikka"; #No underscore!
my $RaiseError = 1;
### End modifications ###
# These pages are created by default during a Wikka install. To avoid
# conflict with existing Wacko pages with the same name, any Wacko
# page that is imported and matches one of these will have a "2"
# appended (click PageIndex to view these after importing).
my @reserved_pages = qw( HomePage RecentChanges RecentlyCommented
UserSettings PageIndex WikkaReleaseNotes WikkaDocumentation
WantedPages OrphanedPages TextSearch TextSearchExpanded MyPages
MyChanges InterWiki PasswordForgotten WikiCategory CategoryWiki
CategoryCategory FormattingRules HighScores OwnedPages SandBox );
# Connect to DBs
my $wacko_dbh = DBI->connect("DBI:mysql:database=$wacko_database; host=$wacko_host",
"$wacko_username", "$wacko_password",
{'RaiseError' => $RaiseError});
my $wikka_dbh = DBI->connect("DBI:mysql:database=$wikka_database; host=$wikka_host",
"$wikka_username", "$wikka_password",
{'RaiseError' => $RaiseError});
#
# Convert acls table
#
# Wacko cols: page_tag(250) supertag privilege list
# Wikka cols: page_tag(75) read_acl write_acl comment_acl
my $sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_acls");
$sth->execute();
my $aclref = {};
while(my @row = $sth->fetchrow_array) {
$row[3] = "+" if $row[3] =~ /\$/;
$aclref->{substr($row[0],0,75)}->{$row[2]} = $row[3];
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_acls VALUES (?,?,?,?)");
foreach(sort keys %$aclref) {
$sth->execute($_,
$aclref->{$_}->{"read"},
$aclref->{$_}->{"write"},
$aclref->{$_}->{"comment"});
}
#
# Convert comments table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id page_tag(75) time comment user
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $commentsref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
next if $row[1] !~ /^Comment/;
push(@$tmpref, ''); # id
push(@$tmpref, substr($row[10],0,75)); # page_tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # comment
push(@$tmpref, $row[7]); # user
push(@$commentsref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_comments VALUES (?,?,?,?,?)");
foreach my $comment (@$commentsref) {
$sth->execute(@$comment);
}
#
# Convert links table
#
# Wacko cols: from_tag(250) to_tag(250)
# Wikka cols: from_tag(250) to_tag(250)
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_links");
$sth->execute();
my $linksref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # from_tag
push(@$tmpref, substr($row[1],0,75)); # from_tag
push(@$linksref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_links VALUES (?,?)");
foreach my $link (@$linksref) {
$sth->execute(@$link);
}
#
# Convert pages table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id tag(75) time body owner user latest note handler
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $pagesref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, ''); # id
my $page_title = substr($row[1],0,73);
next if $page_title =~ /^Comment/; # Don't process comments as pages!
if(scalar(grep /$page_title/, @reserved_pages)) {
# Duplicate page name, so rename incoming page
$page_title .= "2";
}
push(@$tmpref, $page_title); # tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # body
push(@$tmpref, $row[6]); # owner
push(@$tmpref, $row[7]); # user
push(@$tmpref, $row[8]); # latest
push(@$tmpref, ''); # note
push(@$tmpref, $row[9]); # handler
push(@$pagesref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_pages VALUES (?,?,?,?,?,?,?,?,?)");
foreach my $page (@$pagesref) {
$sth->execute(@$page);
}
#
# Convert links table
#
# Wacko cols: page_tag(250) referrer time
# Wikka cols: page_tag(250) referrer time
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_referrers");
$sth->execute();
my $referrersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # page_tag
push(@$tmpref, $row[1]); # referrer
push(@$tmpref, $row[2]); # time
push(@$referrersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_referrers VALUES (?,?,?)");
foreach my $referrer (@$referrersref) {
$sth->execute(@$referrer);
}
#
# Convert users table
#
# Wacko cols: name(80) password email motto revisioncount changescount
# doubleclickedit signuptime show_comments bookmarks lang
# show_spaces showdatetime typografica
# Wikka cols: name(75) password email revisioncount changescount
# doubleclickedit signuptime show_comments
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_users");
$sth->execute();
my $usersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # name
push(@$tmpref, $row[1]); # password
push(@$tmpref, $row[2]); # email
push(@$tmpref, $row[4]); # revisioncount
push(@$tmpref, $row[5]); # changescount
push(@$tmpref, $row[6]); # doubleclickedit
push(@$tmpref, $row[7]); # signuptime
push(@$tmpref, $row[8]); # signuptime
push(@$usersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_users VALUES (?,?,?,?,?,?,?,?)");
foreach my $user (@$usersref) {
eval {$sth->execute(@$user)};
if($@) { next; }
}
# Close DB
$wacko_dbh->disconnect();
$wikka_dbh->disconnect();
%%
%%(perl)
#! /usr/bin/perl
#
# wacko_import.pl: An import utility to import a Wacko site into a
# *NEWLY CREATED* Wikka site
#
# Usage: Modify the parameters at the start of the script, between the
# ### markers. Immediately after installing Wikka 1.1.6.0, execute this
# script.
#
# Notes: This script is intended to be used against a newly-created
# Wikka database, and has been tested with Wacko R3.5 and Wikka 1.1.6.
# Results with any other version might be unpredictable. Whatever you
# do, ALWAYS BACK UP YOUR DATABASE FIRST!
#
# Copyright (c) 2005 Brian Koontz <brian@pongonova.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public Licence for more details:
#
# http://www.gnu.org/copyleft/gpl.html
#
#####################################################################
use strict;
use DBI();
### Modify these ###
# Wacko DB
my $wacko_database = "wacko";
my $wacko_host = "127.0.0.1";
my $wacko_username = "wackouser";
my $wacko_password = "wacko_pass";
my $wacko_table_prefix = "wacko"; # No underscore!
# Wikka DB
my $wikka_database = "wikka";
my $wikka_host = "127.0.0.1";
my $wikka_username = "wikkauser";
my $wikka_password = "wikka_pass";
my $wikka_table_prefix = "wikka"; #No underscore!
my $RaiseError = 1;
### End modifications ###
# These pages are created by default during a Wikka install. To avoid
# conflict with existing Wacko pages with the same name, any Wacko
# page that is imported and matches one of these will have a "2"
# appended (click PageIndex to view these after importing).
my @reserved_pages = qw( HomePage RecentChanges RecentlyCommented
UserSettings PageIndex WikkaReleaseNotes WikkaDocumentation
WantedPages OrphanedPages TextSearch TextSearchExpanded MyPages
MyChanges InterWiki PasswordForgotten WikiCategory CategoryWiki
CategoryCategory FormattingRules HighScores OwnedPages SandBox );
# Connect to DBs
my $wacko_dbh = DBI->connect("DBI:mysql:database=$wacko_database; host=$wacko_host",
"$wacko_username", "$wacko_password",
{'RaiseError' => $RaiseError});
my $wikka_dbh = DBI->connect("DBI:mysql:database=$wikka_database; host=$wikka_host",
"$wikka_username", "$wikka_password",
{'RaiseError' => $RaiseError});
#
# Convert acls table
#
# Wacko cols: page_tag(250) supertag privilege list
# Wikka cols: page_tag(75) read_acl write_acl comment_acl
my $sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_acls");
$sth->execute();
my $aclref = {};
while(my @row = $sth->fetchrow_array) {
$row[3] = "+" if $row[3] =~ /\$/;
$aclref->{substr($row[0],0,75)}->{$row[2]} = $row[3];
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_acls VALUES (?,?,?,?)");
foreach(sort keys %$aclref) {
$sth->execute($_,
$aclref->{$_}->{"read"},
$aclref->{$_}->{"write"},
$aclref->{$_}->{"comment"});
}
#
# Convert comments table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id page_tag(75) time comment user
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $commentsref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
next if $row[1] !~ /^Comment/;
push(@$tmpref, ''); # id
push(@$tmpref, substr($row[10],0,75)); # page_tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # comment
push(@$tmpref, $row[7]); # user
push(@$commentsref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_comments VALUES (?,?,?,?,?)");
foreach my $comment (@$commentsref) {
$sth->execute(@$comment);
}
#
# Convert links table
#
# Wacko cols: from_tag(250) to_tag(250)
# Wikka cols: from_tag(250) to_tag(250)
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_links");
$sth->execute();
my $linksref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # from_tag
push(@$tmpref, substr($row[1],0,75)); # from_tag
push(@$linksref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_links VALUES (?,?)");
foreach my $link (@$linksref) {
$sth->execute(@$link);
}
#
# Convert pages table
#
# Wacko cols: id tag(250) supertag(250) time body body_r owner user
# latest handler comment_on
# Wikka cols: id tag(75) time body owner user latest note handler
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_pages");
$sth->execute();
my $pagesref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, ''); # id
my $page_title = substr($row[1],0,73);
next if $page_title =~ /^Comment/; # Don't process comments as pages!
if(scalar(grep /$page_title/, @reserved_pages)) {
# Duplicate page name, so rename incoming page
$page_title .= "2";
}
push(@$tmpref, $page_title); # tag
push(@$tmpref, $row[3]); # time
push(@$tmpref, $row[4]); # body
push(@$tmpref, $row[6]); # owner
push(@$tmpref, $row[7]); # user
push(@$tmpref, $row[8]); # latest
push(@$tmpref, ''); # note
push(@$tmpref, $row[9]); # handler
push(@$pagesref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_pages VALUES (?,?,?,?,?,?,?,?,?)");
foreach my $page (@$pagesref) {
$sth->execute(@$page);
}
#
# Convert links table
#
# Wacko cols: page_tag(250) referrer time
# Wikka cols: page_tag(250) referrer time
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_referrers");
$sth->execute();
my $referrersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # page_tag
push(@$tmpref, $row[1]); # referrer
push(@$tmpref, $row[2]); # time
push(@$referrersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_referrers VALUES (?,?,?)");
foreach my $referrer (@$referrersref) {
$sth->execute(@$referrer);
}
#
# Convert users table
#
# Wacko cols: name(80) password email motto revisioncount changescount
# doubleclickedit signuptime show_comments bookmarks lang
# show_spaces showdatetime typografica
# Wikka cols: name(75) password email revisioncount changescount
# doubleclickedit signuptime show_comments
$sth = $wacko_dbh->prepare("SELECT * FROM ${wacko_table_prefix}_users");
$sth->execute();
my $usersref = [];
while(my @row = $sth->fetchrow_array) {
my $tmpref = [];
push(@$tmpref, substr($row[0],0,75)); # name
push(@$tmpref, $row[1]); # password
push(@$tmpref, $row[2]); # email
push(@$tmpref, $row[4]); # revisioncount
push(@$tmpref, $row[5]); # changescount
push(@$tmpref, $row[6]); # doubleclickedit
push(@$tmpref, $row[7]); # signuptime
push(@$tmpref, $row[8]); # signuptime
push(@$usersref, $tmpref);
}
$sth = $wikka_dbh->prepare("INSERT INTO ${wikka_table_prefix}_users VALUES (?,?,?,?,?,?,?,?)");
foreach my $user (@$usersref) {
eval {$sth->execute(@$user)};
if($@) { next; }
}
# Close DB
$wacko_dbh->disconnect();
$wikka_dbh->disconnect();
%%
Deletions:
----
OK, I lied...there are a few other changes that need to be made. You will find that the Login link no longer works on your newly upgraded wiki (presumably because Wacko uses separate login and register actions). You'll be given the opportunity to edit this page...enter the following as the page contents:
<<%%(html) {{UserSettings}}{{nocomments}}
----
CategoryWiki%%
<<
::c::
Also, you'll need to add the following page contents to your Categories page:
<<%%(html) ===List of All Categories===
Below is the list of all Categories existing on this Wiki, granted that users did things right when they created their pages or new Categories. See WikiCategory for how the system works.
----
{{Category}}%%
<<
::c::
When you're through, you'll probably want to lock down the permissions on these pages so they aren't editable.
----
I've not completed a thorough inspection of the new site yet, but it appears to be intact. Your mileage may vary, void where prohibited. Tested with WikkaWiki 1.1.6.0 and WackoWiki R3.5. I'm sure there's an easier way!
Revision [12234]
Edited on 2005-12-12 10:06:56 by NilsLindenberg [moved to a more descriptive title]Additions:
=====Migrating from Wackowiki to Wikkawiki=====
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
{{color text="BACKUP YOUR DATABASE BEFORE UPGRADING!!!" c="red"}}
Deletions:
=====BACKUP YOUR DATABASE BEFORE UPGRADING!!!=====