Просмотр исходного кода

Make it optional to remove plugins from db

Peter Justin 7 лет назад
Родитель
Сommit
63dc9fc463
2 измененных файлов с 8 добавлено и 3 удалено
  1. 3 1
      flaskbb/app.py
  2. 5 2
      flaskbb/configs/default.py

+ 3 - 1
flaskbb/app.py

@@ -406,7 +406,9 @@ def load_plugins(app):
     with app.app_context():
         db.session.add_all(unregistered)
         db.session.commit()
-        removed = remove_zombie_plugins_from_db()
+
+        if app.config["REMOVE_DEAD_PLUGINS"]:
+            removed = remove_zombie_plugins_from_db()
 
     app.logger.debug(
         "Plugins Found: {}".format(app.pluggy.list_name_plugin())

+ 5 - 2
flaskbb/configs/default.py

@@ -190,5 +190,8 @@ class DefaultConfig(object):
     MESSAGE_URL_PREFIX = "/message"
     AUTH_URL_PREFIX = "/auth"
     ADMIN_URL_PREFIX = "/admin"
-    # Plugin Folder
-    PLUGINS_FOLDER = os.path.join(basedir, "flaskbb", "plugins")
+    # Remove dead plugins - useful if you want to migrate your instance
+    # somewhere else and forgot to reinstall the plugins.
+    # If set to `False` it will NOT remove plugins that are NOT installed on
+    # the filesystem (virtualenv, site-packages).
+    REMOVE_DEAD_PLUGINS = True