예제 #1
0
def upgrade_plugin(plugin_identifier):
    """Uninstalls a plugin from FlaskBB."""
    validate_plugin(plugin_identifier)
    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Upgrading plugin {}...".format(plugin.name), fg="cyan")
    try:
        plugin.upgrade_database()
    except AttributeError:
        pass
예제 #2
0
def uninstall_plugin(plugin_identifier):
    """Uninstalls a plugin from FlaskBB."""
    validate_plugin(plugin_identifier)
    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Uninstalling plugin {}...".format(plugin.name), fg="cyan")
    try:
        plugin_manager.uninstall_plugins([plugin])
    except AttributeError:
        pass
예제 #3
0
def uninstall_plugin(plugin_identifier):
    """Uninstalls a plugin from FlaskBB."""
    validate_plugin(plugin_identifier)
    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Uninstalling plugin {}...".format(plugin.name), fg="cyan")
    try:
        plugin_manager.uninstall_plugins([plugin])
    except AttributeError:
        pass
예제 #4
0
def migrate_plugin(plugin_identifier):
    """Installs a new plugin."""
    validate_plugin(plugin_identifier)
    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Updating plugin migrations{}...".format(plugin.name), fg="cyan")
    try:
        plugin.migrate()
    except Exception as e:
        click.secho("[-] Couldn't generate migrations for plugin because of following "
                    "exception: \n{}".format(e), fg="red")
예제 #5
0
def install_plugin(plugin_identifier):
    """Installs a new plugin."""
    validate_plugin(plugin_identifier)
    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Installing plugin {}...".format(plugin.name), fg="cyan")
    try:
        plugin_manager.install_plugins([plugin])
    except Exception as e:
        click.secho("[-] Couldn't install plugin because of following "
                    "exception: \n{}".format(e), fg="red")
예제 #6
0
def compile_translation(is_all, plugin):
    """Compiles the translations."""
    if plugin is not None:
        validate_plugin(plugin)
        click.secho("[+] Compiling language files for plugin {}..."
                    .format(plugin), fg="cyan")
        compile_plugin_translations(plugin)
    else:
        click.secho("[+] Compiling language files...", fg="cyan")
        compile_translations(include_plugins=is_all)
예제 #7
0
파일: plugins.py 프로젝트: samhains/plutoc
def install_plugin(plugin_identifier):
    """Installs a new plugin."""
    validate_plugin(plugin_identifier)
    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Installing plugin {}...".format(plugin.name), fg="cyan")
    try:
        plugin_manager.install_plugins([plugin])
    except Exception as e:
        click.secho("[-] Couldn't install plugin because of following "
                    "exception: \n{}".format(e), fg="red")
예제 #8
0
def update_translation(is_all, plugin):
    """Updates all translations."""
    if plugin is not None:
        validate_plugin(plugin)
        click.secho("[+] Updating language files for plugin {}..."
                    .format(plugin), fg="cyan")
        update_plugin_translations(plugin)
    else:
        click.secho("[+] Updating language files...", fg="cyan")
        update_translations(include_plugins=is_all)
예제 #9
0
def new_translation(lang, plugin):
    """Adds a new language to the translations. "lang" is the language code
    of the language, like, "de_AT"."""
    if plugin:
        validate_plugin(plugin)
        click.secho("[+] Adding new language {} for plugin {}..."
                    .format(lang, plugin), fg="cyan")
        add_plugin_translations(plugin, lang)
    else:
        click.secho("[+] Adding new language {}...".format(lang), fg="cyan")
        add_translations(lang)
예제 #10
0
def disable_plugin(plugin_name):
    """Disables a plugin."""
    validate_plugin(plugin_name)
    plugin = PluginRegistry.query.filter_by(name=plugin_name).first_or_404()

    if not plugin.enabled:
        click.secho("Plugin '{}' is already disabled.".format(plugin.name))

    plugin.enabled = False
    plugin.save()
    click.secho("[+] Plugin '{}' disabled.".format(plugin.name), fg="green")
예제 #11
0
def uninstall(plugin_name):
    """Uninstalls a plugin (no migrations)."""
    validate_plugin(plugin_name)
    plugin = PluginRegistry.query.filter_by(name=plugin_name).first_or_404()

    if plugin.is_installed:
        PluginStore.query.filter_by(plugin_id=plugin.id).delete()
        db.session.commit()
        click.secho("[+] Plugin has been uninstalled.", fg="green")
    else:
        click.secho("[+] Nothing to uninstall.", fg="green")
