Merge "Use LogEntry to add new undeletion log entries."
[lhc/web/wiklou.git] / api.php
diff --git a/api.php b/api.php
index 39d27dd..1cd5497 100644 (file)
--- a/api.php
+++ b/api.php
@@ -1,9 +1,16 @@
 <?php
-
 /**
- * API for MediaWiki 1.8+
+ * This file is the entry point for all API queries.
+ *
+ * It begins by checking whether the API is enabled on this wiki; if not,
+ * it informs the user that s/he should set $wgEnableAPI to true and exits.
+ * Otherwise, it constructs a new ApiMain using the parameter passed to it
+ * as an argument in the URL ('?action=') and with write-enabled set to the
+ * value of $wgEnableWriteAPI as specified in LocalSettings.php.
+ * It then invokes "execute()" on the ApiMain object instance, which
+ * produces output in the format sepecified in the URL.
  *
- * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * @file
  */
 
-/**
- * This file is the entry point for all API queries. It begins by checking
- * whether the API is enabled on this wiki; if not, it informs the user that
- * s/he should set $wgEnableAPI to true and exits. Otherwise, it constructs
- * a new ApiMain using the parameter passed to it as an argument in the URL
- * ('?action=') and with write-enabled set to the value of $wgEnableWriteAPI
- * as specified in LocalSettings.php. It then invokes "execute()" on the
- * ApiMain object instance, which produces output in the format sepecified
- * in the URL.
- */
-
 // So extensions (and other code) can check whether they're running in API mode
 define( 'MW_API', true );
 
 // Bail if PHP is too low
-if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ) {
+if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
        require( dirname( __FILE__ ) . '/includes/PHPVersionError.php' );
        wfPHPVersionError( 'api.php' );
 }
 
 // Initialise common code.
 if ( isset( $_SERVER['MW_COMPILED'] ) ) {
-       require ( 'phase3/includes/WebStart.php' );
+       require ( 'core/includes/WebStart.php' );
 } else {
        require ( dirname( __FILE__ ) . '/includes/WebStart.php' );
 }
@@ -68,11 +64,13 @@ if ( !$wgEnableAPI ) {
 
 // Selectively allow cross-site AJAX
 
-/*
+/**
  * Helper function to convert wildcard string into a regex
  * '*' => '.*?'
  * '?' => '.'
- * @ return string
+ *
+ * @param $search string
+ * @return string
  */
 function convertWildcard( $search ) {
        $search = preg_quote( $search, '/' );
@@ -115,7 +113,7 @@ $processor = new ApiMain( $wgRequest, $wgEnableWriteAPI );
 $processor->execute();
 
 // Execute any deferred updates
-wfDoUpdates();
+DeferredUpdates::doUpdates();
 
 // Log what the user did, for book-keeping purposes.
 $endtime = microtime( true );
@@ -127,7 +125,7 @@ if ( $wgAPIRequestLog ) {
        $items = array(
                        wfTimestamp( TS_MW ),
                        $endtime - $starttime,
-                       wfGetIP(),
+                       $wgRequest->getIP(),
                        $_SERVER['HTTP_USER_AGENT']
        );
        $items[] = $wgRequest->wasPosted() ? 'POST' : 'GET';