From a1dc5ada6742f250952929db3b5606206214f962 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 24 Oct 2018 13:17:28 +0200 Subject: Add Fever API debug (#2063) * Add Fever API debug https://github.com/FreshRSS/FreshRSS/issues/2043 * Default without debug logging --- p/api/fever.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'p/api/fever.php') diff --git a/p/api/fever.php b/p/api/fever.php index bf38dc662..dd54a372b 100644 --- a/p/api/fever.php +++ b/p/api/fever.php @@ -30,6 +30,36 @@ register_shutdown_function('session_destroy'); Minz_Session::init('FreshRSS'); // ================================================================================================ +// +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576); + +function debugInfo() { + if (function_exists('getallheaders')) { + $ALL_HEADERS = getallheaders(); + } else { //nginx http://php.net/getallheaders#84262 + $ALL_HEADERS = array(); + foreach ($_SERVER as $name => $value) { + if (substr($name, 0, 5) === 'HTTP_') { + $ALL_HEADERS[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; + } + } + } + global $ORIGINAL_INPUT; + return print_r( + array( + 'date' => date('c'), + 'headers' => $ALL_HEADERS, + '_SERVER' => $_SERVER, + '_GET' => $_GET, + '_POST' => $_POST, + '_COOKIE' => $_COOKIE, + 'INPUT' => $ORIGINAL_INPUT + ), true); +} + +//Minz_Log::debug('----------------------------------------------------------------', API_LOG); +//Minz_Log::debug(debugInfo(), API_LOG); +// class FeverDAO extends Minz_ModelPdo { -- cgit v1.2.3