Le Jeudi 27 Avril 2006 22:04, fred a écrit :
Le Mercredi 26 Avril 2006 23:56, Tels a écrit :
On Wednesday 26 April 2006 23:46, Brion Vibber wrote:
I'm currently pushing my company to adopt
mediawiki as our main
collaborative working tool.
I'm looking for a way to automaticaly create an article containing a
list of permanent links pointing to specific versions of articles. It
could be a category but this category should be "frozen"; the
category should list the articles versions frozen at time T.
In short, I'm trying to "tag" (as in cvs or subversion) a list of
Is it feasible with mediawiki? Maybe using some Bots?
If you're in the database, you can get the current revision number of
each page from its page_latest field. You can then make a list of links
using the 'oldid' URL parameter, and store it however you like.
And the best way would probably to write a new SpecialPage, call it
SpecialFreezeList or something.
User could then select which articles need "freezing" and where to store
the list linking to these revisions.
Thanks you very much for your answers/suggestions.
I've been scratching my head about this problem since yesterday.
The problem is that if I freeze an article, I WON'T freeze children
articles whose link is mentionned in the frozen article...Anoying...
If think the best way to go is to tag my whole mediawiki website using
subversion each time I wan't to freeze it.
Then if I want to go back, I restore the whole site... no other satisfying
solutions for the moment.
My only wish left is to create a bot that would fill the summary of a list
of article with something like "VERSION 1.0".
Is this a difficult bot to write ? Any rough example around ?
I reply to myself.
I've found this good template :
So I've amended it a bit to make it works as I want :
# -*- coding: utf-8 -*-
This bot goes over multiple pages of the home wiki, and tag them without
changing. Tagging means that a summary is simply assigned to
the current version of the article, just as a tag.
This script understands various command-line arguments:
-start: used as -start:page_name, specifies that the robot should
go alphabetically through all pages on the home wiki,
starting at the named page.
-file: used as -file:file_name, read a list of pages to treat
from the named textfile. Page titles should be enclosed
in [[double-squared brackets]].
-ref: used as -start:page_name, specifies that the robot should
touch all pages referring to the named page.
-links: used as -links:page_name, specifies that the robot should
touch all pages referred to from the named page.
-cat: used as -cat:category_name, specifies that the robot should
touch all pages in the named category.
-redir specifies that the robot should touch redirect pages;
otherwise, they will be skipped.
-tag: specifies the text of the tag. Example -tag:VERSION1.0
All other parameters will be regarded as a page title; in this case, the bot
will only touch a single page.
import wikipedia, pagegenerators, catlib
def __init__(self, generator, touch_redirects):
self.generator = generator
self.touch_redirects = touch_redirects
for page in self.generator:
text = page.get(get_redirect=self.touch_redirects)
print "Page %s does not exist?!" % page.aslink()
print "Page %s is a redirect; skipping." % page.aslink()
print "Page %s is locked?!" % page.aslink()
gen = None
redirs = False
pageTitle = 
for arg in wikipedia.handleArgs():
gen = pagegenerators.AllpagesPageGenerator(arg[7:])
referredPage = wikipedia.Page(wikipedia.getSite(), arg[5:])
gen = pagegenerators.ReferringPageGenerator(referredPage)
linkingPage = wikipedia.Page(wikipedia.getSite(), arg[7:])
gen = pagegenerators.LinkedPageGenerator(linkingPage)
gen = pagegenerators.TextfilePageGenerator(arg[6:])
cat = catlib.Category(wikipedia.getSite(), arg[5:])
gen = pagegenerators.CategorizedPageGenerator(cat)
elif arg == '-redir':
redirs = True
elif arg == '-tag:':
summary_message = arg[5:]
page = wikipedia.Page(wikipedia.getSite(), ' '.join(pageTitle))
gen = iter([page])
if not gen:
preloadingGen = pagegenerators.PreloadingGenerator(gen)
bot = Tag(preloadingGen, redirs)
if __name__ == "__main__":
Basically I've just added the "wikipedia.setAction(summary_message)"
is it correct ? I'm a bit afraid to make it run on my wikipedia as it is the
very first time I run bots on it.