new lib
This commit is contained in:
		
							parent
							
								
									6bde8dcd7d
								
							
						
					
					
						commit
						08a815fbc3
					
				
					 4 changed files with 0 additions and 121 deletions
				
			
		| 
						 | 
				
			
			@ -1,14 +0,0 @@
 | 
			
		|||
#!/usr/bin/env ruby
 | 
			
		||||
require '../mediawikibot'
 | 
			
		||||
 | 
			
		||||
if ARGV.size() != 2
 | 
			
		||||
  $stderr.print($0 + " <wiki-user> <wiki-password>\n")
 | 
			
		||||
  exit(1)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
b = MediaWikiBot::WikiBot.new("http://entropia.de/wiki/")
 | 
			
		||||
b.login(ARGV[0], ARGV[1])
 | 
			
		||||
 | 
			
		||||
old = b.get_raw("RoboRally")
 | 
			
		||||
new = old.gsub(/\[#reg ([^|]*?)\]/i, '[[#Gesperrte Register|\1]]')
 | 
			
		||||
b.edit("RoboRally", new, "Kaputte interne Links repariert")
 | 
			
		||||
| 
						 | 
				
			
			@ -1,33 +0,0 @@
 | 
			
		|||
#!/usr/bin/env ruby
 | 
			
		||||
require '../mediawikibot'
 | 
			
		||||
 | 
			
		||||
if ARGV.size() != 2
 | 
			
		||||
  $stderr.print($0 + " <wiki-user> <wiki-password>\n")
 | 
			
		||||
  exit(1)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------------
 | 
			
		||||
# Rock!
 | 
			
		||||
 | 
			
		||||
b = MediaWikiBot::WikiBot.new("http://entropia.de/wiki/")
 | 
			
		||||
b.login(ARGV[0], ARGV[1])
 | 
			
		||||
 | 
			
		||||
b.get_category_articles("Kategorie:FIXME").each do |title|
 | 
			
		||||
 | 
			
		||||
  # Diese Artikel ignorieren
 | 
			
		||||
  next if title.match(/Benutzer:Neinomat/)
 | 
			
		||||
  next if title == "Entropia:FIXME"
 | 
			
		||||
  next if title == "Vorlage:FIXME"
 | 
			
		||||
 | 
			
		||||
  # Diese Artikel ändern
 | 
			
		||||
  r = b.get_raw(title)
 | 
			
		||||
  if r.match(/\[\[Kategorie:FIXME\]\]/)
 | 
			
		||||
    r = "{{FIXME}}\n" + r.gsub(/\[\[Kategorie:FIXME\]\]\n?/, "")
 | 
			
		||||
    b.edit(title, r, "s/Kategorie/Vorlage")
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Diese Artikel enthalten FIXME, aber nicht nur als Vorlage
 | 
			
		||||
  if r.match(/[^{]FIXME/)
 | 
			
		||||
    puts "* [[#{title}]]\n"
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,36 +0,0 @@
 | 
			
		|||
#!/usr/bin/env ruby
 | 
			
		||||
require 'mediawikibot'
 | 
			
		||||
 | 
			
		||||
if ARGV.size() != 2
 | 
			
		||||
  $stderr.print($0 + " <wiki-user> <wiki-password>\n")
 | 
			
		||||
  exit(1)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------------
 | 
			
		||||
# Rock!
 | 
			
		||||
 | 
			
		||||
b = MediaWikiBot::WikiBot.new("http://entropia.de/wiki/")
 | 
			
		||||
b.login(ARGV[0], ARGV[1])
 | 
			
		||||
 | 
			
		||||
b.get_allpages().delete_if { |title| title !~ /GPN/ }.each do |title|
 | 
			
		||||
  if !b.is_redirect?(title) 
 | 
			
		||||
    puts "Processing #{title}"
 | 
			
		||||
 | 
			
		||||
    if !b.is_in_category?(title, "Kategorie:GPN") 
 | 
			
		||||
      puts "* [[#{title}]] fehlt in [[Kategorie:GPN]]"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if b.get_categories(title).delete_if {|c| c !~ /Kategorie:GPN\d/} .size == 0
 | 
			
		||||
      # Try to fix it
 | 
			
		||||
      if title =~ /^(GPN\d)/
 | 
			
		||||
        cat = "[[Kategorie:#{$1}]]"
 | 
			
		||||
        body = b.get_raw(title) + "\n#{cat}\n"
 | 
			
		||||
        b.edit(title, body, cat)
 | 
			
		||||
      else
 | 
			
		||||
        puts "* [[#{title}]] keiner GPN zugeordnet"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
    sleep(1)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,38 +0,0 @@
 | 
			
		|||
#!/usr/bin/env ruby
 | 
			
		||||
require 'mediawikibot'
 | 
			
		||||
 | 
			
		||||
if ARGV.size() != 2
 | 
			
		||||
  $stderr.print($0 + " <wiki-user> <wiki-password>\n")
 | 
			
		||||
  exit(1)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------------
 | 
			
		||||
# TWiki stuff: specific things for our dirty wiki
 | 
			
		||||
 | 
			
		||||
$twiki_re = /^(Main|Termine|Wir) /
 | 
			
		||||
 | 
			
		||||
def is_twiki_link? (title)
 | 
			
		||||
  return title =~ $twiki_re
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------------
 | 
			
		||||
# Rock!
 | 
			
		||||
 | 
			
		||||
b = MediaWikiBot::WikiBot.new("http://entropia.de/wiki/")
 | 
			
		||||
b.login(ARGV[0], ARGV[1])
 | 
			
		||||
 | 
			
		||||
allpages = b.get_allpages()
 | 
			
		||||
allpages.each do |title|
 | 
			
		||||
  $stderr.print("Processing '", title, "'\n")
 | 
			
		||||
  if is_twiki_link?(title) && b.is_redirect?(title)
 | 
			
		||||
    if b.is_not_linked?(title)
 | 
			
		||||
      b.delete(title, 
 | 
			
		||||
        "Old TWiki topic redirect and not linked anywhere in this wiki.")
 | 
			
		||||
    else
 | 
			
		||||
      b.get_what_links_here(title).each do |replace_where|
 | 
			
		||||
        b.replace(replace_where, title, get_redirect(title),
 | 
			
		||||
          "Old TWiki topic redirect, now fixed.")
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Reference in a new issue