Internal help: Only show db filesystem size for legacy profile

master
François-Xavier Thomas 5 years ago committed by jvoisin
parent 50b6da075e
commit 09fa486bb0
  1. 8
      airsonic-main/src/main/java/org/airsonic/player/controller/InternalHelpController.java
  2. 5
      airsonic-main/src/main/webapp/WEB-INF/jsp/internalhelp.jsp

@ -38,6 +38,7 @@ import org.apache.lucene.index.IndexReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -197,6 +198,8 @@ public class InternalHelpController {
private MediaFileDao mediaFileDao;
@Autowired
private TranscodingService transcodingService;
@Autowired
private Environment environment;
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
@ -319,12 +322,17 @@ public class InternalHelpController {
LOG.debug("Unable to gather information", e);
}
if (environment.acceptsProfiles("legacy")) {
map.put("dbIsLegacy", true);
File dbDirectory = new File(settingsService.getAirsonicHome(), "db");
map.put("dbDirectorySizeBytes", dbDirectory.exists() ? FileUtils.sizeOfDirectory(dbDirectory) : 0);
map.put("dbDirectorySize", FileUtils.byteCountToDisplaySize((long) map.get("dbDirectorySizeBytes")));
File dbLogFile = new File(dbDirectory, "airsonic.log");
map.put("dbLogSizeBytes", dbLogFile.exists() ? dbLogFile.length() : 0);
map.put("dbLogSize", FileUtils.byteCountToDisplaySize((long) map.get("dbLogSizeBytes")));
} else {
map.put("dbIsLegacy", false);
}
map.put("dbMediaFileMusicNonPresentCount", daoHelper.getJdbcTemplate().queryForObject(String.format("SELECT count(*) FROM MEDIA_FILE WHERE NOT present AND type = 'MUSIC'"), Long.class));
map.put("dbMediaFilePodcastNonPresentCount", daoHelper.getJdbcTemplate().queryForObject(String.format("SELECT count(*) FROM MEDIA_FILE WHERE NOT present AND type = 'PODCAST'"), Long.class));

@ -82,6 +82,7 @@
<table width="75%" class="ruleTable indent">
<c:if test="${model.dbIsLegacy}">
<tr>
<td colspan="2" class="ruleTableCell">
<c:choose>
@ -96,11 +97,15 @@
</c:choose>
</td>
</tr>
</c:if>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.dbdrivername"/></td><td class="ruleTableCell">${model.dbDriverName}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.dbdriverversion"/></td><td class="ruleTableCell">${model.dbDriverVersion}</td></tr>
<c:if test="${model.dbIsLegacy}">
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.dbdirectorysize"/></td><td class="ruleTableCell">${model.dbDirectorySize}</td></tr>
<tr><td class="ruleTableHeader"><fmt:message key="internalhelp.dblogsize"/></td><td class="ruleTableCell">${model.dbLogSize}</td></tr>
</c:if>
<tr>
<td colspan="2" class="ruleTableCell">

Loading…
Cancel
Save