From d178a1071146910ac48b886840b89d5b265370c1 Mon Sep 17 00:00:00 2001 From: Robin Kluth Date: Wed, 25 Sep 2024 08:37:06 +0200 Subject: [PATCH] Oops - dont log php errors as full error. --- src/include/ABHelper.php | 6 +++--- src/include/ABSettings.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/include/ABHelper.php b/src/include/ABHelper.php index 538f5b0..d18a349 100644 --- a/src/include/ABHelper.php +++ b/src/include/ABHelper.php @@ -214,8 +214,8 @@ public static function startContainer($container) { $dockerStartTry = 1; $delay = 0; - $autostart = file("/var/lib/docker/unraid-autostart"); - if ($autostart) { + // @todo: Some kind of caching? + if (file_exists(ABSettings::$unraidAutostartFile) && $autostart = file(ABSettings::$unraidAutostartFile)) { foreach ($autostart as $autostartLine) { $line = explode(" ", trim($autostartLine)); if ($line[0] == $container['Name'] && isset($line[1])) { @@ -597,7 +597,7 @@ public static function isVolumeWithinAppdata($volume) { public static function errorHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext = []): bool { $errStr = "got PHP error: $errno / $errstr $errfile:$errline with context: " . json_encode($errcontext); file_put_contents("/tmp/appdata.backup_phperr", $errStr . PHP_EOL, FILE_APPEND); - self::backupLog("PHP-ERROR occured! $errno / $errstr $errfile:$errline", self::LOGLEVEL_ERR); + self::backupLog("PHP-ERROR occured! $errno / $errstr $errfile:$errline", self::LOGLEVEL_DEBUG); return true; } diff --git a/src/include/ABSettings.php b/src/include/ABSettings.php index 6926c10..afc0a6f 100644 --- a/src/include/ABSettings.php +++ b/src/include/ABSettings.php @@ -12,6 +12,7 @@ class ABSettings { public static $appName = 'appdata.backup'; public static $pluginDir = '/boot/config/plugins/appdata.backup'; public static $settingsFile = 'config.json'; + public static $unraidAutostartFile = "/var/lib/docker/unraid-autostart"; public static $settingsVersion = 3; public static $cronFile = 'appdata_backup.cron'; public static $supportUrl = 'https://forums.unraid.net/topic/137710-plugin-appdatabackup/';