コード例 #1
0
ファイル: module.py プロジェクト: skarphed/skarphed
    def uninstall_module(cls,module, hard=False):
        """
        uninstall a module
        the flag "hard" actually deletes the files of this module in modpath
        module can be module or module meta
        """
        if module.__class__.__name__ != "Module":
            nr = cls._get_module_id_from_name(module_meta["name"])
            module = cls.get_module(nr)

        Action.delete_actions_with_module(module)
        View.delete_mappings_with_module(module)
        CSSManager().delete_definitions_with_module(module)

        db = Database()
        db.remove_tables_for_module(module)
        Permission.remove_permissions_for_module(module)

        if hard:
            modpath = Configuration().get_entry('global.modpath')
            version = module.get_version()
            shutil.rmtree(modpath+"/"+module.get_name()+"/v"+version[0]+"_"+version[1]+"_"+version[2])

        cls._unregister_module(module)
        PokeManager.add_activity(ActivityType.MODULE)