summaryrefslogtreecommitdiff
path: root/api.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /api.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'api.php')
-rw-r--r--api.php30
1 files changed, 22 insertions, 8 deletions
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 '<pre><b>$wgEnableAPI=true;</b></pre>';
- 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'
+ . '<pre><b>$wgEnableAPI=true;</b></pre>' );
+ 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();