Latest changes

This commit is contained in:
Alexander Yakovlev 2017-03-05 14:16:32 +07:00
parent ed2d9c68bd
commit 93c56fdb84
2 changed files with 10 additions and 5 deletions

View file

@ -1,6 +1,8 @@
#!/usr/bin/ruby
require './Wiki.rb'
#TODO: don't tag the category pages and redirects
config = YAML::load_file(File.join(__dir__, 'config.yaml'))
config["sites"].each do |site|
wiki = Wiki.new(site["url"], site["username"], site["password"], config["dummy"])

13
undo.rb
View file

@ -2,10 +2,14 @@
require './Wiki.rb'
def rollback(wiki, title)
wiki.client.action :rollback,
title: title,
token_type: :rollback,
user: 'Enadmin'
begin
wiki.client.action :rollback,
title: title,
token_type: :rollback,
user: 'Enadmin'
rescue
puts title
end
end
config = YAML::load_file(File.join(__dir__, 'config.yaml'))
@ -16,7 +20,6 @@ config["sites"].each do |site|
if page['title'] == 'Main Page' || page['title'] == 'עמוד ראשי' then
next
end
puts page['title']
page_text = wiki.get_text(page['title'])
if page_text.match('<!DOCTYPE html>')
rollback(wiki, page['title'])