backup: Add option `--skip-uploads` to skip uploads backup.

This commit is contained in:
Shubham Padia 2019-04-17 15:50:11 +08:00 committed by Tim Abbott
parent 984d3f2f0e
commit 32cf192b9b
2 changed files with 3 additions and 1 deletions

View File

@ -346,6 +346,7 @@ su zulip -c '/home/zulip/deployments/current/manage.py backup'
The backup tool provides the following options: The backup tool provides the following options:
- `--skip-db`: If set, the tool will skip the backup of your database. - `--skip-db`: If set, the tool will skip the backup of your database.
- `--skip-uploads`: If set, the tool will skip the backup of the uploads.
This will generate a `.tar.gz` archive containing all the data stored This will generate a `.tar.gz` archive containing all the data stored
on your Zulip server that would be needed to restore your Zulip on your Zulip server that would be needed to restore your Zulip

View File

@ -26,6 +26,7 @@ class Command(ZulipBaseCommand):
"output", default=None, nargs="?", help="Filename of output tarball" "output", default=None, nargs="?", help="Filename of output tarball"
) )
parser.add_argument("--skip-db", action='store_true', help="Skip database backup") parser.add_argument("--skip-db", action='store_true', help="Skip database backup")
parser.add_argument("--skip-uploads", action='store_true', help="Skip uploads backup")
def handle(self, *args: Any, **options: Any) -> None: def handle(self, *args: Any, **options: Any) -> None:
timestamp = timezone_now().strftime(TIMESTAMP_FORMAT) timestamp = timezone_now().strftime(TIMESTAMP_FORMAT)
@ -74,7 +75,7 @@ class Command(ZulipBaseCommand):
) )
members.append("zulip-backup/database") members.append("zulip-backup/database")
if settings.LOCAL_UPLOADS_DIR is not None and os.path.exists( if not options['skip_uploads'] and settings.LOCAL_UPLOADS_DIR is not None and os.path.exists(
os.path.join(settings.DEPLOY_ROOT, settings.LOCAL_UPLOADS_DIR) os.path.join(settings.DEPLOY_ROOT, settings.LOCAL_UPLOADS_DIR)
): ):
members.append( members.append(