[Instiki] Poking in storage

Alexey Verkhovsky alex at verk.info
Sun May 29 13:08:59 EDT 2005


Hi all,

I've written some script to help people poke around in the Madeleine 
storage. It will be included in the 0.10.2 release, but it works with 
any earlier 0.10 version (including the current Instiki trunk, of 
course). You can get it at

http://svn.instiki.org/instiki/trunk/script/debug_storage

and copy to your instiki/script directory.

Two caveats:
1. You MUST be a reasonably good Ruby programmer to use it successfully 
for anything non-trivial.
2. It's very easy to screw up something by poking in the storage 
internals. If you do, please undo your changes by deleting the most 
recent snapshot(s) and don't ask for help.

Usage example:

E:\eclipse\workspace\instiki\script>irb
irb(main):001:0> load 'debug_storage'
Enter path to storage [E:/eclipse/workspace/instiki/storage/2500]:
Loading storage from the default storage path 
(E:/eclipse/workspace/instiki/storage/2500)
Instiki storage from E:/eclipse/workspace/instiki/storage/2500 is loaded.
Access it a global variable $wiki.
Happy poking!
=> true
irb(main):003:0> $wiki.system
=> {"password"=>"foo"}
irb(main):005:0> $wiki.system['password'] = 'bar'
=> "bar"
irb(main):006:0> $wiki.webs.keys
=> ["wiki1", "wiki2"]
irb(main):007:0> $wiki.webs['wiki1'].password = 'the_password'
=> "the_password"
irb(main):008:0> WikiService::snapshot
=> []


Things that are possible:

# cleaning old revisions
$wiki.webs['wiki'].pages['HomePage'].revisions = 
$wiki.webs['wiki'].pages['HomePage'].revisions[-1..-1]

# Changing contents of a revision
$wiki.webs['wiki'].pages['HomePage'].revisions[-1] = 'new content'

# Checking that all pages can be rendered by the markup engine
$wiki.webs['wiki'].pages.each_pair do |name, page|
  page.revisions.each_with_index do |revision, i|
    begin
      revision.display_content
    rescue =>
      puts "Error when rendering revision ##{i} of page #{name.inspect}:"
      puts e.message
      puts e.backtrace.join("\n")
    end
end


-- 
Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby-forum.org        (moderator)
RForum:     http://rforum.andreas-s.net  (co-author)
Instiki:    http://instiki.org           (maintainer)



More information about the Instiki-users mailing list