registration: Notify of problems before filemtime, not after
[lhc/web/wiklou.git] / api.php
diff --git a/api.php b/api.php
index 7788a36..7775158 100644 (file)
--- a/api.php
+++ b/api.php
@@ -30,6 +30,8 @@
  * @file
  */
 
+use MediaWiki\Logger\LegacyLogger;
+
 // So extensions (and other code) can check whether they're running in API mode
 define( 'MW_API', true );
 
@@ -59,7 +61,7 @@ if ( !$wgEnableAPI ) {
 
 // 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' );
+$wgTitle = Title::makeTitle( NS_SPECIAL, 'Badtitle/dummy title for API calls set in api.php' );
 
 // RequestContext will read from $wgTitle, but it will also whine about it.
 // In a perfect world this wouldn't be necessary either.
@@ -73,7 +75,7 @@ try {
        $processor = new ApiMain( RequestContext::getMain(), $wgEnableWriteAPI );
 
        // Last chance hook before executing the API
-       wfRunHooks( 'ApiBeforeMain', array( &$processor ) );
+       Hooks::run( 'ApiBeforeMain', array( &$processor ) );
        if ( !$processor instanceof ApiMain ) {
                throw new MWException( 'ApiBeforeMain hook set $processor to a non-ApiMain class' );
        }
@@ -124,7 +126,7 @@ if ( $wgAPIRequestLog ) {
        } else {
                $items[] = "failed in ApiBeforeMain";
        }
-       MWLoggerLegacyLogger::emit( implode( ',', $items ) . "\n", $wgAPIRequestLog );
+       LegacyLogger::emit( implode( ',', $items ) . "\n", $wgAPIRequestLog );
        wfDebug( "Logged API request to $wgAPIRequestLog\n" );
 }