mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-23 01:06:17 +00:00
* Explicitly close ResultSet in DatabaseUpdate process to prevent not being able to update the Database due to it being locked. Closes #6.
* Don't create backup of non-existing database if we're creating a fresh one. * Changed the style of HTML exports slightly.
This commit is contained in:
parent
fad822d53d
commit
eb9715cb09
@ -54,8 +54,8 @@ public class DatabaseUpdates {
|
|||||||
rs = stmt.executeQuery("SELECT MAX(version) FROM database_versions");
|
rs = stmt.executeQuery("SELECT MAX(version) FROM database_versions");
|
||||||
rs.next();
|
rs.next();
|
||||||
version = rs.getInt(1);
|
version = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
logger.debug("version: {}", version);
|
logger.debug("version: {}", version);
|
||||||
System.out.println("Database version: " + version);
|
System.out.println("Database version: " + version);
|
||||||
logger.debug("Max available database version is {}", getMaxPossibleVersion());
|
logger.debug("Max available database version is {}", getMaxPossibleVersion());
|
||||||
@ -70,8 +70,12 @@ public class DatabaseUpdates {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (backup) {
|
if (backup) {
|
||||||
logger.debug("Performing backup");
|
if (version > 0) {
|
||||||
db.backupDatabase(version);
|
logger.debug("Performing backup");
|
||||||
|
db.backupDatabase(version);
|
||||||
|
} else {
|
||||||
|
logger.debug("NOT performing a backup, because we are creating a fresh database and don't need a backup of that.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Applying updates");
|
logger.debug("Applying updates");
|
||||||
|
@ -95,6 +95,7 @@ public class HTMLExporter {
|
|||||||
for (Database.Dialog d : dialogs) {
|
for (Database.Dialog d : dialogs) {
|
||||||
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(d);
|
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(d);
|
||||||
scope.clear();
|
scope.clear();
|
||||||
|
scope.put("user", user);
|
||||||
scope.put("dialog", d);
|
scope.put("dialog", d);
|
||||||
scope.put("messages", messages);
|
scope.put("messages", messages);
|
||||||
|
|
||||||
@ -112,9 +113,11 @@ public class HTMLExporter {
|
|||||||
for (Database.Chat c : chats) {
|
for (Database.Chat c : chats) {
|
||||||
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(c);
|
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(c);
|
||||||
scope.clear();
|
scope.clear();
|
||||||
|
scope.put("user", user);
|
||||||
scope.put("chat", c);
|
scope.put("chat", c);
|
||||||
scope.put("messages", messages);
|
scope.put("messages", messages);
|
||||||
|
|
||||||
|
scope.putAll(db.getMessageAuthorsWithCount(c));
|
||||||
scope.put("heatmap_data", intArrayToString(db.getMessageTimesMatrix(c)));
|
scope.put("heatmap_data", intArrayToString(db.getMessageTimesMatrix(c)));
|
||||||
scope.putAll(db.getMessageTypesWithCount(c));
|
scope.putAll(db.getMessageTypesWithCount(c));
|
||||||
scope.putAll(db.getMessageMediaTypesWithCount(c));
|
scope.putAll(db.getMessageMediaTypesWithCount(c));
|
||||||
|
@ -98,6 +98,15 @@
|
|||||||
{name: 'Others', y: {{authors.count.others}}, drilldown: 'Others'},
|
{name: 'Others', y: {{authors.count.others}}, drilldown: 'Others'},
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
plotOptions: {
|
||||||
|
pie: {
|
||||||
|
dataLabels: {
|
||||||
|
style: {
|
||||||
|
width: '150px',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
drilldown: {
|
drilldown: {
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Authors',
|
name: 'Authors',
|
||||||
@ -152,9 +161,11 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span id="heatmap" style="width: 400px; height: 500px;"></span>
|
<span id="heatmap" style="width: 500px; height: 600px;"></span>
|
||||||
|
|
||||||
{{#count.dialogs}}<span id="chart_chat_types" style="width: 400px; height: 500px;"></span>{{/count.dialogs}}
|
{{#count.dialogs}}
|
||||||
<span id="chart_message_types" style="width: 400px; height: 500px;"></span>
|
<span id="chart_chat_types" style="width: 600px; height: 500px;"></span>
|
||||||
<span id="chart_media_types" style="width: 400px; height: 500px;"></span>
|
{{/count.dialogs}}
|
||||||
<span id="chart_authors" style="width: 400px; height: 500px;"></span>
|
<span id="chart_message_types" style="width: 600px; height: 500px;"></span>
|
||||||
|
<span id="chart_media_types" style="width: 600px; height: 500px;"></span>
|
||||||
|
<span id="chart_authors" style="width: 600px; height: 500px;"></span>
|
||||||
|
Loading…
Reference in New Issue
Block a user