W3C home > Mailing lists > Public > public-wiki-dev@w3.org > October to December 2007

Re: Porting attachment URLs

From: Markus Krötzsch <mak@aifb.uni-karlsruhe.de>
Date: Fri, 19 Oct 2007 21:05:19 +0200
To: "Rotan Hanrahan" <rotan.hanrahan@mobileaware.com>
Cc: public-wiki-dev@w3.org
Message-Id: <200710192105.20070.mak@aifb.uni-karlsruhe.de>
On Freitag, 19. Oktober 2007, Rotan Hanrahan wrote:
> I figure that for paths whose root is that of MediaWiki, it's the
> MediaWiki response that needs to be modified as it. See what happens
> when you go to http://en.wikipedia.org/wiki/ThisPageDoesNotExist and you
> see that MediaWiki responds to the unknown page by offering to create a
> new one. I want to modify this behaviour so that it recognises a URL
> pattern belonging to a moinmoin attachment and calculates a redirect.
> That means digging into the MW code, and I'm not prepared to do that
> right now. (Especially as the server belongs to W3C and I'm not in the
> systeam.)
>
> ---Rotan

If you are fine with some minor PHP development, then the easiest way is to 
tell MediaWiki how to handle the action "AttachFile". In MediaWiki, one can 
register a custom PHP function (hook) to deal with unknown actions, see [1]. 
This function could be written into LocalSettings.php and create a soft 
redirect to some actual file or proper MediaWiki aticle. MediaWiki's normal 
page processing can be stopped by returning "false" from the hook.

Markus

[1] http://www.mediawiki.org/wiki/Manual:Hooks/UnknownAction

>
>
>
> -----Original Message-----
> From: public-wiki-dev-request@w3.org
> [mailto:public-wiki-dev-request@w3.org] On Behalf Of Alan Ruttenberg
> Sent: 19 October 2007 14:38
> To: Rotan Hanrahan
> Cc: public-wiki-dev@w3.org
> Subject: Re: Porting attachment URLs
>
>
> Redirect would be best, IMO. Can you not do the redirect in the
> apache server or within a .htaccess?
> -Alan
>
> On Oct 19, 2007, at 8:47 AM, Rotan Hanrahan wrote:
> > I am porting from a moinmoin tarball of the data directory to a
> > live MediaWiki installation. I am trying to preserve the URLs
> > despite the intended switch in the wiki engine. Maintaining the
> > page URLs seems easy enough (except perhaps for some using non-
> > ASCII characters in the name). However, I notice that moinmoin
> > attachments have URLs of the form:
> >
> > <wikipath>/PageName?action=AttachFile&do=get&target=attachment.ext
> >
> >
> > In this case there is no obvious way for me to preserve this URL
> > when the attachment is moved to a MediaWiki server. I propose
> > therefore to map all such URLs to the following MediaWiki-friendly
> > form:
> >
> > <Wikipath>/PageName/Attachments/attachment.ext
> >
> >
> > and include in the MediaWiki's 404 response page a message to
> > explain the mapping, in case anyone is looking for the URL to the
> > attachment. In theory I could automate this response so that an
> > appropriate redirect is executed, but right now I'm not keen to
> > manipulate the MediaWiki code.
> >
> > Does anyone have any comment on this strategy?
> >
> > ---Rotan.



-- 
Markus Krötzsch
Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe
phone +49 (0)721 608 7362        fax +49 (0)721 608 5998
mak@aifb.uni-karlsruhe.de        www  http://korrekt.org

Received on Friday, 19 October 2007 19:05:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:19:17 GMT