MediaWiki r7538 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r7537‎ | r7538 (on ViewVC)‎ | r7539 >
Date:07:07, 28 February 2005
Author:vibber
Status:old
Tags:
Comment:
Add experimental $wgActionPaths config option.
To set 'pretty' URL paths for actions other than
plain page views, add to this array. For instance:
'edit' => "$wgScriptPath/edit/$1"
There must be an appropriate script or rewrite rule
to handle these URLs.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -654,6 +654,17 @@
655655 if ( $query == '' ) {
656656 $url = str_replace( '$1', $dbkey, $wgArticlePath );
657657 } else {
 658+ if( preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) ) {
 659+ global $wgActionPaths;
 660+ $action = urldecode( $matches[2] );
 661+ if( isset( $wgActionPaths[$action] ) ) {
 662+ $query = $matches[1];
 663+ if( isset( $matches[4] ) ) $query .= $matches[4];
 664+ $url = str_replace( '$1', $dbkey, $wgActionPaths[$action] );
 665+ if( $query != '' ) $url .= '?' . $query;
 666+ return $url;
 667+ }
 668+ }
658669 if ( $query == '-' ) {
659670 $query = '';
660671 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -103,6 +103,16 @@
104104 /**#@-*/
105105
106106 /**
 107+ * To set 'pretty' URL paths for actions other than
 108+ * plain page views, add to this array. For instance:
 109+ * 'edit' => "$wgScriptPath/edit/$1"
 110+ *
 111+ * There must be an appropriate script or rewrite rule
 112+ * in place to handle these URLs.
 113+ */
 114+$wgActionPaths = array();
 115+
 116+/**
107117 * If you operate multiple wikis, you can define a shared upload path here.
108118 * Uploads to this wiki will NOT be put there - they will be put into
109119 * $wgUploadDirectory.

Status & tagging log

  • 01:56, 13 October 2010 ^demon (talk | contribs) changed the status of r7538 [removed: new added: old]