mirror of
https://github.com/timendum/Youtube-dl-WebUI.git
synced 2025-03-01 08:03:28 +08:00
quicker founction for logging in header
This commit is contained in:
parent
61513f892b
commit
fb7eb6db0c
2 changed files with 13 additions and 1 deletions
|
@ -35,6 +35,18 @@ class FileHandler
|
||||||
return !!($this->config["log"]);
|
return !!($this->config["log"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countLogs()
|
||||||
|
{
|
||||||
|
if(!$this->config["log"])
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!$this->outuput_folder_exists())
|
||||||
|
return;
|
||||||
|
|
||||||
|
$folder = dirname(__DIR__).'/'.$this->config["logFolder"].'/';
|
||||||
|
return count(glob($folder.'*.txt', GLOB_BRACE));
|
||||||
|
}
|
||||||
|
|
||||||
public function listLogs()
|
public function listLogs()
|
||||||
{
|
{
|
||||||
$files = [];
|
$files = [];
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
// Logs
|
// Logs
|
||||||
if ($file->is_log_enabled()) {
|
if ($file->is_log_enabled()) {
|
||||||
$filesCount = count($file->listLogs());
|
$filesCount = $file->countLogs();
|
||||||
if ($filesCount < 1) {
|
if ($filesCount < 1) {
|
||||||
echo ' <li><a href="./logs.php">Logs</a></li>';
|
echo ' <li><a href="./logs.php">Logs</a></li>';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue