Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -2191,14 +2191,8 @@ |
2192 | 2192 | $redirect: whether the page is a redirect |
2193 | 2193 | $skin: Skin object |
2194 | 2194 | |
2195 | | -'WebRequestGetPathInfoRequestURI': while extracting path info from REQUEST_URI. |
2196 | | - Allows an extension to extend the extraction of titles from paths. |
2197 | | - Implementing hooks should follow the pattern used in core: |
2198 | | - * Use the `$matches = WebRequest::extractTitle` pattern |
2199 | | - * Ensure that you test `if ( !$matches ) {` before you try extracting a title |
2200 | | - from the path so that you don't override an already found match. |
2201 | | -$path: The request path to extract a title from. |
2202 | | -&$matches: The array to apply matches to. |
| 2195 | +'WebRequestPathInfoRouter': While building the PathRouter to parse the REQUEST_URI. |
| 2196 | +$router: The PathRouter instance |
2203 | 2197 | |
2204 | 2198 | 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions |
2205 | 2199 | dumps |
Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -40,7 +40,6 @@ |
41 | 41 | * Installer now issues a warning if mod_security is present. |
42 | 42 | * (bug 29455) Add support for a filter callback function in jQuery byteLimit |
43 | 43 | plugin. |
44 | | -* Extensions can now participate in the extraction of titles from url paths. |
45 | 44 | * Added two new GetLocalURL hooks to better serve extensions working on a |
46 | 45 | limited type of titles. |
47 | 46 | * Added a --no-updates flag to importDump.php that skips updating the links |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -93,40 +93,49 @@ |
94 | 94 | // Abort to keep from breaking... |
95 | 95 | return $matches; |
96 | 96 | } |
| 97 | + |
| 98 | + $router = new PathRouter; |
| 99 | + |
97 | 100 | // Raw PATH_INFO style |
98 | | - $matches = self::extractTitle( $path, "$wgScript/$1" ); |
| 101 | + $router->add( "$wgScript/$1" ); |
99 | 102 | |
100 | | - if( !$matches |
101 | | - && isset( $_SERVER['SCRIPT_NAME'] ) |
| 103 | + if( isset( $_SERVER['SCRIPT_NAME'] ) |
102 | 104 | && preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) ) |
103 | 105 | { |
104 | 106 | # Check for SCRIPT_NAME, we handle index.php explicitly |
105 | 107 | # But we do have some other .php files such as img_auth.php |
106 | 108 | # Don't let root article paths clober the parsing for them |
107 | | - $matches = self::extractTitle( $path, $_SERVER['SCRIPT_NAME'] . "/$1" ); |
| 109 | + $router->add( $_SERVER['SCRIPT_NAME'] . "/$1" ); |
108 | 110 | } |
109 | 111 | |
110 | 112 | global $wgArticlePath; |
111 | | - if( !$matches && $wgArticlePath ) { |
112 | | - $matches = self::extractTitle( $path, $wgArticlePath ); |
| 113 | + if( $wgArticlePath ) { |
| 114 | + $router->add( $wgArticlePath ); |
113 | 115 | } |
114 | 116 | |
115 | 117 | global $wgActionPaths; |
116 | | - if( !$matches && $wgActionPaths ) { |
117 | | - $matches = self::extractTitle( $path, $wgActionPaths, 'action' ); |
| 118 | + if( $wgActionPaths ) { |
| 119 | + $router->add( $wgActionPaths, array( 'action' => '$key' ) ); |
118 | 120 | } |
119 | 121 | |
120 | 122 | global $wgVariantArticlePath, $wgContLang; |
121 | | - if( !$matches && $wgVariantArticlePath ) { |
122 | | - $variantPaths = array(); |
| 123 | + if( $wgVariantArticlePath ) { |
| 124 | + /*$variantPaths = array(); |
123 | 125 | foreach( $wgContLang->getVariants() as $variant ) { |
124 | 126 | $variantPaths[$variant] = |
125 | 127 | str_replace( '$2', $variant, $wgVariantArticlePath ); |
126 | 128 | } |
127 | | - $matches = self::extractTitle( $path, $variantPaths, 'variant' ); |
| 129 | + $router->add( $variantPaths, array( 'parameter' => 'variant' ) );*/ |
| 130 | + // Maybe actually this? |
| 131 | + $router->add( $wgVariantArticlePath, |
| 132 | + array( 'variant' => '$2'), |
| 133 | + array( '$2' => $wgContLang->getVariants() ) |
| 134 | + ); |
128 | 135 | } |
129 | 136 | |
130 | | - wfRunHooks( 'WebRequestGetPathInfoRequestURI', array( $path, &$matches ) ); |
| 137 | + wfRunHooks( 'WebRequestPathInfoRouter', array( $router ) ); |
| 138 | + |
| 139 | + $matches = $router->parse( $path ); |
131 | 140 | } |
132 | 141 | } elseif ( isset( $_SERVER['ORIG_PATH_INFO'] ) && $_SERVER['ORIG_PATH_INFO'] != '' ) { |
133 | 142 | // Mangled PATH_INFO |