summaryrefslogtreecommitdiff
path: root/includes/AjaxDispatcher.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
commit370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch)
tree491674f4c242e4d6ba0d04eafa305174c35a3391 /includes/AjaxDispatcher.php
parentf4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff)
Update auf 1.13.0
Diffstat (limited to 'includes/AjaxDispatcher.php')
-rw-r--r--includes/AjaxDispatcher.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php
index 7b85ed20..c489cf1c 100644
--- a/includes/AjaxDispatcher.php
+++ b/includes/AjaxDispatcher.php
@@ -1,5 +1,9 @@
<?php
/**
+ * @defgroup Ajax Ajax
+ *
+ * @file
+ * @ingroup Ajax
* Handle ajax requests and send them to the proper handler.
*/
@@ -11,7 +15,7 @@ require_once( 'AjaxFunctions.php' );
/**
* Object-Oriented Ajax functions.
- * @addtogroup Ajax
+ * @ingroup Ajax
*/
class AjaxDispatcher {
/** The way the request was made, either a 'get' or a 'post' */
@@ -58,6 +62,7 @@ class AjaxDispatcher {
break;
default:
+ wfProfileOut( __METHOD__ );
return;
# Or we could throw an exception:
#throw new MWException( __METHOD__ . ' called without any data (mode empty).' );
@@ -81,9 +86,13 @@ class AjaxDispatcher {
wfProfileIn( __METHOD__ );
if (! in_array( $this->func_name, $wgAjaxExportList ) ) {
+ wfDebug( __METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n" );
+
wfHttpError( 400, 'Bad Request',
"unknown function " . (string) $this->func_name );
} else {
+ wfDebug( __METHOD__ . ' dispatching ' . $this->func_name . "\n" );
+
if ( strpos( $this->func_name, '::' ) !== false ) {
$func = explode( '::', $this->func_name, 2 );
} else {
@@ -93,6 +102,10 @@ class AjaxDispatcher {
$result = call_user_func_array($func, $this->args);
if ( $result === false || $result === NULL ) {
+ wfDebug( __METHOD__ . ' ERROR while dispatching '
+ . $this->func_name . "(" . var_export( $this->args, true ) . "): "
+ . "no data returned\n" );
+
wfHttpError( 500, 'Internal Error',
"{$this->func_name} returned no data" );
}
@@ -103,9 +116,15 @@ class AjaxDispatcher {
$result->sendHeaders();
$result->printText();
+
+ wfDebug( __METHOD__ . ' dispatch complete for ' . $this->func_name . "\n" );
}
} catch (Exception $e) {
+ wfDebug( __METHOD__ . ' ERROR while dispatching '
+ . $this->func_name . "(" . var_export( $this->args, true ) . "): "
+ . get_class($e) . ": " . $e->getMessage() . "\n" );
+
if (!headers_sent()) {
wfHttpError( 500, 'Internal Error',
$e->getMessage() );
@@ -119,5 +138,3 @@ class AjaxDispatcher {
$wgOut = null;
}
}
-
-