mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add a global setting to still compress tar archives
This commit is contained in:
parent
7ccc7fa13e
commit
839a7b9a47
2 changed files with 6 additions and 5 deletions
|
@ -53,6 +53,7 @@ from yunohost.regenconf import regen_conf
|
||||||
from yunohost.log import OperationLogger
|
from yunohost.log import OperationLogger
|
||||||
from yunohost.utils.error import YunohostError
|
from yunohost.utils.error import YunohostError
|
||||||
from yunohost.utils.packages import ynh_packages_version
|
from yunohost.utils.packages import ynh_packages_version
|
||||||
|
from yunohost.settings import settings_get
|
||||||
|
|
||||||
BACKUP_PATH = '/home/yunohost.backup'
|
BACKUP_PATH = '/home/yunohost.backup'
|
||||||
ARCHIVES_PATH = '%s/archives' % BACKUP_PATH
|
ARCHIVES_PATH = '%s/archives' % BACKUP_PATH
|
||||||
|
@ -1772,15 +1773,14 @@ class CopyBackupMethod(BackupMethod):
|
||||||
|
|
||||||
class TarBackupMethod(BackupMethod):
|
class TarBackupMethod(BackupMethod):
|
||||||
|
|
||||||
"""
|
|
||||||
This class compress all files to backup in archive.
|
|
||||||
"""
|
|
||||||
|
|
||||||
method_name = "tar"
|
method_name = "tar"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _archive_file(self):
|
def _archive_file(self):
|
||||||
"""Return the compress archive path"""
|
|
||||||
|
if isinstance(self.manager, BackupManager) and settings_get("backup.compress_tar_archives"):
|
||||||
|
return os.path.join(self.repo, self.name + '.tar.gz')
|
||||||
|
|
||||||
f = os.path.join(self.repo, self.name + '.tar')
|
f = os.path.join(self.repo, self.name + '.tar')
|
||||||
if os.path.exists(f + ".gz"):
|
if os.path.exists(f + ".gz"):
|
||||||
f += ".gz"
|
f += ".gz"
|
||||||
|
|
|
@ -71,6 +71,7 @@ DEFAULTS = OrderedDict([
|
||||||
"choices": ["intermediate", "modern"]}),
|
"choices": ["intermediate", "modern"]}),
|
||||||
("pop3.enabled", {"type": "bool", "default": False}),
|
("pop3.enabled", {"type": "bool", "default": False}),
|
||||||
("smtp.allow_ipv6", {"type": "bool", "default": True}),
|
("smtp.allow_ipv6", {"type": "bool", "default": True}),
|
||||||
|
("backup.compress_tar_archives", {"type": "bool", "default": False}),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue