diff --git a/plugins/Sidebar/SidebarPlugin.py b/plugins/Sidebar/SidebarPlugin.py
index 9923a014..b7451427 100644
--- a/plugins/Sidebar/SidebarPlugin.py
+++ b/plugins/Sidebar/SidebarPlugin.py
@@ -284,16 +284,20 @@ class UiWebsocketPlugin(object):
""")
def sidebarRenderDbOptions(self, body, site):
- if not site.storage.db:
- return False
+ if site.storage.db:
+ inner_path = site.storage.getInnerPath(site.storage.db.db_path)
+ size = float(site.storage.getSize(inner_path)) / 1024
+ feeds = len(site.storage.db.schema.get("feeds", {}))
+ else:
+ inner_path = "No database found"
+ size = 0.0
+ feeds = 0
- inner_path = site.storage.getInnerPath(site.storage.db.db_path)
- size = float(site.storage.getSize(inner_path)) / 1024
body.append(u"""
-
+
- Reindex
+ Reload
""".format(**locals()))
@@ -557,3 +561,13 @@ class UiWebsocketPlugin(object):
self.site.settings["autodownloadoptional"] = bool(owned)
self.site.update()
self.site.worker_manager.removeGoodFileTasks()
+
+ def actionDbReload(self, to):
+ permissions = self.getPermissions(to)
+ if "ADMIN" not in permissions:
+ return self.response(to, "You don't have permission to run this command")
+
+ self.site.storage.closeDb()
+ self.site.storage.getDb()
+
+ return self.response(to, "ok")
diff --git a/plugins/Sidebar/media/Sidebar.coffee b/plugins/Sidebar/media/Sidebar.coffee
index e3b3f701..eded3043 100644
--- a/plugins/Sidebar/media/Sidebar.coffee
+++ b/plugins/Sidebar/media/Sidebar.coffee
@@ -239,6 +239,13 @@ class Sidebar extends Class
@updateHtmlTag()
return false
+ # Database reload
+ @tag.find("#button-dbreload").off("click").on "click", =>
+ wrapper.ws.cmd "dbReload", [], =>
+ wrapper.notifications.add "done-sitelimit", "done", "Database schema reloaded", 5000
+ @updateHtmlTag()
+ return false
+
# Update site
@tag.find("#button-update").off("click").on "click", =>
@tag.find("#button-update").addClass("loading")
diff --git a/plugins/Sidebar/media/all.js b/plugins/Sidebar/media/all.js
index d1d2ab06..e4013f58 100644
--- a/plugins/Sidebar/media/all.js
+++ b/plugins/Sidebar/media/all.js
@@ -318,7 +318,7 @@ window.initScrollable = function () {
};
Sidebar.prototype.setSiteInfo = function(site_info) {
- RateLimit(3000, (function(_this) {
+ RateLimit(1500, (function(_this) {
return function() {
return _this.updateHtmlTag();
};
@@ -459,6 +459,15 @@ window.initScrollable = function () {
return false;
};
})(this));
+ this.tag.find("#button-dbreload").off("click").on("click", (function(_this) {
+ return function() {
+ wrapper.ws.cmd("dbReload", [], function() {
+ wrapper.notifications.add("done-sitelimit", "done", "Database schema reloaded", 5000);
+ return _this.updateHtmlTag();
+ });
+ return false;
+ };
+ })(this));
this.tag.find("#button-update").off("click").on("click", (function(_this) {
return function() {
_this.tag.find("#button-update").addClass("loading");
diff --git a/src/Config.py b/src/Config.py
index 9121edc8..72d54ecb 100644
--- a/src/Config.py
+++ b/src/Config.py
@@ -8,7 +8,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.3.7"
- self.rev = 1231
+ self.rev = 1232
self.argv = argv
self.action = None
self.config_file = "zeronet.conf"