コード例 #1
0
ファイル: install.py プロジェクト: ricardomomm/wnframework
	def install_app(self, verbose=False):
		sync_for("lib", force=True, sync_everything=True, verbose=verbose)
		self.import_core_docs()

		try:
			from startup import install
		except ImportError, e:
			install = None
コード例 #2
0
    def install_app(self, verbose=False):
        sync_for("lib", force=True, sync_everything=True, verbose=verbose)
        self.import_core_docs()

        try:
            from startup import install
        except ImportError, e:
            install = None
コード例 #3
0
ファイル: install.py プロジェクト: rohitw1991/latestadbwnf
	def install_app(self):
		sync_for("lib", force=True, sync_everything=True)
		self.import_core_docs()

		try:
			from startup import install
		except ImportError, e:
			print "No app install found"
			return
コード例 #4
0
class Installer:
    def __init__(self, root_login, root_password=None):
        if root_login:
            if not root_password:
                root_password = getattr(conf, "root_password", None)
            if not root_password:
                root_password = getpass.getpass("MySQL root password: "******"""
		a very simplified version, just for the time being..will eventually be deprecated once the framework stabilizes.
		"""
        # delete user (if exists)
        self.dbman.delete_user(target)

        # create user and db
        self.dbman.create_user(target, conf.db_password)

        if verbose: print "Created user %s" % target

        # create a database
        self.dbman.create_database(target)
        if verbose: print "Created database %s" % target

        # grant privileges to user
        self.dbman.grant_all_privileges(target, target)
        if verbose:
            print "Granted privileges to user %s and database %s" % (target,
                                                                     target)

        # flush user privileges
        self.dbman.flush_privileges()

        self.conn.use(target)

        # import in target
        if verbose: print "Starting database import..."

        # get the path of the sql file to import
        source_given = True
        if not source_path:
            source_given = False
            source_path = os.path.join(
                os.path.sep.join(
                    os.path.abspath(webnotes.__file__).split(
                        os.path.sep)[:-3]), 'data', 'Framework.sql')

        self.dbman.restore_database(target, source_path, target,
                                    conf.db_password)
        if verbose: print "Imported from database %s" % source_path

        # fresh app
        if 'Framework.sql' in source_path:
            print "Installing app..."
            self.install_app()

        # update admin password
        self.create_auth_table()
        self.update_admin_password(password)
        return target

    def install_app(self):
        try:
            from startup import install
        except ImportError, e:
            print "No app install found"

        sync_for("lib", force=True, sync_everything=True)
        self.import_core_docs()
        install.pre_import()
        sync_for("app", force=True, sync_everything=True)
        print "Completing App Import..."
        install.post_import()
        print "Updating patches..."
        self.set_all_patches_as_completed()
コード例 #5
0
class Installer:
    def __init__(self,
                 root_login,
                 root_password=None,
                 db_name=None,
                 site=None,
                 site_config=None):
        make_conf(db_name, site=site, site_config=site_config)
        self.site = site

        self.make_connection(root_login, root_password)

        webnotes.local.conn = self.conn
        webnotes.local.session = webnotes._dict({'user': '******'})

        self.dbman = DbManager(self.conn)

    def make_connection(self, root_login, root_password):
        if root_login:
            if not root_password:
                root_password = webnotes.conf.get("root_password") or None

            if not root_password:
                root_password = getpass.getpass("MySQL root password: "******"Database %s already exists" % (db_name, ))

        # create user and db
        self.dbman.create_user(db_name, webnotes.conf.db_password)

        if verbose: print "Created user %s" % db_name

        # create a database
        self.dbman.create_database(db_name)
        if verbose: print "Created database %s" % db_name

        # grant privileges to user
        self.dbman.grant_all_privileges(db_name, db_name)
        if verbose:
            print "Granted privileges to user %s and database %s" % (db_name,
                                                                     db_name)

        # flush user privileges
        self.dbman.flush_privileges()

        # close root connection
        self.conn.close()

        webnotes.connect(db_name=db_name, site=self.site)
        self.dbman = DbManager(webnotes.conn)

        # import in db_name
        if verbose: print "Starting database import..."

        # get the path of the sql file to import
        if not source_sql:
            source_sql = os.path.join(os.path.dirname(webnotes.__file__), "..",
                                      'conf', 'Framework.sql')

        self.dbman.restore_database(db_name, source_sql, db_name,
                                    webnotes.conf.db_password)
        if verbose: print "Imported from database %s" % source_sql

        self.create_auth_table()

        # fresh app
        if 'Framework.sql' in source_sql:
            if verbose: print "Installing app..."
            self.install_app(verbose=verbose)

        # update admin password
        self.update_admin_password(admin_password)

        # create public folder
        from webnotes.install_lib import setup_public_folder
        setup_public_folder.make(site=self.site)

        if not self.site:
            from webnotes.build import bundle
            bundle(False)

        return db_name

    def install_app(self, verbose=False):
        sync_for("lib", force=True, sync_everything=True, verbose=verbose)
        self.import_core_docs()

        try:
            from startup import install
        except ImportError, e:
            install = None

        if os.path.exists("app"):
            sync_for("app", force=True, sync_everything=True, verbose=verbose)

        if os.path.exists(os.path.join("app", "startup", "install_fixtures")):
            install_fixtures()

        if verbose: print "Completing App Import..."
        install and install.post_import()
        if verbose: print "Updating patches..."
        self.set_all_patches_as_completed()
        self.assign_all_role_to_administrator()