[Mediawiki-l] [quickhack] require a specific user to view a page

Rowan Collins rowan.collins at gmail.com
Fri Feb 4 13:45:52 UTC 2005

On Thu, 3 Feb 2005 11:04:29 +0100, Moritz Karbach <mailinglist at karba.ch> wrote:
> > I'm pretty sure it's the other way around - the "parser" has to go
> > through the wikitext, and pick out any category links it finds; these
> > are then plonked in the database for other use if the page is being
> > saved. On preview, they're just added in the little box at the bottom
> > of the page, without the database being updated.
> I guess it works more like 1. grabbing all the wiki text, from DB _and_ from
> the user's edit form, then 2. pass it to the parser. That's why a check of
> the access rights in a function that only grabs from DB isn't sufficient...

I'm 90% sure there's no reason for it to grab *anything* from the
database on preview - the parser has the [editted] article text to go
through, and that contains the definitive list of categories. The page
text in the database, and the categorylinks table, will simply be out
of date and irrelevant - you could blank the whole page and click
preview, and nothing in the database would relate to the text you were
previewing. The main purpose of the categorylinks table is for doing
*backwards* lookups - as in, what pages are in this category.

But anyway, it looks like you've found a check for previews as well
now, so all's well that ends well. If I get round to it, I'll test it
out and see if I can spot anything behaving badly, but I'm booted into
the wrong OS for my test wikis right now.

By the way, now that the hack involves so many changes, you might want
to look into creating a patch - ignore the rest of this paragraph if
you already know how and why to do this, I thought I'd add it in case
you didn't. If you grabbed the code straight from CVS, you should be
able to run something like "cvs diff -U3" to get it to churn one out.
Otherwise, you'll need to use diff to compare a modified and
unmodified copy of each file. Not only will this make it easier to
share with other people, but if you get enough context (-U3 being 3
lines each side of each change) you should be able to reapply the hack
after replacing the files with a newer version [unless relevant things
have changed, obviously!].

Rowan Collins BSc

More information about the MediaWiki-l mailing list