Queue and track website restores from the hosting panel
This commit is contained in:
1 parent
b9e54c9575
commit
215894aa24
13 files changed
+718
-3
No files matched your search
@@ -11,6 +11,7 @@ from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from coulobre.account_backup_request import backup_archive
|
||||
from coulobre.account_restore_request import MAX_RESTORE_PATH_BYTES
|
||||
from coulobre.database_node import (
|
||||
DATABASE_SUFFIX_PATTERN,
|
||||
INVALID_SUFFIX,
|
||||
@@ -458,6 +459,27 @@ class AccountBackupJob(ProvisioningJob):
|
||||
def includes_mailboxes(self):
|
||||
return "mailboxes" in self.manifest
|
||||
|
||||
def can_restore_website(self, site):
|
||||
return (
|
||||
self.state == "configured"
|
||||
and self.manifest.get("website") == site.manifest()
|
||||
)
|
||||
|
||||
|
||||
class WebsiteRestoreJob(ProvisioningJob):
|
||||
backup = models.ForeignKey(
|
||||
AccountBackupJob,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="website_restores",
|
||||
)
|
||||
restore_id = models.UUIDField(unique=True, editable=False)
|
||||
filename = models.CharField(max_length=MAX_RESTORE_PATH_BYTES, blank=True)
|
||||
replace = models.BooleanField(default=False)
|
||||
operator_username = models.CharField(max_length=150)
|
||||
|
||||
class Meta:
|
||||
indexes = [models.Index(fields=("finished_at", "requested_at"))]
|
||||
|
||||
|
||||
class AccountBackupSchedule(models.Model):
|
||||
class Frequency(models.TextChoices):
|
||||
|
||||
Reference in new issue
Block a user