From 87920a484b99585ab12083dd80f25a73a130c9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?= <janis.daehne2@student.uni-halle.de> Date: Fri, 19 Apr 2019 15:23:11 +0200 Subject: [PATCH] - added public stats file - moved stats to separate dir - changed included to work with dirs --- bootstrap.php | 4 ++-- constants.php | 2 +- helpers.php | 4 ++-- sqlHelper.php | 2 +- stats/private.php | 40 ++++++++++++++++++++++++++++++++++++++++ stats/public.php | 29 +++++++++++++++++++++++++++++ transactionHelper.php | 4 ++-- 7 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 stats/private.php create mode 100644 stats/public.php diff --git a/bootstrap.php b/bootstrap.php index 0b12d7f..5876a6e 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,6 +1,6 @@ <?php -require_once './constants.php'; +require_once __DIR__.'/constants.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { @@ -37,7 +37,7 @@ if (isset($config['useConfigFromDb']) === FALSE || (isset($config['useConfigFrom //get the config from the db -include_once './sqlHelper.php'; +include_once __DIR__.'/sqlHelper.php'; $conn = connectToDb($config['dbConfigServer'], $config['dbConfigName'], $config['dbConfigUser'], $config['dbConfigPw']); diff --git a/constants.php b/constants.php index f84beab..8fa2af3 100644 --- a/constants.php +++ b/constants.php @@ -3,7 +3,7 @@ # variables //use this to know which version we published -$versionString = '1.1.1'; +$versionString = '1.1.2'; $rootDirNameToUseString = 'work'; $isDebug = false; //logs debug to STDOUT diff --git a/helpers.php b/helpers.php index c468ce9..ab48153 100644 --- a/helpers.php +++ b/helpers.php @@ -1,7 +1,7 @@ <?php -include_once './constants.php'; -include_once './transactionHelper.php'; +include_once __DIR__.'/constants.php'; +include_once __DIR__.'/transactionHelper.php'; /** diff --git a/sqlHelper.php b/sqlHelper.php index f6ea803..16bd408 100644 --- a/sqlHelper.php +++ b/sqlHelper.php @@ -1,6 +1,6 @@ <?php -require_once './constants.php'; +require_once __DIR__.'/constants.php'; // //from http://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php diff --git a/stats/private.php b/stats/private.php new file mode 100644 index 0000000..6597bbe --- /dev/null +++ b/stats/private.php @@ -0,0 +1,40 @@ +<?php + +//return the test server stats + + +//NOTE: only post is allowed!! + +#requires some helper function to e.g. create / delete dirs, handle output... + +$config = require __DIR__.'/../bootstrap.php'; + +require_once __DIR__.'/../constants.php'; + +$response = array( + "workingDirFullPath" => $config["workingDirFullPath"], + "hardGlobalTimeoutInMs" => $config["hardGlobalTimeoutInMs"], + "maxParallelTests" => $config["maxParallelTests"], + "maxNumberOfTestsWithOneRequest" => $config["maxNumberOfTestsWithOneRequest"], + //"runner" => $config["runner"], //maybe not needed + "maxLinesToRead" => $config["maxLinesToRead"], + "maxErrLinesToRead" => $config["maxErrLinesToRead"], + "maxLinesToWrite" => $config["maxLinesToWrite"], + "showTestRunnerDebugOutput" => $config["showTestRunnerDebugOutput"], + + "dbServer" => $config["dbServer"], + "dbName" => $config["dbName"], + + "useConfigFromDb" => $config["useConfigFromDb"], + "dbConfigServer" => $config["dbConfigServer"], + "dbConfigName" => $config["dbConfigName"], + + "environmentVars" => $config["environmentVars"], +); + + +if ($isDebug) { + debug(json_encode($respone)); +} + +output($status_code_Ok, "", $response); diff --git a/stats/public.php b/stats/public.php new file mode 100644 index 0000000..d7e60b6 --- /dev/null +++ b/stats/public.php @@ -0,0 +1,29 @@ +<?php + +//return the test server stats + + +//NOTE: only post is allowed!! + +$config = require '../bootstrap.php'; + +require_once __DIR__.'/../constants.php'; + +#requires some helper function to e.g. create / delete dirs, handle output... + + +$response = array( + "hardGlobalTimeoutInMs" => $config["hardGlobalTimeoutInMs"], + "maxNumberOfTestsWithOneRequest" => $config["maxNumberOfTestsWithOneRequest"], + "maxLinesToRead" => $config["maxLinesToRead"], + "maxErrLinesToRead" => $config["maxErrLinesToRead"], + "maxLinesToWrite" => $config["maxLinesToWrite"], + "showTestRunnerDebugOutput" => $config["showTestRunnerDebugOutput"], +); + + +if ($isDebug) { + debug(json_encode($respone)); +} + +output($status_code_Ok, "", $response); diff --git a/transactionHelper.php b/transactionHelper.php index cdb1163..0fc6f2c 100644 --- a/transactionHelper.php +++ b/transactionHelper.php @@ -1,7 +1,7 @@ <?php -include_once './constants.php'; -include_once './sqlHelper.php'; +include_once __DIR__.'/constants.php'; +include_once __DIR__.'/sqlHelper.php'; /** * registers/starts a test run (a transaction) -- GitLab