r41301 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41300‎ | r41301 | r41302 >
Date:09:49, 27 September 2008
Author:mattj
Status:old (Comments)
Tags:
Comment:
(bug 15739) Add $wgArticlePathForCurid to make links with only curid=# as the query string use the article path, rather than the script path. Intended for Wikinews and the DPL extension with showcurid=true, although may be useful in other scenarios, so put in core.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -809,7 +809,7 @@
810810 */
811811 public function getLocalURL( $query = '', $variant = false ) {
812812 global $wgArticlePath, $wgScript, $wgServer, $wgRequest;
813 - global $wgVariantArticlePath, $wgContLang, $wgUser;
 813+ global $wgVariantArticlePath, $wgContLang, $wgUser, $wgArticlePathForCurid;
814814
815815 if( is_array( $query ) ) {
816816 $query = wfArrayToCGI( $query );
@@ -833,7 +833,7 @@
834834 }
835835 } else {
836836 $dbkey = wfUrlencode( $this->getPrefixedDBkey() );
837 - if ( $query == '' ) {
 837+ if ( $query == '' || ($wgArticlePathForCurid && substr_count( $query, '&' ) == 0 && strpos( $query, 'curid=' ) === 0 ) ) {
838838 if( $variant != false && $wgContLang->hasVariants() ) {
839839 if( $wgVariantArticlePath == false ) {
840840 $variantArticlePath = "$wgScript?title=$1&variant=$2"; // default
@@ -845,6 +845,13 @@
846846 } else {
847847 $url = str_replace( '$1', $dbkey, $wgArticlePath );
848848 }
 849+ if( $query ){
 850+ if( strpos( $url, '&' ) ){
 851+ $url .= '&' . $query;
 852+ }else{
 853+ $url .= '?' . $query;
 854+ }
 855+ }
849856 } else {
850857 global $wgActionPaths;
851858 $url = false;
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3434,3 +3434,10 @@
34353435 * Requires memcached.
34363436 */
34373437 $wgPasswordAttemptThrottle = array( 'count' => 5, 'seconds' => 300 );
 3438+
 3439+/**
 3440+ * Allow using articlepath for links where the only querystring is a curid (e.g. use /wiki/Main_Page?curid=1)
 3441+ * WARNING: This will not work for all hosts or configuration setup, so BE CAREFUL.
 3442+ * Only use this setting if you have to, as it is not recommended.
 3443+ */
 3444+$wgArticlePathForCurid = false;
Index: trunk/phase3/RELEASE-NOTES
@@ -140,6 +140,8 @@
141141 restriction types on the protection form.
142142 * (bug 8440) Allow preventing blocked users from editing their talk pages
143143 * Improved upload file type detection for OpenDocument formats
 144+* (bug 15739) Add $wgArticlePathForCurid to make links with only curid=# as the
 145+ query string use the article path, rather than the script path
144146
145147
146148 === Bug fixes in 1.14 ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r41402Reverted r41301, r41332 -- weird overly-specific URL tweak setting for bug 15...brion23:02, 29 September 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   01:10, 1 October 2008

Reverted in r41402, I don't like this way of doing it

Status & tagging log