fix extendedgitgraph live output
This commit is contained in:
1
www/extern/egg/ExtendedGitGraph2.php
vendored
1
www/extern/egg/ExtendedGitGraph2.php
vendored
@@ -30,6 +30,7 @@ class ExtendedGitGraph2 implements ILogger
|
||||
if ($config['output_session']) $this->logger []= new SessionLogger($config['session_var']);
|
||||
if ($config['output_stdout']) $this->logger []= new OutputLogger();
|
||||
if ($config['output_logfile']) $this->logger []= new FileLogger($config['logfile'], $config['logfile_count']);
|
||||
if ($config['output_file']) $this->logger []= new SingleFileLogger($config['output_filepath']);
|
||||
|
||||
$this->sources = [];
|
||||
|
||||
|
||||
22
www/extern/egg/Logger.php
vendored
22
www/extern/egg/Logger.php
vendored
@@ -42,6 +42,26 @@ class FileLogger implements ILogger
|
||||
}
|
||||
}
|
||||
|
||||
class SingleFileLogger implements ILogger
|
||||
{
|
||||
/** @var string $path */
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* @var string $filename
|
||||
*/
|
||||
public function __construct($filename)
|
||||
{
|
||||
$this->path = $filename;
|
||||
file_put_contents($this->path, '', FILE_TEXT);
|
||||
}
|
||||
|
||||
public function proclog($text)
|
||||
{
|
||||
file_put_contents($this->path, $text . PHP_EOL , FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
}
|
||||
|
||||
class SessionLogger implements ILogger
|
||||
{
|
||||
/** @var string $sessionvar */
|
||||
@@ -64,6 +84,8 @@ class SessionLogger implements ILogger
|
||||
{
|
||||
if (session_status() === PHP_SESSION_DISABLED) return;
|
||||
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||
$_SESSION[$this->sessionvar] .= $text . "\r\n";
|
||||
session_commit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user