mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-10-06 05:24:37 +08:00
rework getbackupvolumes and getallbackupvolumes to be a bit more easy to read and understand
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
a32b5c1bcf
commit
e2dd2f8fcf
1 changed files with 8 additions and 13 deletions
|
@ -510,29 +510,24 @@ class DockerActionManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBackupVolumes(string $id) : array
|
private function getBackupVolumes(string $id) : string
|
||||||
{
|
{
|
||||||
$container = $this->containerDefinitionFetcher->GetContainerById($id);
|
$container = $this->containerDefinitionFetcher->GetContainerById($id);
|
||||||
|
|
||||||
$backupVolumes = $container->GetBackupVolumes();
|
$backupVolumes = '';
|
||||||
|
foreach ($container->GetBackupVolumes() as $backupVolume) {
|
||||||
|
$backupVolumes .= $backupVolume . ' ';
|
||||||
|
}
|
||||||
foreach ($container->GetDependsOn() as $dependency) {
|
foreach ($container->GetDependsOn() as $dependency) {
|
||||||
$backupVolumes[] = $this->getBackupVolumes($dependency);
|
$backupVolumes .= $this->getBackupVolumes($dependency);
|
||||||
}
|
}
|
||||||
return $backupVolumes;
|
return $backupVolumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAllBackupVolumes() : array {
|
private function getAllBackupVolumes() : array {
|
||||||
$id = 'nextcloud-aio-apache';
|
$id = 'nextcloud-aio-apache';
|
||||||
$backupVolumesArray = $this->getBackupVolumes($id);
|
$backupVolumesArray = explode(' ', $this->getBackupVolumes($id));
|
||||||
// Flatten array
|
return array_unique($backupVolumesArray);
|
||||||
$backupVolumesArrayFlat = iterator_to_array(
|
|
||||||
new \RecursiveIteratorIterator(
|
|
||||||
new \RecursiveArrayIterator($backupVolumesArray)
|
|
||||||
),
|
|
||||||
$use_keys = false
|
|
||||||
);
|
|
||||||
return array_unique($backupVolumesArrayFlat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetRepoDigestsOfContainer(string $containerName) : ?array {
|
private function GetRepoDigestsOfContainer(string $containerName) : ?array {
|
||||||
|
|
Loading…
Add table
Reference in a new issue