Skip to content

Commit

Permalink
Show container volumes with excluded suffix, if listed in exclusion…
Browse files Browse the repository at this point in the history
…s list
  • Loading branch information
Commifreak committed Feb 26, 2024
1 parent 6cd6fc2 commit 9a2930c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions src/include/ABHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public static function abortRequested() {
* @param $container
* @return array
*/
public static function getContainerVolumes($container) {
public static function getContainerVolumes($container, $skipExclusionCheck = false) {
global $abSettings;

$volumes = [];
Expand All @@ -510,11 +510,13 @@ public static function getContainerVolumes($container) {
continue;
}

$containerSettings = $abSettings->getContainerSpecificSettings($container['Name']);
if (!$skipExclusionCheck) {
$containerSettings = $abSettings->getContainerSpecificSettings($container['Name']);

if (in_array($hostPath, $containerSettings['exclude'])) {
self::backupLog("Ignoring '$hostPath' because its listed in containers exclusions list!", self::LOGLEVEL_DEBUG);
continue;
if (in_array($hostPath, $containerSettings['exclude'])) {
self::backupLog("Ignoring '$hostPath' because its listed in containers exclusions list!", self::LOGLEVEL_DEBUG);
continue;
}
}

if (!file_exists($hostPath)) {
Expand Down
10 changes: 5 additions & 5 deletions src/pages/content/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,20 +575,20 @@ class="fa fa-clock-o title"></i>Notifications and scheduling</span>
}

$image = empty($container['Icon']) ? '/plugins/dynamix.docker.manager/images/question.png' : $container['Icon'];
$volumes = ABHelper::getContainerVolumes($container);
$volumes = ABHelper::getContainerVolumes($container, true);
$containerSetting = $abSettings->getContainerSpecificSettings($container['Name'], false);
$realContainerSetting = print_r($abSettings->getContainerSpecificSettings($container['Name']), true);

if (empty($volumes)) {
$volumes = "<b>No volumes - container will NOT being backed up!</b>";
} else {
foreach ($volumes as $index => $volume) {
$volumes[$index] = '<span class="fa ' . (!ABHelper::isVolumeWithinAppdata($volume) ? 'fa-external-link' : 'fa-folder') . '"></span> <code style="cursor:pointer;" data-container="' . $container['Name'] . '" onclick="addVolumeToExclude(this);">' . $volume . '</code><span style="display: none;" class="multiVolumeWarn"> - <a target="_blank" href="https://forums.unraid.net/topic/137710-plugin-appdatabackup/?do=findComment&comment=1250363">used in multiple containers!</a></span>';
$excluded = in_array($volume, $containerSetting['exclude']) ? ' - <abbr style="color: red; font-weight: bold;" title="Will not being backed up! See exclusions list below!">EXCLUDED!</abbr> ' : '';
$volumes[$index] = '<span class="fa ' . (!ABHelper::isVolumeWithinAppdata($volume) ? 'fa-external-link' : 'fa-folder') . '"></span> <code style="cursor:pointer;" data-container="' . $container['Name'] . '" onclick="addVolumeToExclude(this);">' . $volume . '</code>' . $excluded . '<span style="display: none;" class="multiVolumeWarn"> - <a target="_blank" href="https://forums.unraid.net/topic/137710-plugin-appdatabackup/?do=findComment&comment=1250363">used in multiple containers!</a></span>';
}
$volumes = implode('<br />', $volumes);
}

$containerSetting = $abSettings->getContainerSpecificSettings($container['Name'], false);
$realContainerSetting = print_r($abSettings->getContainerSpecificSettings($container['Name']), true);

$containerExcludes = implode("\r\n", $containerSetting['exclude']);

echo <<<HTML
Expand Down

0 comments on commit 9a2930c

Please sign in to comment.