r104689 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104688‎ | r104689 | r104690 >
Date:15:12, 30 November 2011
Author:dantman
Status:resolved (Comments)
Tags:core 
Comment:
Followup r104688, reintroduce the full PathRouter code now that the bug with url encoded paths is fixed.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -2191,14 +2191,8 @@
21922192 $redirect: whether the page is a redirect
21932193 $skin: Skin object
21942194
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
22032197
22042198 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
22052199 dumps
Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -40,7 +40,6 @@
4141 * Installer now issues a warning if mod_security is present.
4242 * (bug 29455) Add support for a filter callback function in jQuery byteLimit
4343 plugin.
44 -* Extensions can now participate in the extraction of titles from url paths.
4544 * Added two new GetLocalURL hooks to better serve extensions working on a
4645 limited type of titles.
4746 * Added a --no-updates flag to importDump.php that skips updating the links
Index: trunk/phase3/includes/WebRequest.php
@@ -93,40 +93,49 @@
9494 // Abort to keep from breaking...
9595 return $matches;
9696 }
 97+
 98+ $router = new PathRouter;
 99+
97100 // Raw PATH_INFO style
98 - $matches = self::extractTitle( $path, "$wgScript/$1" );
 101+ $router->add( "$wgScript/$1" );
99102
100 - if( !$matches
101 - && isset( $_SERVER['SCRIPT_NAME'] )
 103+ if( isset( $_SERVER['SCRIPT_NAME'] )
102104 && preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) )
103105 {
104106 # Check for SCRIPT_NAME, we handle index.php explicitly
105107 # But we do have some other .php files such as img_auth.php
106108 # 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" );
108110 }
109111
110112 global $wgArticlePath;
111 - if( !$matches && $wgArticlePath ) {
112 - $matches = self::extractTitle( $path, $wgArticlePath );
 113+ if( $wgArticlePath ) {
 114+ $router->add( $wgArticlePath );
113115 }
114116
115117 global $wgActionPaths;
116 - if( !$matches && $wgActionPaths ) {
117 - $matches = self::extractTitle( $path, $wgActionPaths, 'action' );
 118+ if( $wgActionPaths ) {
 119+ $router->add( $wgActionPaths, array( 'action' => '$key' ) );
118120 }
119121
120122 global $wgVariantArticlePath, $wgContLang;
121 - if( !$matches && $wgVariantArticlePath ) {
122 - $variantPaths = array();
 123+ if( $wgVariantArticlePath ) {
 124+ /*$variantPaths = array();
123125 foreach( $wgContLang->getVariants() as $variant ) {
124126 $variantPaths[$variant] =
125127 str_replace( '$2', $variant, $wgVariantArticlePath );
126128 }
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+ );
128135 }
129136
130 - wfRunHooks( 'WebRequestGetPathInfoRequestURI', array( $path, &$matches ) );
 137+ wfRunHooks( 'WebRequestPathInfoRouter', array( $router ) );
 138+
 139+ $matches = $router->parse( $path );
131140 }
132141 } elseif ( isset( $_SERVER['ORIG_PATH_INFO'] ) && $_SERVER['ORIG_PATH_INFO'] != '' ) {
133142 // Mangled PATH_INFO

Follow-up revisions

RevisionCommit summaryAuthorDate
r112313Fix bug 34684 in my PathRouter code:...dantman11:31, 24 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104688Followup r104274, r104676. Fix the bug that broke fr. Forgot to rawurldecode ...dantman15:09, 30 November 2011

Comments

#Comment by Hashar (talk | contribs)   13:16, 24 February 2012

cause bug 34684 : File pages named having a dollar sign + number redirect to main page

#Comment by Hashar (talk | contribs)   13:19, 24 February 2012

resolved by r112313

Status & tagging log