$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
// Abort to keep from breaking...
return $matches;
}
+
+ $router = new PathRouter;
+
// Raw PATH_INFO style
- $matches = self::extractTitle( $path, "$wgScript/$1" );
+ $router->add( "$wgScript/$1" );
- if( !$matches
- && isset( $_SERVER['SCRIPT_NAME'] )
+ 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