Rev1232, Db schema reload sidebar button
This commit is contained in:
parent
e481a12647
commit
5f55d8a034
4 changed files with 38 additions and 8 deletions
|
@ -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"""
|
||||
<li>
|
||||
<label>Database <small>({size:.2f}kB)</small></label>
|
||||
<label>Database <small>({size:.2f}kB, search feeds: {feeds} query)</small></label>
|
||||
<input type='text' class='text disabled' value="{inner_path}" disabled='disabled'/>
|
||||
<a href='#Reindex' class='button' style='display: none'>Reindex</a>
|
||||
<a href='#Reload' id="button-dbreload" class='button'>Reload</a>
|
||||
</li>
|
||||
""".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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue