diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
commit | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch) | |
tree | ec04cc15b867bc21eedca904cea9af0254531a11 /api.php | |
parent | a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (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.php | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -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(); |