Skip to content

Commit

Permalink
Oops - dont log php errors as full error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Commifreak committed Sep 25, 2024
1 parent 27f50f3 commit d178a10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/include/ABHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/include/ABSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/';
Expand Down

0 comments on commit d178a10

Please sign in to comment.