Commit ad87c16e authored by Marc Egger's avatar Marc Egger
Browse files

Refs #11953 Logger.php: replace makePathAbsolute with Path functions

parent f0cf8699
Pipeline #4983 failed with stages
in 2 minutes and 9 seconds
......@@ -16,40 +16,25 @@ namespace IMATHUZH\Qfq\Core\Helper;
*/
class Logger {
/**
* @var String
*/
private static $systemSitePath = '';
/**
* Copy the SystemSitePath to a local variable.
*
* @param $path
*/
public static function setSystemSitePathAbsolute($path) {
self::$systemSitePath = $path;
}
/**
* Append $msg to $filename. Create the file it it not exist.
*
* @param $msg
* @param $pathFileNameRelToCwd
*
* @param string $pathFileNameAbsoluteOrRelToApp Log file path (either absolute path or relative to app directory)
* @param string $mode
* @param bool $recursion
* @throws \CodeException
* @throws \UserFormException
*/
public static function logMessage($msg, $pathFileNameRelToCwd, $mode = FILE_MODE_APPEND, $recursion = false) {
public static function logMessage($msg, $pathFileNameAbsoluteOrRelToApp, $mode = FILE_MODE_APPEND, $recursion = false) {
$handle = false;
if ($pathFileNameRelToCwd == '') {
if ($pathFileNameAbsoluteOrRelToApp == '') {
return;
}
$absolutePathFileName = self::makePathAbsolute($pathFileNameRelToCwd);
$absolutePathFileName = Path::joinIfNotAbsolute(Path::absoluteApp(), $pathFileNameAbsoluteOrRelToApp);
try {
$handle = fopen($absolutePathFileName, $mode);
......@@ -99,20 +84,6 @@ class Logger {
self::logMessage(self::linePre() . $msg, $filename, $mode);
}
/**
* In case $pathFileNameRelToCwd is not absolute, make it absolute
*
* @param $pathFileNameRelToCwd
* @return string
*/
private static function makePathAbsolute($pathFileNameRelToCwd) {
if (isset($pathFileNameRelToCwd[0]) && $pathFileNameRelToCwd[0] != '/') {
return realpath($pathFileNameRelToCwd);
}
return $pathFileNameRelToCwd;
}
/**
* Returns a timestamp, IP, cookie.
*
......
......@@ -455,6 +455,7 @@ class Path
*/
private static function findAbsoluteApp()
{
// look for typo3conf directory
$absoluteApp = self::realpath(self::join(__DIR__, '../../../../../../'));
if (!file_exists(self::join($absoluteApp, self::APP_TO_TYPO3_CONF)))
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment