(bug 16019) Make WebRequest::interpolateTitle() do nothing when run from api.php

This commit is contained in:
Ilmari Karonen 2010-12-10 22:39:17 +00:00
parent 11f3ca1305
commit 75086e9f35
3 changed files with 9 additions and 3 deletions

View file

@ -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 ===

View file

@ -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' );

View file

@ -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.