From 75086e9f35ad0fb8edded9111b3e76f45675b9d5 Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Fri, 10 Dec 2010 22:39:17 +0000 Subject: [PATCH] (bug 16019) Make WebRequest::interpolateTitle() do nothing when run from api.php --- RELEASE-NOTES | 1 + api.php | 6 +++--- includes/WebRequest.php | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 48f998b49d..de3c6d8358 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -33,6 +33,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Page existence is now not revealed (in the colour of the tabs) to users who cannot read the page in question. * (bug 19006) {{REVISIONUSER}} no longer acts like {{CURRENTUSER}} in some cases +* (bug 16019) $wgArticlePath = "/$1" no longer breaks API edit/watch actions === API changes in 1.18 === diff --git a/api.php b/api.php index 7246cf1bce..370884dffc 100644 --- a/api.php +++ b/api.php @@ -34,6 +34,9 @@ * in the URL. */ +// So extensions (and other code) can check whether they're running in API mode +define( 'MW_API', true ); + // Initialise common code require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); @@ -99,9 +102,6 @@ if ( $wgCrossSiteAJAXdomains && isset( $_SERVER['HTTP_ORIGIN'] ) ) { } } -// So extensions can check whether they're running in API mode -define( 'MW_API', true ); - // Set a dummy $wgTitle, because $wgTitle == null breaks various things // In a perfect world this wouldn't be necessary $wgTitle = Title::makeTitle( NS_MAIN, 'API' ); diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 4cd120a6a8..7ec8c67d6b 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -65,6 +65,11 @@ class WebRequest { public function interpolateTitle() { global $wgUsePathInfo; + // bug 16019: title interpolation on API queries is useless and possible harmful + if ( defined( 'MW_API' ) ) { + return; + } + if ( $wgUsePathInfo ) { // PATH_INFO is mangled due to http://bugs.php.net/bug.php?id=31892 // And also by Apache 2.x, double slashes are converted to single slashes. -- 2.20.1