瀏覽代碼

[cli] added --remove_from_installed_apps

version-14
Rushabh Mehta 11 年之前
父節點
當前提交
4e9f796298
共有 4 個文件被更改,包括 36 次插入10 次删除
  1. +8
    -1
      frappe/__init__.py
  2. +13
    -3
      frappe/cli.py
  3. +14
    -5
      frappe/installer.py
  4. +1
    -1
      frappe/utils/backups.py

+ 8
- 1
frappe/__init__.py 查看文件

@@ -438,7 +438,14 @@ def get_hooks(hook=None, default=None, app_name=None):
hooks = {}
for app in [app_name] if app_name else get_installed_apps():
app = "frappe" if app=="webnotes" else app
app_hooks = get_module(app + ".hooks")
try:
app_hooks = get_module(app + ".hooks")
except ImportError:
if local.flags.in_install_app:
# if app is not installed while restoring
# ignore it
pass
raise
for key in dir(app_hooks):
if not key.startswith("_"):
append_hook(hooks, key, getattr(app_hooks, key))


+ 13
- 3
frappe/cli.py 查看文件

@@ -140,6 +140,8 @@ def setup_install(parser):
help="Install a new app")
parser.add_argument("--add_to_installed_apps", metavar="APP-NAME", nargs="*",
help="Add these app(s) to Installed Apps")
parser.add_argument("--remove_from_installed_apps", metavar="APP-NAME", nargs="*",
help="Remove these app(s) from Installed Apps")
parser.add_argument("--reinstall", default=False, action="store_true",
help="Install a fresh app in db_name specified in conf.py")
parser.add_argument("--restore", metavar=("DB-NAME", "SQL-FILE"), nargs=2,
@@ -352,9 +354,17 @@ def add_to_installed_apps(*apps):
from frappe.installer import add_to_installed_apps
frappe.connect()
all_apps = frappe.get_all_apps(with_frappe=True)
for each in apps:
if each in all_apps:
add_to_installed_apps(each, rebuild_website=False)
for app in apps:
if app in all_apps:
add_to_installed_apps(app, rebuild_website=False)
frappe.destroy()

@cmd
def remove_from_installed_apps(*apps):
from frappe.installer import remove_from_installed_apps
frappe.connect()
for app in apps:
remove_from_installed_apps(app)
frappe.destroy()

@cmd


+ 14
- 5
frappe/installer.py 查看文件

@@ -127,14 +127,23 @@ def add_to_installed_apps(app_name, rebuild_website=True):
installed_apps.append(app_name)
frappe.db.set_global("installed_apps", json.dumps(installed_apps))
frappe.db.commit()
post_install(rebuild_website)

if rebuild_website:
render.clear_cache()
statics.sync().start()

def remove_from_installed_apps(app_name):
installed_apps = frappe.get_installed_apps()
if app_name in installed_apps:
installed_apps.remove(app_name)
frappe.db.set_global("installed_apps", json.dumps(installed_apps))
frappe.db.commit()
post_install()

frappe.clear_cache()
def post_install(rebuild_website=False):
if rebuild_website:
render.clear_cache()
statics.sync().start()

frappe.db.commit()
frappe.clear_cache()

def set_all_patches_as_completed(app):
patch_path = os.path.join(frappe.get_pymodule_path(app), "patches.txt")


+ 1
- 1
frappe/utils/backups.py 查看文件

@@ -133,7 +133,7 @@ def get_backup():
frappe.conf.db_password, db_host = frappe.db.host)
odb.get_backup()
recipient_list = odb.send_email()
frappe.msgprint(_("Download link for your backup will be emailed on the following email address:").format(', '.join(recipient_list)))
frappe.msgprint(_("Download link for your backup will be emailed on the following email address: {0}").format(', '.join(recipient_list)))

def scheduled_backup(older_than=6, ignore_files=False, backup_path_db=None, backup_path_files=None):
"""this function is called from scheduler


Loading…
取消
儲存