API: Set $wgTitle to a dummy title in api.php, and introduce defined('API') as a...
[lhc/web/wiklou.git] / api.php
diff --git a/api.php b/api.php
index 546969f..8702ce1 100644 (file)
--- a/api.php
+++ b/api.php
@@ -69,6 +69,13 @@ if (!$wgEnableAPI) {
        die(1);
 }
 
+// So extensions can check whether they're running in API mode
+define('API', true);
+
+// Set a dummy $wgTitle, because $wgTitle == null breaks various things
+// In a perfect world this wouldn't be necessary
+$wgTitle = Title::newFromTitle('API');
+
 /* Construct an ApiMain with the arguments passed via the URL. What we get back
  * is some form of an ApiMain, possibly even one that produces an error message,
  * but we don't care here, as that is handled by the ctor.