Hello all,
An empty page title is a non-normalized name for 'Main Page' in mediawiki (except for 'delete' actions). This is most notable in the interwiki links from 'Main Page':
http://en.wikipedia.org/w/api.php?action=query&prop=langlinks&titles... returns (...) <page pageid="15580374" ns="0" title="Main Page"> <langlinks> <ll lang="ar" xml:space="preserve" /> <ll lang="bg" xml:space="preserve" /> <ll lang="ca" xml:space="preserve" /> <ll lang="cs" xml:space="preserve" />
These links give the correct page when used as interwiki link ([[ar:$1]] resolves to http://ar.wikipedia.org/wiki/$1). Resolving these pages using the API is impossible, however. It is possible to ask for an empty title, but this yields
http://en.wikipedia.org/w/api.php?action=query&prop=langlinks&titles... (...) <pages> <page title="" invalid="" /> </pages>
There are three possible solutions for this: 1) Changing the interwiki links to link to the correct main page 2) Letting the API resolve empty titles 3) Resolving it client-side
All three have their disadvantages: 1) Community outrage; additionally it needs more maintenance. The current system is pretty fool-proof. 2) The API consistently uses Title:newFromText to resolve the title. This function is used all over mediawiki, however, so changing it makes {{}} a valid construct. This changes parser behaviour, which is (iirc) not acceptable. The alternative would be to add a conditional for every call to newFromText. Mediawiki normally uses Wiki::checkInitialQueries to resolve '', but it's not possible to use that function. 3) Brr. 'Main Page' language tables.
Any ideas on how to solve this effectively?
-Merlijn
On Tue, Aug 4, 2009 at 21:44, Merlijn van Deenvalhallasw@gmail.com wrote:
An empty page title is a non-normalized name for 'Main Page' in mediawiki (except for 'delete' actions).
[citation needed]. Is it used anywhere else but URL conversions?
This is most notable in the interwiki links from 'Main Page':
As it seems to me, they (ab)use the fact that “” redirects to the main page. Nothing more, nothing less.
- Brr. 'Main Page' language tables.
It is the most obvious solution that doesn’t require unclear implications to be made. Query MediaWiki:Mainpage, then query the page title you get from there.
Or… did I get your point wrong?
— Kalan
On Tue, Aug 4, 2009 at 8:42 PM, Kalankalan.001@gmail.com wrote:
On Tue, Aug 4, 2009 at 21:44, Merlijn van Deenvalhallasw@gmail.com wrote:
An empty page title is a non-normalized name for 'Main Page' in mediawiki (except for 'delete' actions).
[citation needed]. Is it used anywhere else but URL conversions?
includes/Wiki.php:113 113 : } elseif( '' == $title && 'delete' != $action ) { 114 : $ret = Title::newMainPage();
for example: http://en.wikisource.org/w/index.php?title=&action=edit
- Brr. 'Main Page' language tables.
It is the most obvious solution that doesn’t require unclear implications to be made. Query MediaWiki:Mainpage, then query the page title you get from there.
I hadn't noticed before, but action=query&meta=siteinfo looks about right. Does require two lookups, though.
-Merlijn
On Tue, Aug 4, 2009 at 22:54, Merlijn van Deenvalhallasw@gmail.com wrote:
On Tue, Aug 4, 2009 at 8:42 PM, Kalankalan.001@gmail.com wrote:
On Tue, Aug 4, 2009 at 21:44, Merlijn van Deenvalhallasw@gmail.com wrote:
An empty page title is a non-normalized name for 'Main Page' in mediawiki (except for 'delete' actions).
[citation needed]. Is it used anywhere else but URL conversions?
includes/Wiki.php:113 113 : } elseif( '' == $title && 'delete' != $action ) { 114 : $ret = Title::newMainPage();
Yes, this is about requests handling, not title handling.
- Brr. 'Main Page' language tables.
It is the most obvious solution that doesn’t require unclear implications to be made. Query MediaWiki:Mainpage, then query the page title you get from there.
I hadn't noticed before, but action=query&meta=siteinfo looks about right. Does require two lookups, though.
At least it’s obvious _what_ two lookups you have to make :)
— Kalan
Merlijn van Deen wrote:
There are three possible solutions for this:
- Changing the interwiki links to link to the correct main page
- Letting the API resolve empty titles
- Resolving it client-side
All three have their disadvantages:
- Community outrage; additionally it needs more maintenance. The
current system is pretty fool-proof.
Why would this cause outrage? I know some communities like drama, but I don't see why changing "[[de:]]" to "[[de:Wikipedia:Hauptseite]]" would cause problems, and I don't think most projects change the location of their main page very often (even if they do, there should still be a redirect)
- The API consistently uses Title:newFromText to resolve the title.
This function is used all over mediawiki, however, so changing it makes {{}} a valid construct. This changes parser behaviour, which is (iirc) not acceptable. The alternative would be to add a conditional for every call to newFromText. Mediawiki normally uses Wiki::checkInitialQueries to resolve '', but it's not possible to use that function.
This would probably be the easiest, I don't really see any problems, unless we're worried about it being a breaking change for people who might rely on an empty string being an invalid title. Changing it in the API rather than Title would make more sense (since we only want the behavior change for the API).
- Brr. 'Main Page' language tables.
On 8/4/09 12:11 PM, Alex wrote:
- The API consistently uses Title:newFromText to resolve the title.
This function is used all over mediawiki, however, so changing it makes {{}} a valid construct. This changes parser behaviour, which is (iirc) not acceptable. The alternative would be to add a conditional for every call to newFromText. Mediawiki normally uses Wiki::checkInitialQueries to resolve '', but it's not possible to use that function.
This would probably be the easiest, I don't really see any problems, unless we're worried about it being a breaking change for people who might rely on an empty string being an invalid title. Changing it in the API rather than Title would make more sense (since we only want the behavior change for the API).
"" does not ever mean "Main Page".
When a visitor reaches the web site, but no title is specified, we have nothing to display -- so we send them to the locally defined main entry page.
This is a user interface activity.
There is no time or place that we would or should ever interpret "empty title" to mean "Main Page" in any other kind of interaction or i/o. To do so would be egregiously wrong and would be very likely to cause strange, mysterious, hard to track down breakage.
-- brion vibber (brion @ wikimedia.org)
On 07.08.2009, 1:32 Brion wrote:
There is no time or place that we would or should ever interpret "empty title" to mean "Main Page" in any other kind of interaction or i/o. To do so would be egregiously wrong and would be very likely to cause strange, mysterious, hard to track down breakage.
O RLY? http://en.wikipedia.org/wiki/?action=edit&oldid=-1 Apparently, the "I don't know the title" situation is still handled as "what the hell, let's assign just soooomething useful to it, 'Main Page' looks just fine" in some places.
On Fri, Aug 7, 2009 at 12:51 PM, Max Semenikmaxsem.wiki@gmail.com wrote:
O RLY? http://en.wikipedia.org/wiki/?action=edit&oldid=-1 Apparently, the "I don't know the title" situation is still handled as "what the hell, let's assign just soooomething useful to it, 'Main Page' looks just fine" in some places.
Different strategies for different actions: action=view: redirect to /wiki/Main Page action=delete: bad title action=(anything else): assume 'Main Page' without redirect
According to brions story, I would think the logical system would be to action=view: redirect to /wiki/Main Page action=(anything else): bad title
And, if I understand correctly, the fix should be changing all 'empty' interlanguage links to 'main page' or their local equivalent.
-Merlijn
Merlijn van Deen wrote:
On Fri, Aug 7, 2009 at 12:51 PM, Max Semenikmaxsem.wiki@gmail.com wrote:
O RLY? http://en.wikipedia.org/wiki/?action=edit&oldid=-1 Apparently, the "I don't know the title" situation is still handled as "what the hell, let's assign just soooomething useful to it, 'Main Page' looks just fine" in some places.
Different strategies for different actions: action=view: redirect to /wiki/Main Page action=delete: bad title action=(anything else): assume 'Main Page' without redirect
According to brions story, I would think the logical system would be to action=view: redirect to /wiki/Main Page action=(anything else): bad title
And, if I understand correctly, the fix should be changing all 'empty' interlanguage links to 'main page' or their local equivalent.
-Merlijn
Also note how for missing oldid values and no title parameter (eg. http://en.wikipedia.org/wiki/?diff=1234567890 or http://en.wikipedia.org/wiki/?oldid=1234567890) it explicitely says that the page you wanted was called "Main Page" which is a completely wrong assumption. It simply doesn't know what name it that page should have.
mediawiki-api@lists.wikimedia.org