All the pages with newsNN should be checked and reverted to previous versions.
Last updated at 4:04 pm UTC on 2 November 2005
Does anyone have a script for this. It is very tedious to do it manually, but I don't know how to write scripts to modify the wiki.
Here's a script I hacked together. It only reverts to the previous version, so if two vandals have modified a page, the result is not what you want to see...
(3 to: 8), #(10 11 13 16 17 19 21 22) do: [:id |
url := 'http://minnow.cc.gatech.edu/squeak/', id printString.
doc := (url, '.history') asUrl retrieveContents.
parsed := HtmlParser parse: (ReadStream on: doc content).
body := parsed contents at: 2.
form := body contents at: 15.
button := form contents at: 2.
version := button getAttribute: 'value'.
Transcript cr; show: id printString, ': retrieved history, last version = ', version; cr.
doc2 := (url, '.version') asUrl retrieveContentsArgs: (Dictionary new
at: 'id' put: (Array with: version);
at: 'submit' put: (Array with: version);
yourself).
parsed2 := HtmlParser parse: (ReadStream on: doc2 content).
body2 := parsed2 contents at: 2.
title := ((body2 contents at: 10) contents at: 1) text.
title := title copyFrom: 1 to: title size - 11 - version size.
text := (((body2 contents at: 17) contents at: 4) contents at: 1) text.
Transcript show: 'retrieved last version, title = ', title; cr.
doc3 := (url, '.edit') asUrl retrieveContents.
parsed3 := HtmlParser parse: (ReadStream on: doc3 content).
body3 := parsed3 contents at: 2.
edittime := ((body3 contents at: 10) contents at: 2) getAttribute: 'value'.
Transcript show: 'retrieved edittime'; cr.
postArgs := Dictionary new.
postArgs at: 'edittime' put: (Array with: edittime).
postArgs at: 'name' put: (Array with: title).
postArgs at: 'text' put: (Array with: text).
(url, '.save') asUrl postFormArgs: postArgs.
Transcript show: 'saved.'; cr].