mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 01:02:59 -07:00
Add flush temporary sessions button in settings
This commit is contained in:
parent
4797b1a3b7
commit
de3f813b46
3 changed files with 24 additions and 4 deletions
|
@ -736,6 +736,20 @@
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">Backlink protection via anonymizer service, must end in "?".</p>
|
<p class="help-block">Backlink protection via anonymizer service, must end in "?".</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Flush Temporary Sessions</label>
|
||||||
|
<p class="help-block">
|
||||||
|
Attempt to fix hisotry logging by flushing out all of the temporary sessions in the database.<br />
|
||||||
|
Warning: This will reset all currently active sessions. For emergeny use only when history logging is stuck!
|
||||||
|
</p>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-form" type="button" id="delete_temp_sessions">Flush</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
<h3>Database Import Tool</h3>
|
<h3>Database Import Tool</h3>
|
||||||
|
@ -2273,6 +2287,12 @@ $(document).ready(function() {
|
||||||
confirmAjaxCall(url, msg);
|
confirmAjaxCall(url, msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#delete_temp_sessions").click(function () {
|
||||||
|
var msg = 'Are you sure you want to flush the temporary sessions?<br /><strong>This will reset all currently active sessions.</strong>';
|
||||||
|
var url = 'delete_temp_sessions';
|
||||||
|
confirmAjaxCall(url, msg);
|
||||||
|
});
|
||||||
|
|
||||||
$('#api_key').click(function(){ $('#api_key').select() });
|
$('#api_key').click(function(){ $('#api_key').select() });
|
||||||
$("#generate_api").click(function() {
|
$("#generate_api").click(function() {
|
||||||
$.get('generateAPI',
|
$.get('generateAPI',
|
||||||
|
|
|
@ -48,10 +48,10 @@ def delete_sessions():
|
||||||
try:
|
try:
|
||||||
monitor_db.action('DELETE FROM sessions')
|
monitor_db.action('DELETE FROM sessions')
|
||||||
monitor_db.action('VACUUM')
|
monitor_db.action('VACUUM')
|
||||||
return 'Cleared temporary sessions.'
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"PlexPy Database :: Unable to clear temporary sessions from database: %s." % e)
|
logger.warn(u"PlexPy Database :: Unable to clear temporary sessions from database: %s." % e)
|
||||||
return 'Unable to clear temporary sessions.'
|
return False
|
||||||
|
|
||||||
def db_filename(filename=FILENAME):
|
def db_filename(filename=FILENAME):
|
||||||
""" Returns the filepath to the db """
|
""" Returns the filepath to the db """
|
||||||
|
|
|
@ -334,9 +334,9 @@ class WebInterface(object):
|
||||||
result = database.delete_sessions()
|
result = database.delete_sessions()
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return {'message': result}
|
return {'result': 'success', 'message': 'Temporary sessions flushed.'}
|
||||||
else:
|
else:
|
||||||
return {'message': 'no data received'}
|
return {'result': 'error', 'message': 'Flush sessions failed.'}
|
||||||
|
|
||||||
|
|
||||||
##### Libraries #####
|
##### Libraries #####
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue