Followup r104688, reintroduce the full PathRouter code now that the bug with url encoded paths is fixed.
This commit is contained in:
parent
d6cf8c57b4
commit
fba28f5233
3 changed files with 24 additions and 22 deletions
|
|
@ -40,7 +40,6 @@ production.
|
|||
* Installer now issues a warning if mod_security is present.
|
||||
* (bug 29455) Add support for a filter callback function in jQuery byteLimit
|
||||
plugin.
|
||||
* Extensions can now participate in the extraction of titles from url paths.
|
||||
* Added two new GetLocalURL hooks to better serve extensions working on a
|
||||
limited type of titles.
|
||||
* Added a --no-updates flag to importDump.php that skips updating the links
|
||||
|
|
|
|||
|
|
@ -2191,14 +2191,8 @@ $title: Title object
|
|||
$redirect: whether the page is a redirect
|
||||
$skin: Skin object
|
||||
|
||||
'WebRequestGetPathInfoRequestURI': while extracting path info from REQUEST_URI.
|
||||
Allows an extension to extend the extraction of titles from paths.
|
||||
Implementing hooks should follow the pattern used in core:
|
||||
* Use the `$matches = WebRequest::extractTitle` pattern
|
||||
* Ensure that you test `if ( !$matches ) {` before you try extracting a title
|
||||
from the path so that you don't override an already found match.
|
||||
$path: The request path to extract a title from.
|
||||
&$matches: The array to apply matches to.
|
||||
'WebRequestPathInfoRouter': While building the PathRouter to parse the REQUEST_URI.
|
||||
$router: The PathRouter instance
|
||||
|
||||
'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
|
||||
dumps
|
||||
|
|
|
|||
|
|
@ -93,40 +93,49 @@ class WebRequest {
|
|||
// Abort to keep from breaking...
|
||||
return $matches;
|
||||
}
|
||||
// Raw PATH_INFO style
|
||||
$matches = self::extractTitle( $path, "$wgScript/$1" );
|
||||
|
||||
if( !$matches
|
||||
&& isset( $_SERVER['SCRIPT_NAME'] )
|
||||
$router = new PathRouter;
|
||||
|
||||
// Raw PATH_INFO style
|
||||
$router->add( "$wgScript/$1" );
|
||||
|
||||
if( isset( $_SERVER['SCRIPT_NAME'] )
|
||||
&& preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) )
|
||||
{
|
||||
# Check for SCRIPT_NAME, we handle index.php explicitly
|
||||
# But we do have some other .php files such as img_auth.php
|
||||
# Don't let root article paths clober the parsing for them
|
||||
$matches = self::extractTitle( $path, $_SERVER['SCRIPT_NAME'] . "/$1" );
|
||||
$router->add( $_SERVER['SCRIPT_NAME'] . "/$1" );
|
||||
}
|
||||
|
||||
global $wgArticlePath;
|
||||
if( !$matches && $wgArticlePath ) {
|
||||
$matches = self::extractTitle( $path, $wgArticlePath );
|
||||
if( $wgArticlePath ) {
|
||||
$router->add( $wgArticlePath );
|
||||
}
|
||||
|
||||
global $wgActionPaths;
|
||||
if( !$matches && $wgActionPaths ) {
|
||||
$matches = self::extractTitle( $path, $wgActionPaths, 'action' );
|
||||
if( $wgActionPaths ) {
|
||||
$router->add( $wgActionPaths, array( 'action' => '$key' ) );
|
||||
}
|
||||
|
||||
global $wgVariantArticlePath, $wgContLang;
|
||||
if( !$matches && $wgVariantArticlePath ) {
|
||||
$variantPaths = array();
|
||||
if( $wgVariantArticlePath ) {
|
||||
/*$variantPaths = array();
|
||||
foreach( $wgContLang->getVariants() as $variant ) {
|
||||
$variantPaths[$variant] =
|
||||
str_replace( '$2', $variant, $wgVariantArticlePath );
|
||||
}
|
||||
$matches = self::extractTitle( $path, $variantPaths, 'variant' );
|
||||
$router->add( $variantPaths, array( 'parameter' => 'variant' ) );*/
|
||||
// Maybe actually this?
|
||||
$router->add( $wgVariantArticlePath,
|
||||
array( 'variant' => '$2'),
|
||||
array( '$2' => $wgContLang->getVariants() )
|
||||
);
|
||||
}
|
||||
|
||||
wfRunHooks( 'WebRequestGetPathInfoRequestURI', array( $path, &$matches ) );
|
||||
wfRunHooks( 'WebRequestPathInfoRouter', array( $router ) );
|
||||
|
||||
$matches = $router->parse( $path );
|
||||
}
|
||||
} elseif ( isset( $_SERVER['ORIG_PATH_INFO'] ) && $_SERVER['ORIG_PATH_INFO'] != '' ) {
|
||||
// Mangled PATH_INFO
|
||||
|
|
|
|||
Loading…
Reference in a new issue