[Instiki] Stranded with 0.10.2 on MacOS X

Mark Beattie beattie.mark at gmail.com
Mon May 15 23:33:40 EDT 2006

Sounds like you're having a really rough time upgrading. Following are my 
notes from my upgrade to 0.11. They're very long, but they cover how to 
export your current storage as SQL that can be imported into 0.11's 
ActiveRecord DB storage. Hope it helps:

Backup the existing wiki 
Export as markup?
save the stylesheet tweaks somewhere
Checkout the svn trunk:
svn co http://svn.instiki.org/instiki/trunk instiki

Create a database (My SQL?:)
mysql -p
create database wiki;

create a database.yml file:
Place this in config/database.yml:
  adapter: mysql
  database: wiki
  username: root
  socket: /var/run/mysqld/mysqld.sock

  adapter: mysql
  database: wiki
  username: root
  socket: /var/run/mysqld/mysqld.sock

  adapter: mysql
  database: wiki
  username: root
  socket: /var/run/mysqld/mysqld.sock

import the DB schema:
rake migrate

check that it works:
Use ”./instiki -e development” on the development machine
# ./instiki
=> Instiki started on
=> Ctrl-C to shutdown; call with --help for options
[2006-03-07 20:40:35] INFO  WEBrick 1.3.1
[2006-03-07 20:40:35] INFO  ruby 1.8.2 (2005-04-11) [i386-linux]
[2006-03-07 20:40:35] INFO  WEBrick::HTTPServer#start: pid=10544 port=2500

Migrate the 0.10 storage to 0.11 database:
(Debian Sarge, gem installation) 
Create some symlinks in the 0.10.2 gem installation:
# su
# cd /usr/lib/ruby/gems/1.8/gems/instiki-0.10.2/
# mkdir vendor
# cd vendor/
# ln -s ../../madeleine-0.7.1 madeleine-0.7.1
# ln -s ../../RedCloth-3.0.3 RedCloth-3.0.3
# ln -s ../../RedCloth-3.0.4 RedCloth-3.0.4
# ln -s ../../rubyzip-0.5.8 rubyzip-0.5.8

Export the 0.10.2 storage as SQL
In the directory Instiki was checked out run:
ruby scriptimport_storage 
-t /full/path/to/instiki0.10/storage 
-i /full/path/to/instiki0.10/installation 
-d mysql 
-o instiki_import.sql

Eg: ruby script/import_storage -t /var/www/instiki/storage/2500 
-i /usr/lib/ruby/gems/1.8/gems/instiki-0.10.2 -d mysql -o 

Import the SQL
# su
# mysql -p
mysql> connect wiki
mysql> source instiki_0.10.2_import.sql

Execute ruby script/reset_references
$ ruby script/reset_references

Check that it still works
In my case, the pages seemed to have come across OK, but the stylesheet tweaks 
had mostly been lost. Probably safest to back them up first and then apply 
them again afterwards.
Cleaning up 
Bug in the migration file
Line 48 of db/schema.rb says:
    t.column "additional_style", :string

additional_style stores the stylesheet tweaks, and creating it as a string 
will limit the number of characters you can enter. To change it the hard way:
# su
# mysql -p
mysql> connect wiki
mysql> ALTER TABLE `webs` CHANGE `additional_style` `additional_style` TEXT 

Then you’re almost able to save stylesheet tweaks, but first some bugs in the 
Wiki.authenticate method need to be remedied
Bug in the Wiki.authenticate method
from app/models/wiki.rb:
  def authenticate(password)
    password == (system.password || 'instiki')

Hey that’s real secure! Let’s just all go and edit each other’s wiki’s using 
“instiki” as the password. Besides that, after the migration process, the 
‘system’ table was left empty, meaning that the original system password has 
been lost.
To create a new system password:
# script/console
system = System.new
system.password = "(new password)" 

You’d still want to change that line in wiki.rb to:
    password == system.password

No idea why it didn’t come across in the migration though.

Mark Beattie

More information about the Instiki-users mailing list