diff --git a/src/include/ABHelper.php b/src/include/ABHelper.php index 66bdc14..a8cbfcf 100644 --- a/src/include/ABHelper.php +++ b/src/include/ABHelper.php @@ -371,7 +371,7 @@ public static function backupContainer($container, $destination) { return $containerSettings['ignoreBackupErrors'] == 'yes'; } } else { - ABHelper::backupLog("Skipping verification for this container because its not wanted!", ABHelper::LOGLEVEL_WARN); + self::backupLog("Skipping verification for this container because its not wanted!", self::LOGLEVEL_WARN); } return true; } @@ -430,10 +430,17 @@ public static function isVolumeWithinAppdata($volume) { foreach ($abSettings->allowedSources as $appdataPath) { $appdataPath = rtrim($appdataPath, '/'); if (str_starts_with($volume, $appdataPath)) { - ABHelper::backupLog(__METHOD__ . ": $appdataPath IS within $volume.", ABHelper::LOGLEVEL_DEBUG); + self::backupLog(__METHOD__ . ": $appdataPath IS within $volume.", self::LOGLEVEL_DEBUG); return true; } } return false; } + + public static function errorHandler(int $errno, string $errstr, string $errfile, int $errline): bool { + self::notify("Appdata Backup PHP error", "Appdata Backup PHP error", "got PHP error: $errno / $errstr $errfile:$errline", 'alert'); + self::backupLog("got PHP error: $errno / $errstr $errfile:$errline", self::LOGLEVEL_ERR); + + return true; + } } diff --git a/src/scripts/backup.php b/src/scripts/backup.php index f104f84..c6286c3 100644 --- a/src/scripts/backup.php +++ b/src/scripts/backup.php @@ -10,6 +10,8 @@ require_once("/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php"); require_once dirname(__DIR__) . '/include/ABHelper.php'; +//set_error_handler("unraid\plugins\AppdataBackup\ABHelper::errorHandler"); + /** * Helper for later renaming of the backup folder to suffix -failed */ diff --git a/src/scripts/restore.php b/src/scripts/restore.php index 0346afe..a66e5b0 100644 --- a/src/scripts/restore.php +++ b/src/scripts/restore.php @@ -5,6 +5,8 @@ require_once __DIR__ . '/../include/ABHelper.php'; +//set_error_handler("unraid\plugins\AppdataBackup\ABHelper::errorHandler"); + if (ABHelper::scriptRunning()) { ABHelper::notify("Still running", "There is something running already."); exit;