@@ -410,8 +410,8 @@ def get_module_list(app_name): | |||||
def get_all_apps(with_frappe=False, with_internal_apps=True, sites_path=None): | def get_all_apps(with_frappe=False, with_internal_apps=True, sites_path=None): | ||||
if not sites_path: | if not sites_path: | ||||
sites_path = local.sites_path | sites_path = local.sites_path | ||||
apps = get_file_items(os.path.join(sites_path, "apps.txt")) | |||||
apps = get_file_items(os.path.join(sites_path, "apps.txt"), raise_not_found=True) | |||||
if with_internal_apps: | if with_internal_apps: | ||||
apps.extend(get_file_items(os.path.join(local.site_path, "apps.txt"))) | apps.extend(get_file_items(os.path.join(local.site_path, "apps.txt"))) | ||||
if with_frappe: | if with_frappe: | ||||
@@ -465,8 +465,8 @@ def setup_module_map(): | |||||
_cache.set_value("app_modules", local.app_modules) | _cache.set_value("app_modules", local.app_modules) | ||||
_cache.set_value("module_app", local.module_app) | _cache.set_value("module_app", local.module_app) | ||||
def get_file_items(path): | |||||
content = read_file(path) | |||||
def get_file_items(path, raise_not_found=False): | |||||
content = read_file(path, raise_not_found=raise_not_found) | |||||
if content: | if content: | ||||
return [p.strip() for p in content.splitlines() if p.strip() and not p.startswith("#")] | return [p.strip() for p in content.splitlines() if p.strip() and not p.startswith("#")] | ||||
else: | else: | ||||
@@ -476,10 +476,12 @@ def get_file_json(path): | |||||
with open(path, 'r') as f: | with open(path, 'r') as f: | ||||
return json.load(f) | return json.load(f) | ||||
def read_file(path): | |||||
def read_file(path, raise_not_found=False): | |||||
if os.path.exists(path): | if os.path.exists(path): | ||||
with open(path, "r") as f: | with open(path, "r") as f: | ||||
return unicode(f.read(), encoding="utf-8") | return unicode(f.read(), encoding="utf-8") | ||||
elif raise_not_found: | |||||
raise IOError("{} Not Found".format(path)) | |||||
else: | else: | ||||
return None | return None | ||||
@@ -255,7 +255,7 @@ def install(db_name, root_login="root", root_password=None, source_sql=None, | |||||
install_db(root_login=root_login, root_password=root_password, db_name=db_name, source_sql=source_sql, | install_db(root_login=root_login, root_password=root_password, db_name=db_name, source_sql=source_sql, | ||||
admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall) | admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall) | ||||
make_site_dirs() | make_site_dirs() | ||||
install_app("frappe", verbose=verbose) | |||||
install_app("frappe", verbose=verbose, set_as_patched=not source_sql) | |||||
frappe.destroy() | frappe.destroy() | ||||
@cmd | @cmd | ||||
@@ -83,7 +83,7 @@ def make_connection(root_login, root_password): | |||||
return frappe.database.Database(user=root_login, password=root_password) | return frappe.database.Database(user=root_login, password=root_password) | ||||
@frappe.whitelist() | @frappe.whitelist() | ||||
def install_app(name, verbose=False): | |||||
def install_app(name, verbose=False, set_as_patched=True): | |||||
frappe.flags.in_install_app = name | frappe.flags.in_install_app = name | ||||
frappe.clear_cache() | frappe.clear_cache() | ||||
@@ -104,11 +104,12 @@ def install_app(name, verbose=False): | |||||
sync_for(name, force=True, sync_everything=True, verbose=verbose) | sync_for(name, force=True, sync_everything=True, verbose=verbose) | ||||
add_to_installed_apps(name) | add_to_installed_apps(name) | ||||
set_all_patches_as_completed(name) | |||||
if set_as_patched: | |||||
set_all_patches_as_completed(name) | |||||
for after_install in app_hooks.after_install or []: | for after_install in app_hooks.after_install or []: | ||||
frappe.get_attr(after_install)() | frappe.get_attr(after_install)() | ||||
frappe.flags.in_install_app = False | frappe.flags.in_install_app = False | ||||
@@ -19,4 +19,5 @@ frappe.patches.4_0.rename_sitemap_to_route | |||||
frappe.patches.4_0.set_website_route_idx | frappe.patches.4_0.set_website_route_idx | ||||
execute:import frappe.installer;frappe.installer.make_site_dirs() #2014-02-19 | execute:import frappe.installer;frappe.installer.make_site_dirs() #2014-02-19 | ||||
frappe.patches.4_0.private_backups | frappe.patches.4_0.private_backups | ||||
frappe.patches.4_0.set_module_in_report | |||||
frappe.patches.4_0.set_module_in_report | |||||
frappe.patches.4_0.remove_old_parent |
@@ -0,0 +1,9 @@ | |||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | |||||
# MIT License. See license.txt | |||||
from __future__ import unicode_literals | |||||
import frappe | |||||
def execute(): | |||||
for doctype in frappe.db.sql_list("""select name from `tabDocType` where istable=1"""): | |||||
frappe.db.sql("""delete from `tab{0}` where parent like "old_par%:%" """.format(doctype)) |