From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- api.php | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'api.php') diff --git a/api.php b/api.php index 5c675b06..39d27dd6 100644 --- a/api.php +++ b/api.php @@ -37,8 +37,18 @@ // 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' ); +// Bail if PHP is too low +if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ) { + require( dirname( __FILE__ ) . '/includes/PHPVersionError.php' ); + wfPHPVersionError( 'api.php' ); +} + +// Initialise common code. +if ( isset( $_SERVER['MW_COMPILED'] ) ) { + require ( 'phase3/includes/WebStart.php' ); +} else { + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); +} wfProfileIn( 'api.php' ); $starttime = microtime( true ); @@ -50,9 +60,10 @@ if ( !$wgRequest->checkUrlExtension() ) { // Verify that the API has not been disabled if ( !$wgEnableAPI ) { - echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php'; - echo '
$wgEnableAPI=true;
'; - die( 1 ); + header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 ); + echo( 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php' + . '
$wgEnableAPI=true;
' ); + die(1); } // Selectively allow cross-site AJAX @@ -120,7 +131,8 @@ if ( $wgAPIRequestLog ) { $_SERVER['HTTP_USER_AGENT'] ); $items[] = $wgRequest->wasPosted() ? 'POST' : 'GET'; - if ( $processor->getModule()->mustBePosted() ) { + $module = $processor->getModule(); + if ( $module->mustBePosted() ) { $items[] = "action=" . $wgRequest->getVal( 'action' ); } else { $items[] = wfArrayToCGI( $wgRequest->getValues() ); @@ -129,6 +141,8 @@ if ( $wgAPIRequestLog ) { wfDebug( "Logged API request to $wgAPIRequestLog\n" ); } -// Shut down the database -wfGetLBFactory()->shutdown(); +// Shut down the database. foo()->bar() syntax is not supported in PHP4: we won't ever actually +// get here to worry about whether this should be = or =&, but the file has to parse properly. +$lb = wfGetLBFactory(); +$lb->shutdown(); -- cgit v1.2.3-54-g00ecf