The hook I introduced in r94373 ('WebRequestGetPathInfoRequestURI') for  
extending path routing has been dropped in r104274 and replaced with some  
new code.

We now have a path routing class. This class is instanced inside of  
WebRequest, the hook WebRequestPathInfoRouter is called with it as the  
argument. And then it's used to parse the REQUEST_URI.

Instead of the previous verbose method an extension can now extend our  
REQUEST_URI parsing by adding patterns to the PathRouter in that hook like  
so:
$router->add( "/wiki/$1" );
$router->add( array( 'edit' => "/edit/$1" ), array( 'action' => '$key' ) );
$router->add( "/$2/$1" ), array( 'variant' => '$2' ), array( '$2' =>  
array( 'zh-hant', 'zh-hans', ... ) ) );
$router->addStrict( "/foo/Bar", array( 'title' => 'Baz' ) );
$router->add( "/help/$1", array( 'title' => 'Help:$1' ) );

Don't worry about the order that you specify patterns. This new path  
router parses based on how specific the pattern is, so "/wiki/$1" will  
always dominate "/$1", and a "/$2/$1" where $2 is restricted to 'foo' and  
'bar' will always dominate a "/$2/$1" with no restrictions.


[r94373]: https://www.mediawiki.org/wiki/Special:Code/MediaWiki/94373
[r104274]: https://www.mediawiki.org/wiki/Special:Code/MediaWiki/104274

-- 
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to