예제 #12
0
파일: plugins.py 프로젝트: eirnym/flaskbb
def disable_plugin(plugin_name):
    """Disables a plugin."""
    validate_plugin(plugin_name)
    plugin = PluginRegistry.query.filter_by(name=plugin_name).first_or_404()

    if not plugin.enabled:
        click.secho("Plugin '{}' is already disabled.".format(plugin.name))

    plugin.enabled = False
    plugin.save()
    click.secho("[+] Plugin '{}' disabled.".format(plugin.name), fg="green")
예제 #13
0
파일: plugins.py 프로젝트: eirnym/flaskbb
def uninstall(plugin_name):
    """Uninstalls a plugin (no migrations)."""
    validate_plugin(plugin_name)
    plugin = PluginRegistry.query.filter_by(name=plugin_name).first_or_404()

    if plugin.is_installed:
        PluginStore.query.filter_by(plugin_id=plugin.id).delete()
        db.session.commit()
        click.secho("[+] Plugin has been uninstalled.", fg="green")
    else:
        click.secho("[+] Nothing to uninstall.", fg="green")
예제 #14
0
파일: plugins.py 프로젝트: eirnym/flaskbb
def install(plugin_name, force):
    """Installs a plugin (no migrations)."""
    validate_plugin(plugin_name)
    plugin = PluginRegistry.query.filter_by(name=plugin_name).first_or_404()

    if not plugin.enabled:
        click.secho("[+] Can't install disabled plugin. "
                    "Enable '{}' Plugin first.".format(plugin.name), fg="red")
        sys.exit(0)

    if plugin.is_installable:
        plugin_module = current_app.pluggy.get_plugin(plugin.name)
        plugin.add_settings(plugin_module.SETTINGS, force)
        click.secho("[+] Plugin has been installed.", fg="green")
    else:
        click.secho("[+] Nothing to install.", fg="green")
예제 #15
0
def install(plugin_name, force):
    """Installs a plugin (no migrations)."""
    validate_plugin(plugin_name)
    plugin = PluginRegistry.query.filter_by(name=plugin_name).first_or_404()

    if not plugin.enabled:
        click.secho("[+] Can't install disabled plugin. "
                    "Enable '{}' Plugin first.".format(plugin.name),
                    fg="red")
        sys.exit(0)

    if plugin.is_installable:
        plugin_module = current_app.pluggy.get_plugin(plugin.name)
        plugin.add_settings(plugin_module.SETTINGS, force)
        click.secho("[+] Plugin has been installed.", fg="green")
    else:
        click.secho("[+] Nothing to install.", fg="green")
예제 #16
0
def remove_plugin(plugin_identifier, force):
    """Removes a plugin from the filesystem."""
    validate_plugin(plugin_identifier)
    if not force and not \
            click.confirm(click.style("Are you sure?", fg="magenta")):
        sys.exit(0)

    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Uninstalling plugin {}...".format(plugin.name), fg="cyan")
    try:
        plugin_manager.uninstall_plugins([plugin])
    except Exception as e:
        click.secho("[-] Couldn't uninstall plugin because of following "
                    "exception: \n{}".format(e), fg="red")
        if not click.confirm(click.style(
            "Do you want to continue anyway?", fg="magenta")
        ):
            sys.exit(0)

    click.secho("[+] Removing plugin from filesystem...", fg="cyan")
    shutil.rmtree(plugin.path, ignore_errors=False, onerror=None)
예제 #17
0
def remove_plugin(plugin_identifier, force):
    """Removes a plugin from the filesystem."""
    validate_plugin(plugin_identifier)
    if not force and not \
            click.confirm(click.style("Are you sure?", fg="magenta")):
        sys.exit(0)

    plugin = get_plugin_from_all(plugin_identifier)
    click.secho("[+] Uninstalling plugin {}...".format(plugin.name), fg="cyan")
    try:
        plugin_manager.uninstall_plugins([plugin])
    except Exception as e:
        click.secho("[-] Couldn't uninstall plugin because of following "
                    "exception: \n{}".format(e),
                    fg="red")
        if not click.confirm(
                click.style("Do you want to continue anyway?", fg="magenta")):
            sys.exit(0)

    click.secho("[+] Removing plugin from filesystem...", fg="cyan")
    shutil.rmtree(plugin.path, ignore_errors=False, onerror=None)