| Server IP : 93.115.150.27 / Your IP : 216.73.216.221 Web Server : LiteSpeed System : Linux host2.azar.host 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64 User : dorfakkh ( 1797) PHP Version : 8.1.34 Disable Function : show_source, system, passthru, exec, popen, proc_open, mail MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/imunify360/venv/lib/python3.11/site-packages/restore_infected/backup_backends/ |
Upload File : |
import importlib
import logging
from ..backup_backends_lib import asyncable, BackendNonApplicableError
logger = logging.getLogger(__name__)
def _stub(*_, **__):
pass
def backend(name, async_=False):
logger.debug('Importing backend %s (async=%r)', name, async_)
rel_name = '.' + name
try:
backup_backend = importlib.import_module(rel_name, __name__)
except (ImportError, ValueError):
raise ValueError('unsupported backup backend: ' + name)
if not backup_backend.is_suitable():
raise BackendNonApplicableError(
"backup backend can't be used: " + name)
for func in ('init', 'cleanup', 'info', 'pre_backups'):
if not hasattr(backup_backend, func):
setattr(backup_backend, func, _stub)
for func in ('init', 'backups', 'cleanup', 'info', 'pre_backups'):
func_obj = getattr(backup_backend, func)
if hasattr(func_obj, 'async_'):
# `asyncable` already applied
continue
func_obj_async = asyncable(func_obj)
setattr(backup_backend, func, func_obj_async)
if async_:
for entry in dir(backup_backend):
entry_obj = getattr(backup_backend, entry)
if hasattr(entry_obj, 'async_'):
entry_obj.async_ = True
return backup_backend