'''"WhipIt"''' - Wikit run in a Slave Interpreter on TclHttpd Since I read the comments below this became an itch I just had to scratch! [Jeff Smith] Extracted from the [How to grow your own Wiki] page. ''[MDD]: What would be really nice would be if someone would create a Starkit that combines tclhttpd and the wikit into one turnkey wiki server. Performance should be better, since you wouldn't have to use CGI.'' ''11apr03 [jcw] - Yes, that would be cool, but it may need some work (either to make it properly keep state with repeated requests, or '''to make it work in a slave interp which gets re-inited on each access''').'' To try '''"WhipIt"''' create a directory and place in it whipit.kit, available from [http://www.freewebs.com/headsup/whipit.kit]. Download wikit.kit from [http://www.equi4.com/pub/sk/wikit.kit] and place this in the same directory. To launch on unix # ./tclkit whipit.kit On Windows from a dos window C:\tclkitsh whipit.kit from windows explorer drag and release whipit.kit on tclkit Point your browser to http://yourhost:8015/wikit/ [BAJ] uses whipit and finds it very useful, but just discovered that the history feature of wikit (enabled with "WIKIT_HIST" is broken by whipit (the puts that should write to a disk file ends up being remapped to the WktCGI_Puts command in script below). [Jeff Smith] 22 November 2004 - Thanks for the report! I have never used the history feature. If you have a fix can you post it here? [BAJ] 22 November 2004 - I think I have a fix now that involves only aliasing the "cgi_puts" command. I'll do a little more testing and then post it. [Jeff Smith] 30 June 2005 - I have adjusted the code and now history and caching are working. This is reflected in the code below. The code below is in the custom directory inside the whipit.kit starkit. To enable history or caching you need to unwrap the starkit and adjust the code to suit. ***************** whipit.tcl ******************************** # Create a cache and hist directory incase it is needed. file mkdir [file dir $starkit::topdir]/cache file mkdir [file dir $starkit::topdir]/hist set WktDir [file dir $starkit::topdir]/wikit.kit if {[file exists $WktDir]} { # Mount the wikit startkit vfs::mk4::Mount [file dir $starkit::topdir]/wikit.kit [file dir $starkit::topdir]/wikit.kit # Append wikit library from the mounted wikit starkit to the auto_path lappend auto_path [file dir $starkit::topdir]/wikit.kit/lib } Url_PrefixInstall /wikit [list wikitProc /wikit] proc wikitProc {prefix sock suffix} { upvar #0 Httpd$sock data global env auto_path WktDir # Set the CGI environment variables Cgi_SetEnv $sock $prefix set env(PATH_INFO) $suffix # Various WIKIT environment variables are set # This sets the WIKIT_BASE environment variable dynamically based on # the host portion of the url typed in the browser. This is good if # you are not going to have caching enabled. If caching will be # enabled I would set it to an IP address or FQDN Hostname. set env(WIKIT_BASE) http://$env(HTTP_HOST)$prefix/ # Uncomment the following if caching or history is required # set env(WIKIT_HIST) [file dir $starkit::topdir]/hist # set env(WIKIT_CACHE) [file dir $starkit::topdir]/cache # This sets the WIKIT_CSS environment variable # set env(WIKIT_CSS) /whipit2-css.css append data(query) "" # Use the Session Module in TclHttpd to create a slave interpreter. # A session state array is also created but we don't use it. This # maybe of some use if you have a need for a session based wiki. # # To emulate a CGI environment for Wikit, a slave interpreter is created # and then destroyed per request. # Destroy any old sessions that are laying around. Interpreters that have # been created but for some reason not destroyed. In this instance # 2 minutes is the setting. Session_Reap 120 Wkt # Create a new session. set session [Session_Create Wkt 0] if {![file exists $WktDir]} { append NoWikit "