I am going to develop a tool which fulfills the function of OrphanBot, but using a local database. Far less overhead. I'll post updates to the status of that as things happen. [gg] 2006-12-30 ---- This is now the dedicated page for the bot. The code is below. [gg] ---- I have set up this page with the intention of creating a bot which will automatically search the wiki for orphaned pages. I am already working on the bot now. It will probably have a dedicated page soon. [gg] ---- '''NOTE: This code should not to be run, especially not against the Tcl'ers wiki. Make sure you know what you are doing before running this code, since it is going to consume huge lots of web traffic if you are not careful.''' #!/usr/bin/env tclsh # # OrphanBot # ---- # Finds orphaned pages on a Wikit style wiki. # set base "http://invalid.host.name" # memoize proc - taken from http://wiki.tcl.tk/memoizing proc memoize {} { global memo set cmd [info level -1] if {[info level] > 2 && [lindex [info level -2] 0] eq "memoize"} return if { ! [info exists memo($cmd)]} {set memo($cmd) [eval $cmd]} return -code return $memo($cmd) } # range proc - taken from http://wiki.tcl.tk/for proc range {from "to:" to} { set res [list] for {set i $from} {$i<=$to} {incr i} {lappend res $i} set res } proc getPage {id} { memoize return ::http::data [::http::geturl "$base/references/$id!"] } proc pageExists {id} { if {$id == 2} { return 1 } if [regexp "References to Search" [getPage $id]] { return 0 } { return 1 } } proc isOrphaned {id} { if [pageExists $id] { if [regexp "" [getPage $id]] { return 1 } } return 0 } proc findOrphans {maxId {$minId 0}} { foreach id [range $minId .. $maxId] { if [isOrphaned $id] { puts "Orphan found: $i" } } }