mirror of https://github.com/halo-dev/halo
Clear cache when theme uploaded.
parent
001d9f8885
commit
fae4b9a4ef
|
@ -223,11 +223,11 @@ public class ThemeServiceImpl implements ThemeService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Delete the folder
|
// Delete the folder
|
||||||
Files.deleteIfExists(Paths.get(themeProperty.getThemePath()));
|
FileUtil.del(Paths.get(themeProperty.getThemePath()));
|
||||||
|
|
||||||
// Delete theme cache
|
// Delete theme cache
|
||||||
cacheStore.delete(THEMES_CACHE_KEY);
|
cacheStore.delete(THEMES_CACHE_KEY);
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException("Failed to delete theme folder", e).setErrorData(themeId);
|
throw new ServiceException("Failed to delete theme folder", e).setErrorData(themeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,6 +351,8 @@ public class ThemeServiceImpl implements ThemeService {
|
||||||
// Delete theme package
|
// Delete theme package
|
||||||
FileUtil.del(uploadPath.toFile());
|
FileUtil.del(uploadPath.toFile());
|
||||||
|
|
||||||
|
cacheStore.delete(THEMES_CACHE_KEY);
|
||||||
|
|
||||||
return getProperty(Paths.get(workDir.toString(), originalBasename));
|
return getProperty(Paths.get(workDir.toString(), originalBasename));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Failed to upload theme to local: " + uploadPath, e);
|
log.error("Failed to upload theme to local: " + uploadPath, e);
|
||||||
|
|
Loading…
Reference in New Issue