fix time log when shared does not exists
This commit is contained in:
@@ -786,10 +786,28 @@ class Bootstrap
|
||||
$endTime = microtime(true);
|
||||
$time = $endTime - self::$startingTime;
|
||||
Bootstrap::verifyPath(PATH_DATA . 'logs', true);
|
||||
$fpt = fopen(PATH_DATA . 'logs/time.log', 'a');
|
||||
fwrite($fpt, sprintf("%s %7.6f %-15s %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), $_SERVER ['REQUEST_URI']));
|
||||
|
||||
// Define the log file path
|
||||
$logFilePath = PATH_DATA . 'logs/time.log';
|
||||
|
||||
// Check if the directory exists, if not, create it
|
||||
if (is_dir(PATH_DATA . 'logs')) {
|
||||
|
||||
// Attempt to open the log file
|
||||
$fpt = fopen($logFilePath, 'a');
|
||||
if ($fpt === false) {
|
||||
// Handle the error if the file cannot be opened
|
||||
error_log("Failed to open log file: " . $logFilePath);
|
||||
return; // Exit or handle as needed
|
||||
}
|
||||
|
||||
// Write to the log file
|
||||
fwrite($fpt, sprintf("%s %7.6f %-15s %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), $_SERVER['REQUEST_URI']));
|
||||
|
||||
// Close the file
|
||||
fclose($fpt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* streaming a big JS file with small js files
|
||||
|
||||
Reference in New Issue
Block a user