Merge pull request #1720 from shreyasp/drop-site-cmd

[Minor] Archiving sites on bench to custom path instead of default path
This commit is contained in:
Anand Doshi 2016-04-21 12:04:05 +05:30
commit c693686c54

View file

@ -986,7 +986,8 @@ def set_config(context, key, value):
@click.argument('site')
@click.option('--root-login', default='root')
@click.option('--root-password')
def drop_site(site, root_login='root', root_password=None):
@click.option('--archived-sites-path')
def drop_site(site, root_login='root', root_password=None, archived_sites_path=None):
from frappe.installer import get_current_host, make_connection
from frappe.model.db_schema import DbManager
from frappe.utils.backups import scheduled_backup
@ -1001,10 +1002,13 @@ def drop_site(site, root_login='root', root_password=None):
dbman.delete_user(db_name, get_current_host())
dbman.drop_database(db_name)
archived_sites_dir = os.path.join(frappe.get_app_path('frappe'), '..', '..', '..', 'archived_sites')
if not os.path.exists(archived_sites_dir):
os.mkdir(archived_sites_dir)
move(archived_sites_dir, site)
if not archived_sites_path:
archived_sites_path = os.path.join(frappe.get_app_path('frappe'), '..', '..', '..', 'archived_sites')
if not os.path.exists(archived_sites_path):
os.mkdir(archived_sites_path)
move(archived_sites_path, site)
@click.command('version')
def get_version():