mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
backups: Use the backup component in all apps
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
1 parent
f630fb6059
commit
fb1898befc
105 files changed
+748
-644
No files matched your search
@@ -11,11 +11,12 @@ from plinth import app as app_module
|
||||
from plinth import cfg, frontpage, menu
|
||||
from plinth.daemon import Daemon
|
||||
from plinth.modules.apache.components import Webserver
|
||||
from plinth.modules.backups.components import BackupRestore
|
||||
from plinth.modules.firewall.components import Firewall
|
||||
from plinth.modules.users.components import UsersAndGroups
|
||||
from plinth.utils import Version, format_lazy
|
||||
|
||||
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||
from . import manifest
|
||||
|
||||
version = 3
|
||||
|
||||
@@ -56,7 +57,8 @@ class TTRSSApp(app_module.App):
|
||||
name=_('Tiny Tiny RSS'), icon_filename='ttrss',
|
||||
short_description=_('News Feed Reader'),
|
||||
description=_description,
|
||||
manual_page='TinyTinyRSS', clients=clients)
|
||||
manual_page='TinyTinyRSS',
|
||||
clients=manifest.clients)
|
||||
self.add(info)
|
||||
|
||||
menu_item = menu.Menu('menu-ttrss', info.name, info.short_description,
|
||||
@@ -87,12 +89,28 @@ class TTRSSApp(app_module.App):
|
||||
groups=groups)
|
||||
self.add(users_and_groups)
|
||||
|
||||
backup_restore = TTRSSBackupRestore('backup-restore-ttrss',
|
||||
**manifest.backup)
|
||||
self.add(backup_restore)
|
||||
|
||||
def enable(self):
|
||||
"""Enable components and API access."""
|
||||
super().enable()
|
||||
actions.superuser_run('ttrss', ['enable-api-access'])
|
||||
|
||||
|
||||
class TTRSSBackupRestore(BackupRestore):
|
||||
"""Component to backup/restore TT-RSS"""
|
||||
|
||||
def backup_pre(self, packet):
|
||||
"""Save database contents."""
|
||||
actions.superuser_run('ttrss', ['dump-database'])
|
||||
|
||||
def restore_post(self, packet):
|
||||
"""Restore database contents."""
|
||||
actions.superuser_run('ttrss', ['restore-database'])
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
"""Install and configure the module."""
|
||||
helper.call('pre', actions.superuser_run, 'ttrss', ['pre-setup'])
|
||||
@@ -114,13 +132,3 @@ def force_upgrade(helper, packages):
|
||||
helper.install(['tt-rss'], force_configuration='new')
|
||||
actions.superuser_run('ttrss', ['setup'])
|
||||
return True
|
||||
|
||||
|
||||
def backup_pre(packet):
|
||||
"""Save database contents."""
|
||||
actions.superuser_run('ttrss', ['dump-database'])
|
||||
|
||||
|
||||
def restore_post(packet):
|
||||
"""Restore database contents."""
|
||||
actions.superuser_run('ttrss', ['restore-database'])
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from plinth.modules.backups.api import validate as validate_backup
|
||||
from plinth.clients import store_url, validate
|
||||
|
||||
clients = validate([{
|
||||
@@ -28,7 +27,7 @@ clients = validate([{
|
||||
}]
|
||||
}])
|
||||
|
||||
backup = validate_backup({
|
||||
backup = {
|
||||
'data': {
|
||||
'files': ['/var/lib/plinth/backups-data/ttrss-database.sql']
|
||||
},
|
||||
@@ -36,4 +35,4 @@ backup = validate_backup({
|
||||
'files': ['/etc/tt-rss/database.php']
|
||||
},
|
||||
'services': ['tt-rss']
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user