enablig api logging

This commit is contained in:
Fernando Ontiveros
2025-04-22 17:39:18 +00:00
parent 7093cab058
commit ef0f2d4bb8
7 changed files with 22 additions and 18 deletions

View File

@@ -224,6 +224,8 @@ class WebApplication
*/
public function dispatchApiRequest($uri, $version = "1.0", $multipart = false, $inputExecute = '')
{
$startingTime = microtime(true);
$uri = $this->initRest($uri, "1.0", $multipart);
// to handle a request with "OPTIONS" method
@@ -242,12 +244,20 @@ class WebApplication
* that automatically is sent by a client using XmlHttpRequest or similar.
*/
header('Access-Control-Allow-Origin: *');
$_SERVER['REQUEST_URI'] = $uri;
$this->rest->inputExecute = $inputExecute;
$this->rest->handle();
$serverAddr = $_SERVER ['SERVER_ADDR'];
$endTime = microtime(true);
$time = $endTime - $startingTime;
Bootstrap::verifyPath(PATH_DATA . 'logs', true);
$fpt = fopen(PATH_DATA . 'logs/api.log', 'a');
fwrite($fpt, sprintf("%s %7.6f %-15s %-4s %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), $_SERVER ['REQUEST_METHOD'], $_SERVER ['REQUEST_URI']));
fclose($fpt);
if ($this->rest->flagMultipart === true) {
return $this->rest->responseMultipart;
}

View File

@@ -59,7 +59,7 @@
define( 'PATH_LANGUAGECONT',PATH_CORE . 'content' . PATH_SEP . 'languages' . PATH_SEP );
define( 'SYS_UPLOAD_PATH', PATH_HOME . "public_html/files/" );
define( 'PATH_UPLOAD', PATH_HTML . 'files' . PATH_SEP);
define( 'PATH_DATA', '/shared/workflow_data' . PATH_SEP);
define( 'PATH_DATA', '/shared/workflow_data' . PATH_SEP); //todo: review why is hardcoded to shared
define( 'PATH_DB' , PATH_DATA . 'sites' . PATH_SEP );
// the Compiled Directories

View File

@@ -28,7 +28,7 @@
define( 'PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP );
define( 'PATH_THIRDPARTY', $pathTrunk . 'thirdparty' . PATH_SEP );
define( 'PATH_RBAC', PATH_RBAC_HOME . 'engine/classes' . PATH_SEP ); //to enable rbac version 2
define( 'PATH_DATA', '/shared/rbac/');
define( 'PATH_DATA', '/shared/rbac/'); //Todo: change this path to use environment variable
define( 'PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP );
ini_set('display_errors','On');

View File

@@ -20,7 +20,7 @@ define('PATH_TRUNK', dirname(__DIR__) . '/');
define('PATH_CORE', PATH_TRUNK . 'workflow/engine/');
define('PATH_CONFIG', PATH_CORE . 'config/');
if (!defined("PATH_DATA")) {
define('PATH_DATA', dirname(__DIR__) . '/shared/');
define('PATH_DATA', dirname(__DIR__) . '/shared/'); //todo: where PATH DATA is not defined?
}
define('PATH_RBAC_CORE', dirname(__DIR__) . '/rbac/engine/');
define('PATH_DB', PATH_DATA . 'sites/');

View File

@@ -16,17 +16,6 @@
</testsuite>
</testsuites>
<!--<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./gulliver</directory>
<directory>./workflow</directory>
<directory>./rbac</directory>
</exclude>
</whitelist>
</filter> -->
<php>
<var name="SYS_SYS" value="workflow" />
</php>

View File

@@ -7,7 +7,12 @@ array_pop($sections);
$pathHome = implode('/', $sections) . '/';
// Include the "paths_installed.php" file
require_once $pathHome . 'engine/config/paths_installed.php';
$documentRoot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$pathParts = explode('/', $documentRoot);
array_pop($pathParts); // Remove the last part (usually the project folder)
$pathTrunk = implode('/', array_slice($pathParts, 0, -1)) . '/'; // Remove last part again
define('PATH_DATA', isset($_SERVER['PATH_DATA']) ? $_SERVER['PATH_DATA'] : $pathTrunk . 'shared' . '/' );
require_once PATH_DATA . '/config/paths_installed.php';
// Set the fonts styles file, for now the value is fixed (Maybe later we have another PDF engine)
$fileName = 'fonts.css';

View File

@@ -99564,8 +99564,8 @@ LANG = (typeof SYS_LANG !== "undefined") ? SYS_LANG : enviromentVariables('LANG'
WORKSPACE = (typeof SYS_SYS !== "undefined") ? SYS_SYS : enviromentVariables('WORKSPACE');
SKIN = (typeof SYS_SKIN !== "undefined") ? SYS_SKIN : enviromentVariables('SKIN');
DEFAULT_WINDOW_WIDTH = 1093;
DEFAULT_WINDOW_HEIGHT = 520;
DEFAULT_WINDOW_WIDTH = 1193;
DEFAULT_WINDOW_HEIGHT = 570;
ENABLED_FEATURES = [];
if (LANG != 'en') {