Wikitool is a script to get information from the wikit metakit data file from the command line.
It's special because it is coded in pure Tcl.
See http://www.equi4.com/pub/sk/wikitool.tcl
To use this tool, cd into the directory where you have a wikit.tkd file - that's the data portion of the wikit. Then, execute wikitool.tcl -l . Be certain that you get the most current copy - as mentioned above, previous versions are not likely to work.
The results you get is stdout containing lines such as:
10: 2002/06/19 06:45:26 80.126.24.9 Jean-Claude Wippler
The format is:
Field: 1 2 3 4 5
page-number: last-update-date last-update-time last-updater's-IP page-title
14apr03 [jcw] - There's another far more sophisticated "wikitool" by Tom Krehbiel, it's on [sdarchive]. ''Might be an idea to rename this thing to "wikiutil" or some such, just to avoid confusion...''
----
'''Using Tom Krehbiels wikitool as CGI in tclhttpd'''
7 October 2003: I'd like to use the wikitool from Tom Krehbiel as a CGI. To maintain my own wiki which runs as a CGI inside my local [tclhttpd].
To do this, you have to adapt the "wikitool.kit" (found on http://mini.net/sdarchive/wikitool.kit), to avoid a "package require Tk". So do an:
sdx unwrap wikitool.kit
and then
* in "main.tcl" surround "wm withdraw ." with a catch
* and in "lib/wikit.vfs/lib/wikit/wikit.tcl" surround "package require Tk" with a catch and remove or uncomment the "exit .." in case of a failure of "package require Wikit::Gui"
wrap it up again:
sdx wrap wikitool.kit
Furthermore you can use the following "wikitool_admin.cgi"-script and place it into your cgi-bin.
#!/bin/sh
# \
exec tclsh84 "$0" ${1+"$@"}
source cgilib.tcl
# available commands
set cmds {
pages,report
pages,out
pages,html
pages,index
pages,add
pages,update
pages,fix
images,report
images,add
images,update
images,out
xref,refs
xref,page@page
xref,page2image
xref,image2page
sweep,report
sweep,mark
sweep,unmark
sweep,clean
defrag
}
# little "Vignette"-like wrapper ... ugh
proc SHOW {var} {
upvar $var _var
return [expr {[info exists _var] ? "$_var" : ""}]
}
# build up a select-box for all commands
proc showCommands {cmds selected} {
set result {}
foreach cmd $cmds {
append result ""
}
return $result
}
# initialize query-parameters to variable values
foreach {key value} [Cgi_List] {
set $key $value
}
if {![info exists commands]} {
set commands [lindex $cmds 0]
}
puts "Content-Type: text/html"
puts ""
puts [subst {
Result:
}]
# call the wikitool with given parameters
# set cmd "| tclkitsh.exe wikitool.kit wikit.tkd pages report"
if {[info exists database]} {
foreach {command subcommand} [split [SHOW commands] ,] {break}
set cmd "| tclkitsh wikitool.kit $database $command $subcommand [SHOW arguments]"
# for the defragmention we pass "y" the query "really defrag (y/n)"
if {$command == "defrag"} {
append cmd " << y"
}
puts "Executing: $cmd"
if {[catch {open $cmd} fh] } {
puts "Error: Can't open pipe. $fh"
}
set PIPE $fh
fconfigure $PIPE -buffering none
set OUTPUT ""
puts "
"
catch {close $PIPE} msg
}
puts " [SHOW cmd] finished."
exit 0
* Place this script into the cgi-bin of your tclhttpd and place the "wikitool.kit" there as well.
* Furthermore you need the tclkitsh-program lying around somewhere in your path.
* Now take your wiki-data file (I assume "wikit.tkd") and place it into the cgi-bin-directory as well.
* go to http:///cgi-bin/wikitool_admin.cgi
* Enter "wikit.tkd" as the "Database", choose "pages report" and GO
Pay attention that now everybody who can access your webserver can administrate your wiki, so you
should consider some security-mechanisms.
Have fun [Stefan Vogel].
''... I just tried this code with tclhttpd and am unable to see the output from wikitool, which I expected from 'puts $DATA' - just several empty lines. The cgi script is working, as I am able to duplicate the command execution code above within the wikitool_admin.cgi file and successfully execute and see the result from that command. I've tried it on IRIX and Linux platforms - is there something simple I'm missing? Thanks in advance for taking the time to respond.''
28 Mai 2004: [Stefan Vogel] I just tested that again (I had some problems with my own description, so I updated a few things). It works well at least on Windows XP. Have you adapted the "wikitool.kit" (because that uses Tk)?
Does
%..cgi-bin> tclkitsh wikitool.kit wikit.tkd pages report
puts something on the console? ''...yes, it gives the correct output, but ... you were astute in asking me to check whether I had made the changes to wikitool. I had made the changes, but accidently copied the original wikitool.kit into cgi-bin instead of the modified version. I have it working now, just as you described it. Thanks again for your help!''
----
'''How do you use Tom Krehbiels wikitool.kit ?'''
Are there any explanatory notes for wikitool.kit commands/parameters? Yes...
Run wikitool.kit in TK GUI mode and see command descriptions. If you are running wikitool.kit with the ''catch {tk}'' mods, wikitool_admin.cgi by Stefan Vogel ''(see above)'', through CGI, you won't see the command help! [CvK]
----
[Category Wikit]