Пример #1
0
    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)
Пример #2
0
        # CREATE PERMISSIONS FOR MOUDLE
        try:
            Permission.create_permissions_for_module(module)
        except PermissionException, e: #revert on error
            cls._unregister_module(module)
            shutil.rmtree(modulepath)
            os.remove(datapath)
            raise e

        # CREATE DATBASE TABLES FOR MODULE
        try:
            db.create_tables_for_module(module)
        except DatabaseException, e:
            cls._unregister_module(module)
            shutil.rmtree(modulepath)
            Permission.remove_permissions_for_module(module)
            os.remove(datapath)
            raise e
        
        os.remove(datapath)
        PokeManager.add_activity(ActivityType.MODULE)

    @classmethod
    def update_module(cls,module):
        """
        updates the given module
        """
        # - neueste versionsnummer holen
        # - pruefen ob bereits auf fs vorhanden
        #   - wenn nein, holen
        # - neues modul laden