summaryrefslogtreecommitdiffstats
path: root/api.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-25 22:07:12 +0100
committerSimon Rettberg2019-03-25 22:07:12 +0100
commitde75ba60a58e87778551a7a7258352a4cc30fddc (patch)
tree762f56cb576e6e4bbbd601252e46ae020f93b82c /api.php
parent[inc/Event] autoUpdateIp first thing on bootup (diff)
downloadslx-admin-de75ba60a58e87778551a7a7258352a4cc30fddc.tar.gz
slx-admin-de75ba60a58e87778551a7a7258352a4cc30fddc.tar.xz
slx-admin-de75ba60a58e87778551a7a7258352a4cc30fddc.zip
api/taskman: Improve logging
Diffstat (limited to 'api.php')
-rw-r--r--api.php25
1 files changed, 17 insertions, 8 deletions
diff --git a/api.php b/api.php
index df54d7f5..9e43a42a 100644
--- a/api.php
+++ b/api.php
@@ -57,14 +57,23 @@ if (Module::isAvailable($module)) {
if (!file_exists($module)) {
Util::traceError('Invalid module, or module without API: ' . $module);
}
-Header('Expires: Wed, 29 Mar 2007 09:56:28 GMT');
-Header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
-Header("Cache-Control: post-check=0, pre-check=0", false);
-Header("Pragma: no-cache");
-
-Header('Content-Type: text/plain; charset=utf-8');
-
-ob_start('ob_gzhandler');
+if (php_sapi_name() === 'cli') {
+ register_shutdown_function(function() {
+ if (class_exists('Message', false)) {
+ $text = Message::asString();
+ if (!empty($text)) {
+ error_log("The following error messages were generated:\n" . $text);
+ }
+ }
+ });
+} else {
+ Header('Expires: Wed, 29 Mar 2007 09:56:28 GMT');
+ Header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
+ Header("Cache-Control: post-check=0, pre-check=0", false);
+ Header("Pragma: no-cache");
+ Header('Content-Type: text/plain; charset=utf-8');
+ ob_start('ob_gzhandler');
+}
// Load module - it will execute pre-processing, or act upon request parameters
require_once($module);