[REFACTOR] Rename utils.py to backup.py and update import statements across the project

This commit is contained in:
Théophile Diot 2025-01-17 09:40:52 +01:00
parent 9e4c35b1e1
commit 65a611072b
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
5 changed files with 6 additions and 6 deletions

View file

@ -21,7 +21,7 @@ from Database import Database # type: ignore
from logger import setup_logger # type: ignore
from model import Base # type: ignore
LOGGER = setup_logger("BACKUP", getenv("LOG_LEVEL", "INFO"))
LOGGER = setup_logger("BACKUP")
DB_STRING_RX = re_compile(r"^(?P<database>(mariadb|mysql)(\+pymysql)?|sqlite(\+pysqlite)?|postgresql(\+psycopg)?):/+(?P<path>/[^\s]+)")
BACKUP_DIR = Path(getenv("BACKUP_DIRECTORY", "/var/lib/bunkerweb/backups"))

View file

@ -8,7 +8,7 @@ deps_path = join(sep, "usr", "share", "bunkerweb", "core", "backup")
if deps_path not in sys_path:
sys_path.append(deps_path)
from utils import BACKUP_DIR, LOGGER
from backup import BACKUP_DIR, LOGGER
try:
backups = sorted(BACKUP_DIR.glob("*.zip"), reverse=True)

View file

@ -10,7 +10,7 @@ deps_path = join(sep, "usr", "share", "bunkerweb", "core", "backup")
if deps_path not in sys_path:
sys_path.append(deps_path)
from utils import acquire_db_lock, backup_database, BACKUP_DIR, DB_LOCK_FILE, LOGGER, restore_database
from backup import acquire_db_lock, backup_database, BACKUP_DIR, DB_LOCK_FILE, LOGGER, restore_database
status = 0

View file

@ -10,7 +10,7 @@ deps_path = join(sep, "usr", "share", "bunkerweb", "core", "backup")
if deps_path not in sys_path:
sys_path.append(deps_path)
from utils import acquire_db_lock, backup_database, BACKUP_DIR, DB_LOCK_FILE, LOGGER, update_cache_file
from backup import acquire_db_lock, backup_database, BACKUP_DIR, DB_LOCK_FILE, LOGGER, update_cache_file
status = 0

View file

@ -14,9 +14,9 @@ for deps_path in [join(sep, "usr", "share", "bunkerweb", *paths) for paths in ((
from Database import Database # type: ignore
from logger import setup_logger # type: ignore
from jobs import Job # type: ignore
from utils import backup_database, update_cache_file
from backup import backup_database, update_cache_file
LOGGER = setup_logger("BACKUP", getenv("LOG_LEVEL", "INFO"))
LOGGER = setup_logger("BACKUP")
status = 0
try: