View source for WikkaWiki Migration

Migrate WikkaWiki instances to WackoWiki.

{{toc numerate=1}}

((https://github.com/bakoontz/WikkaWiki GitHub: WikkaWiki))
  * ((https://github.com/bakoontz/WikkaWiki/blob/master/sql/Wikka_default.sql Wikka_default.sql))
http://www.wikkawiki.org/HomePage
http://docs.wikkawiki.org/HomePage
  * ((http://docs.wikkawiki.org/WikkaTableStructure Wikka Table Structure))
  * ((http://docs.wikkawiki.org/TextFormatting Wikka Text Formatting))

====Database====
file:physical_current_x.png

((/Dev/Release/R6.1/Database))
file:/Dev/Release/R6.1/Database/a_schematic_of_wackowiki_r6.1_database_structure.png

Create a backup.

Install a new WackoWiki instance in the same database.

====Action====
##~{{wikkawiki_migration}}##

Both installations should be in the same database, each installation has a distinct table prefix, e.g. ##wikka_## or ##wacko_##.
%%
{{wikkawiki_migration
  wikka_prefix="wikka_"
  option1=0
  option2=1
  etc...
}}
%%

====Tables====
  1. Loop through ##users## -> create user
    * see registration action
    * create a random password and let the user reset his password
  1. Loop through ##pages## with ##latest## Y -> create page
    * lookup ##user_id## and ##owner_id## in user table
    * ##""save_page($tag, $body, $title = '', $edit_note = '', $minor_edit = false, $reviewed = 0, $comment_on_id = 0, $parent_id = 0, $lang = '', $mute = false, $user_name = '', $user_page = false)""##
    * add marker field ##converted## to track which record has already been converted
  1. Loop through ##pages## with ##latest## N -> create revision
    * lookup ##page_id##
    * lookup ##user_id## and ##owner_id## in user table
    * ##save_revision(array $page)##
    * add marker field converted to track which record has already been converted
  1. Loop through ##comments## -> create page with ##comment_on_id##
    * lookup ##comment_on_id##
    * sort comments by time and set ##tag## as ##'Comment' . $i++##
    * ##save_page()##
  1. Loop through ##acls## -> update acl record
    * lookup ##page_id##
    * replace ##+## with ##$##
    * ##save_acl($page_id, $privilege, $list)##

Wikka tabels
  * pages
  * users
  * comments
  * acls

The Routine should implement a batch option to prevent a server timeout, e.g. process only [10, 50, 100] records at once.

Avoid SQL roundtrips by caching the page_id and user_id arrays as object, if necessary to session.

Which pages should be skiped or renamed?
  * naming conficts with default installation
  * obsolete system pages

====Syntax====
Loop through each record in ##page## and ##revision## table and convert and update ##body## and set ##converted## to 1, 2, 3.

%%(php)
<?php

$data = $this->format($this->page['body'], 'wikka2wacko');
%%

  * ##""++Strike through text++""## to ##""--Strike through text--""##
  * ##""''highlight text''""## to ##""!!highlight text!!""##
  * ##""======""## to ##""==""## (requiers ##@@@## transition placeholder to avoid double replacements)
  * ##""=====""## to ##""===""##
  * ##""====""## to ##""====""##
  * ##""===""## to ##""=====""##
  * ##""==""## to ##""======""##
  * ##""~""## to ##  ## (2 spaces)
  * ##""~~""## to ##    ## (4 spaces)
  * ##""~-""## to ##  *## (2 spaces)
  * ##""~1)""## to ##  1.## (2 spaces)
  * ##""~a)""## to ##  a.## (2 spaces)
  * ##""~A)""## to ##  A.## (2 spaces)
  * ##""~i)""## to ##  i.## (2 spaces)
  * ##""~I)""## to ##  I.## (2 spaces)
  * ##""~& Comment""## to ##"">  Comment""##
  * ##""~~& Subcomment""## to ##"">>  Comment""##
  * ##""~~~& Subsubcomment""## to ##"">>>  Comment""##
  * ##""[[SandBox | Test your formatting skills]]""## to ##""[[SandBox Test your formatting skills]]""##
  * ##""[[http://example.com | Home Page]]""## to ##""[[http://example.com Home Page]]""##

and so on...

See Latex formatter for conversion examples of page ##body##.

Advanced tables and actions probably require an extra mapping. 

The ##admin_replace## or the ##admin_massregex## action can be used here.

=====Actions=====
action to syntax
  * image
  * color
  * table

special cases
  * ##""{{{action}}}""## to ""{{action}}""

In some cases a replacement can be mapped and replaced with the WackoWiki equivalent action.
Some action can be backported to WackoWiki.
=====Formatters=====
  * ##~""[html code]~""## to ##""<[HTML code]>""##
  * ##""<< left floating box <<""## to wacko wrapper box model
  * ##"">> right floating box >>""##



Note:  This might be a good opportunity to implement a wikka markup formatter.  Multiple formatters for different markups would be a nice addition and would allow for manual migration of discrete pages as well.
  ((user:WikiAdmin WikiAdmin)): The difficulties arise as soon as it comes to actions, WikiEdit and templates.

====ACLs====
  * replace ##+## with ##$## (registered users)

====Uploads & Media====
What about uploads?

Uploads must be re-uploaded and possibly re-embedded via the ##file:## syntax.

Wikkawiki uses here a ##image## action which must be replaced.
  * local media
  * external media

====Finish====
Reparse all pages via the admin panel.

Drop ##converted## field again from ##page## and ##revision## table.

====Wikka Default Theme====
Backport WikkaWiki default theme to WackoWiki.