Sync global-autoresponder current state
This commit is contained in:
@@ -8,6 +8,7 @@ final class PluginLogger
|
||||
public static function init(string $path): void
|
||||
{
|
||||
self::$path = $path;
|
||||
self::ensureLogFile();
|
||||
@ini_set('log_errors', '1');
|
||||
@ini_set('error_log', $path);
|
||||
|
||||
@@ -67,4 +68,21 @@ final class PluginLogger
|
||||
default => 'E_' . $severity,
|
||||
};
|
||||
}
|
||||
|
||||
private static function ensureLogFile(): void
|
||||
{
|
||||
if (self::$path === '') {
|
||||
return;
|
||||
}
|
||||
$dir = dirname(self::$path);
|
||||
if (!is_dir($dir) || !is_writable($dir)) {
|
||||
return;
|
||||
}
|
||||
if (!is_file(self::$path)) {
|
||||
@file_put_contents(self::$path, '');
|
||||
}
|
||||
if (is_file(self::$path)) {
|
||||
@chmod(self::$path, 0600);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user