User talk:Sanbeg/mirrorhelp.py

From MediaWiki.org
Jump to navigation Jump to search

Hi Sanbeg,

I had a look at the script, but unfortunately I don't know Python and couldn't quite follow it. Any chance you could give a bit of description, or add some comments? Is this an existing script that is used for some purpose, or something you have put together specifically for automating help page export on this wiki? --HappyDog 00:02, 17 October 2006 (UTC)

OK, I've added a fair amount of comments. This is specific to mirroring help pages. Basically, it uses pywikipedia to copy every page from namespace 12 on mediawiki to a local wiki installation.
This demonstrates some of the additional functionality I added:
  • it scans each page for templates, and copies those, in order to get the right table formatting
  • it checks the template on the destination for protection, so if an admin overrides the templage, they can semi-protect it, to prevent if from being overwritten with the next update.
I haven't dealt with images yet, that will take some more effort. I guess the main points are:
  1. we're just a few minor details away from being able to point a script at meta to get a local help space.
  2. a fair amount of the code in the script (i.e. the whole inner loop and a few global vars) is to work around some of these issues.

Sample run - templates[edit]

This is what it creates in template space, from special:allpages; non-english was supressed for the last, complete run; but there are some leftovers from earlier, partial runs.

Admin tip	Admin tip/de	Admin tip/fr
FAQ header FAQ header/de	FAQ header/fr	
Hl2	Hl3	Languages
PD Help Page	PD Help Page/de
PD Help Page/fr	PD Help Page/pt	Prettytable
Thankyou

Recent changes[edit]

Sample run - recent changes[edit]

An example from recent changes after a sample run. Note that if we blank a page, it won't be auto-updated later, because the category will be missing. This is used to remove templates we don't want, i.e. languages & Admin tip.

   * (Upload log); 18:34 . . Mirror (Talk | contribs | block) (uploaded "Image:Wiki.png": This image was mirrored from from http://www.mediawiki.org/wiki/Image:Wiki.png Category:Imported help ")
   * (Upload log); 18:34 . . Mirror (Talk | contribs | block) (uploaded "Image:M-en-recentchanges.png": This image was mirrored from from http://www.mediawiki.org/wiki/Image:M-en-recentchanges.png Category:Imported help ")
   * (Upload log); 18:34 . . Mirror (Talk | contribs | block) (uploaded "Image:M-en-interwiki lang.png": This image was mirrored from from http://www.mediawiki.org/wiki/Image:M-en-interwiki lang.png Category:Imported help ")
   * (Upload log); 18:34 . . Mirror (Talk | contribs | block) (uploaded "Image:M-en-sidebar.png": This image was mirrored from from http://www.mediawiki.org/wiki/Image:M-en-sidebar.png Category:Imported help ")
   * (Upload log); 18:34 . . Mirror (Talk | contribs | block) (uploaded "Image:M-en-userlinks.png": This image was mirrored from from http://www.mediawiki.org/wiki/Image:M-en-userlinks.png Category:Imported help ")
   * (Upload log); 18:34 . . Mirror (Talk | contribs | block) (uploaded "Image:M-en-pagetabs.png": This image was mirrored from from http://www.mediawiki.org/wiki/Image:M-en-pagetabs.png Category:Imported help ")
   * (diff) (hist) . . Nmb! Help:Variables‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Variables)
   * (diff) (hist) . . Nmb! Help:Tracking changes‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Tracking changes)
   * (diff) (hist) . . Nmb! Help:Templates‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Templates)
   * (diff) (hist) . . Nmb! Template:Thankyou‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Template:Thankyou)
   * (diff) (hist) . . Nmb! Help:Tables‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Tables)
   * (diff) (hist) . . Nmb! Help:Starting a new page‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Starting a new page)
   * (diff) (hist) . . Nmb! Help:Special pages‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Special pages)
   * (diff) (hist) . . Nmb! Help:Searching‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Searching)
   * (diff) (hist) . . Nmb! Help:Random page‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Random page)
   * (diff) (hist) . . Nmb! Help:Preferences‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Preferences)
   * (diff) (hist) . . Nmb! Help:Patrolled edits‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Patrolled edits)
   * (diff) (hist) . . Nmb! Help:Navigation‎; 18:34 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Navigation)
   * (diff) (hist) . . Nmb! Help:Namespaces‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Namespaces)
   * (diff) (hist) . . Nmb! Help:Managing files‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Managing files)
   * (diff) (hist) . . Nmb! Help:Links‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Links)
   * (diff) (hist) . . Nmb! Help:Interwiki linking‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Interwiki linking)
   * (diff) (hist) . . Nmb! Help:Images‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Images)
   * (diff) (hist) . . Nmb! Help:Formatting‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Formatting)
   * (diff) (hist) . . Nmb! Template:Admin tip‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Template:Admin tip)
   * (diff) (hist) . . Nmb! Help:Editing pages‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Editing pages)
   * (diff) (hist) . . Nmb! Help:Contents‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Contents)
   * (diff) (hist) . . Nmb! Template:PD Help Page‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Template:PD Help Page)
   * (diff) (hist) . . Nmb! Template:Meta‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Template:Meta)
   * (diff) (hist) . . Nmb! Template:Languages‎; 18:33 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Template:Languages)
   * (diff) (hist) . . Nmb! Help:Configuration settings (alphabetical)‎; 18:29 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Configuration settings (alphabetical))
   * (diff) (hist) . . Nmb! Help:Categories‎; 18:29 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Help:Categories)
   * (diff) (hist) . . Nmb! Category:Help‎; 18:29 . . Mirror (Talk | contribs | block) (Mirror from http://www.mediawiki.org/wiki/Category:Help)