Clear cache when theme uploaded.

pull/146/head
ruibaby 2019-04-16 20:15:43 +08:00
parent 001d9f8885
commit fae4b9a4ef
1 changed files with 4 additions and 2 deletions

View File

@ -223,11 +223,11 @@ public class ThemeServiceImpl implements ThemeService {
try {
// Delete the folder
Files.deleteIfExists(Paths.get(themeProperty.getThemePath()));
FileUtil.del(Paths.get(themeProperty.getThemePath()));
// Delete theme cache
cacheStore.delete(THEMES_CACHE_KEY);
} catch (IOException e) {
} catch (Exception e) {
throw new ServiceException("Failed to delete theme folder", e).setErrorData(themeId);
}
}
@ -351,6 +351,8 @@ public class ThemeServiceImpl implements ThemeService {
// Delete theme package
FileUtil.del(uploadPath.toFile());
cacheStore.delete(THEMES_CACHE_KEY);
return getProperty(Paths.get(workDir.toString(), originalBasename));
} catch (IOException e) {
log.error("Failed to upload theme to local: " + uploadPath, e);