Commit b8b78db1 authored by Liang Ding's avatar Liang Ding

🎨 #12724

parent 5b41a272
...@@ -39,7 +39,6 @@ import org.b3log.solo.event.B3ArticleUpdater; ...@@ -39,7 +39,6 @@ import org.b3log.solo.event.B3ArticleUpdater;
import org.b3log.solo.event.B3CommentSender; import org.b3log.solo.event.B3CommentSender;
import org.b3log.solo.event.PluginRefresher; import org.b3log.solo.event.PluginRefresher;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Skin;
import org.b3log.solo.processor.InitCheckHandler; import org.b3log.solo.processor.InitCheckHandler;
import org.b3log.solo.processor.PermalinkHandler; import org.b3log.solo.processor.PermalinkHandler;
import org.b3log.solo.processor.console.*; import org.b3log.solo.processor.console.*;
...@@ -189,10 +188,9 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -189,10 +188,9 @@ public final class SoloServletListener extends AbstractServletListener {
} }
/** /**
* Loads preference. * Loads skin.
* <p> * <p>
* Loads preference from repository, loads skins from skin directory then sets it into preference if the skins * Loads skin from repository, loads skins from skin directory then sets it into preference if the skins changed.
* changed.
* </p> * </p>
*/ */
private void loadPreference() { private void loadPreference() {
...@@ -201,15 +199,15 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -201,15 +199,15 @@ public final class SoloServletListener extends AbstractServletListener {
LOGGER.debug("Loading preference...."); LOGGER.debug("Loading preference....");
final OptionQueryService optionQueryService = beanManager.getReference(OptionQueryService.class); final OptionQueryService optionQueryService = beanManager.getReference(OptionQueryService.class);
JSONObject preference; JSONObject skin;
try { try {
preference = optionQueryService.getPreference(); skin = optionQueryService.getSkin();
if (null == preference) { if (null == skin) {
return; return;
} }
final PreferenceMgmtService preferenceMgmtService = beanManager.getReference(PreferenceMgmtService.class); final SkinMgmtService skinMgmtService = beanManager.getReference(SkinMgmtService.class);
preferenceMgmtService.loadSkins(preference); skinMgmtService.loadSkins(skin);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
...@@ -257,17 +255,16 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -257,17 +255,16 @@ public final class SoloServletListener extends AbstractServletListener {
String skin = Skins.getSkinDirNameFromCookie(httpServletRequest); String skin = Skins.getSkinDirNameFromCookie(httpServletRequest);
if (StringUtils.isBlank(skin)) { if (StringUtils.isBlank(skin)) {
final OptionQueryService optionQueryService = beanManager.getReference(OptionQueryService.class); final OptionQueryService optionQueryService = beanManager.getReference(OptionQueryService.class);
final JSONObject preference = optionQueryService.getPreference(); final JSONObject skinOpt = optionQueryService.getSkin();
if (Solos.isMobile(httpServletRequest)) { if (Solos.isMobile(httpServletRequest)) {
if (null != preference) { if (null != skinOpt) {
skin = preference.optString(Option.ID_C_MOBILE_SKIN_DIR_NAME); skin = skinOpt.optString(Option.ID_C_MOBILE_SKIN_DIR_NAME);
} else { } else {
skin = Option.DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME; skin = Option.DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME;
} }
} else { } else {
if (null != preference) { if (null != skinOpt) {
skin = preference.optString(Option.ID_C_SKIN_DIR_NAME); skin = skinOpt.optString(Option.ID_C_SKIN_DIR_NAME);
} else { } else {
skin = Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME; skin = Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME;
} }
...@@ -397,6 +394,10 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -397,6 +394,10 @@ public final class SoloServletListener extends AbstractServletListener {
DispatcherServlet.get("/console/preference/", preferenceConsole::getPreference); DispatcherServlet.get("/console/preference/", preferenceConsole::getPreference);
DispatcherServlet.put("/console/preference/", preferenceConsole::updatePreference); DispatcherServlet.put("/console/preference/", preferenceConsole::updatePreference);
final SkinConsole skinConsole = beanManager.getReference(SkinConsole.class);
DispatcherServlet.get("/console/skin", skinConsole::getSkin);
DispatcherServlet.put("/console/skin", skinConsole::updateSkin);
final RepairConsole repairConsole = beanManager.getReference(RepairConsole.class); final RepairConsole repairConsole = beanManager.getReference(RepairConsole.class);
DispatcherServlet.get("/fix/restore-signs", repairConsole::restoreSigns); DispatcherServlet.get("/fix/restore-signs", repairConsole::restoreSigns);
......
...@@ -273,6 +273,11 @@ public final class Option { ...@@ -273,6 +273,11 @@ public final class Option {
*/ */
public static final String CATEGORY_C_HACPAI = "hacpai"; public static final String CATEGORY_C_HACPAI = "hacpai";
/**
* Category - Skin.
*/
public static final String CATEGORY_C_SKIN = "skin";
//// Transient //// //// Transient ////
/** /**
* Key of statistic blog published article count. * Key of statistic blog published article count.
......
...@@ -117,9 +117,10 @@ public class IndexProcessor { ...@@ -117,9 +117,10 @@ public class IndexProcessor {
// 前台皮肤切换 https://github.com/b3log/solo/issues/12060 // 前台皮肤切换 https://github.com/b3log/solo/issues/12060
String specifiedSkin = Skins.getSkinDirName(context); String specifiedSkin = Skins.getSkinDirName(context);
if (StringUtils.isBlank(specifiedSkin)) { if (StringUtils.isBlank(specifiedSkin)) {
final JSONObject skinOpt = optionQueryService.getSkin();
specifiedSkin = Solos.isMobile(request) ? specifiedSkin = Solos.isMobile(request) ?
preference.optString(Option.ID_C_MOBILE_SKIN_DIR_NAME) : skinOpt.optString(Option.ID_C_MOBILE_SKIN_DIR_NAME) :
preference.optString(Option.ID_C_SKIN_DIR_NAME); skinOpt.optString(Option.ID_C_SKIN_DIR_NAME);
} }
request.setAttribute(Keys.TEMAPLTE_DIR_NAME, specifiedSkin); request.setAttribute(Keys.TEMAPLTE_DIR_NAME, specifiedSkin);
......
...@@ -210,7 +210,6 @@ public class PreferenceConsole { ...@@ -210,7 +210,6 @@ public class PreferenceConsole {
/** /**
* Updates the preference by the specified request. * Updates the preference by the specified request.
* <p> * <p>
* <p>
* Request json: * Request json:
* <pre> * <pre>
* { * {
......
...@@ -226,7 +226,7 @@ public class InitService { ...@@ -226,7 +226,7 @@ public class InitService {
final Transaction transaction = userRepository.beginTransaction(); final Transaction transaction = userRepository.beginTransaction();
try { try {
initStatistic(); initStatistic();
initPreference(requestJSONObject); initOptions(requestJSONObject);
initAdmin(requestJSONObject); initAdmin(requestJSONObject);
initLink(); initLink();
helloWorld(); helloWorld();
...@@ -466,12 +466,12 @@ public class InitService { ...@@ -466,12 +466,12 @@ public class InitService {
} }
/** /**
* Initializes preference. * Initializes options.
* *
* @param requestJSONObject the specified json object * @param requestJSONObject the specified json object
* @throws Exception exception * @throws Exception exception
*/ */
private void initPreference(final JSONObject requestJSONObject) throws Exception { private void initOptions(final JSONObject requestJSONObject) throws Exception {
LOGGER.debug("Initializing preference...."); LOGGER.debug("Initializing preference....");
final JSONObject hljsThemeOpt = new JSONObject(); final JSONObject hljsThemeOpt = new JSONObject();
...@@ -662,13 +662,13 @@ public class InitService { ...@@ -662,13 +662,13 @@ public class InitService {
final JSONObject skinDirNameOpt = new JSONObject(); final JSONObject skinDirNameOpt = new JSONObject();
skinDirNameOpt.put(Keys.OBJECT_ID, Option.ID_C_SKIN_DIR_NAME); skinDirNameOpt.put(Keys.OBJECT_ID, Option.ID_C_SKIN_DIR_NAME);
skinDirNameOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE); skinDirNameOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_SKIN);
skinDirNameOpt.put(Option.OPTION_VALUE, DefaultPreference.DEFAULT_SKIN_DIR_NAME); skinDirNameOpt.put(Option.OPTION_VALUE, DefaultPreference.DEFAULT_SKIN_DIR_NAME);
optionRepository.add(skinDirNameOpt); optionRepository.add(skinDirNameOpt);
final JSONObject mobileSkinDirNameOpt = new JSONObject(); final JSONObject mobileSkinDirNameOpt = new JSONObject();
mobileSkinDirNameOpt.put(Keys.OBJECT_ID, Option.ID_C_MOBILE_SKIN_DIR_NAME); mobileSkinDirNameOpt.put(Keys.OBJECT_ID, Option.ID_C_MOBILE_SKIN_DIR_NAME);
mobileSkinDirNameOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE); mobileSkinDirNameOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_SKIN);
mobileSkinDirNameOpt.put(Option.OPTION_VALUE, DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME); mobileSkinDirNameOpt.put(Option.OPTION_VALUE, DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME);
optionRepository.add(mobileSkinDirNameOpt); optionRepository.add(mobileSkinDirNameOpt);
...@@ -679,10 +679,9 @@ public class InitService { ...@@ -679,10 +679,9 @@ public class InitService {
skinArray.put(skin); skinArray.put(skin);
skin.put(Skin.SKIN_DIR_NAME, dirName); skin.put(Skin.SKIN_DIR_NAME, dirName);
} }
final JSONObject skinsOpt = new JSONObject(); final JSONObject skinsOpt = new JSONObject();
skinsOpt.put(Keys.OBJECT_ID, Option.ID_C_SKINS); skinsOpt.put(Keys.OBJECT_ID, Option.ID_C_SKINS);
skinsOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE); skinsOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_SKIN);
skinsOpt.put(Option.OPTION_VALUE, skinArray.toString()); skinsOpt.put(Option.OPTION_VALUE, skinArray.toString());
optionRepository.add(skinsOpt); optionRepository.add(skinsOpt);
......
...@@ -47,6 +47,21 @@ public class OptionQueryService { ...@@ -47,6 +47,21 @@ public class OptionQueryService {
@Inject @Inject
private OptionRepository optionRepository; private OptionRepository optionRepository;
/**
* Gets the skin.
*
* @return skin, returns {@code null} if not found
*/
public JSONObject getSkin() {
try {
return getOptions(Option.CATEGORY_C_SKIN);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Gets skin failed", e);
return null;
}
}
/** /**
* Gets the user preference. * Gets the user preference.
* *
......
...@@ -27,7 +27,6 @@ import org.b3log.latke.service.LangPropsService; ...@@ -27,7 +27,6 @@ import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException; import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service; import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Locales; import org.b3log.latke.util.Locales;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Skin; import org.b3log.solo.model.Skin;
import org.b3log.solo.repository.OptionRepository; import org.b3log.solo.repository.OptionRepository;
...@@ -39,14 +38,11 @@ import java.util.Iterator; ...@@ -39,14 +38,11 @@ import java.util.Iterator;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import static org.b3log.solo.model.Skin.*;
import static org.b3log.solo.util.Skins.getSkinDirNames;
/** /**
* Preference management service. * Preference management service.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.2.18, Feb 6, 2019 * @version 1.4.0.0, Mar 29, 2019
* @since 0.4.0 * @since 0.4.0
*/ */
@Service @Service
...@@ -75,64 +71,6 @@ public class PreferenceMgmtService { ...@@ -75,64 +71,6 @@ public class PreferenceMgmtService {
@Inject @Inject
private LangPropsService langPropsService; private LangPropsService langPropsService;
/**
* Loads skins for the specified preference and initializes templates loading.
* <p>
* If the skins directory has been changed, persists the change into preference.
* </p>
*
* @param preference the specified preference
* @throws Exception exception
*/
public void loadSkins(final JSONObject preference) throws Exception {
Stopwatchs.start("Load Skins");
LOGGER.debug("Loading skins....");
final Set<String> skinDirNames = getSkinDirNames();
LOGGER.log(Level.DEBUG, "Loaded skins[dirNames={0}]", skinDirNames);
final JSONArray skinArray = new JSONArray();
for (final String dirName : skinDirNames) {
final JSONObject skin = new JSONObject();
final String name = Latkes.getSkinName(dirName);
if (null == name) {
LOGGER.log(Level.WARN, "The directory [{0}] does not contain any skin, ignored it", dirName);
continue;
}
skin.put(SKIN_DIR_NAME, dirName);
skinArray.put(skin);
}
final String currentSkinDirName = preference.optString(SKIN_DIR_NAME);
if (!skinDirNames.contains(currentSkinDirName)) {
LOGGER.log(Level.WARN, "Configured skin [dirName={0}] can not find, try to use " + "default skin [dirName="
+ Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME + "] instead.", currentSkinDirName);
if (!skinDirNames.contains(Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME)) {
LOGGER.log(Level.ERROR, "Can not find default skin [dirName=" + Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME
+ "], please redeploy your Solo and make sure contains the default skin. If you are using git, try to re-pull with 'git pull --recurse-submodules'");
System.exit(-1);
}
preference.put(SKIN_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
updatePreference(preference);
}
final String skinsString = skinArray.toString();
if (!skinsString.equals(preference.getString(SKINS))) {
LOGGER.debug("The skins directory has been changed, persists the change into preference");
preference.put(SKINS, skinsString);
updatePreference(preference);
}
LOGGER.debug("Loaded skins....");
Stopwatchs.end();
}
/** /**
* Updates the preference with the specified preference. * Updates the preference with the specified preference.
* *
...@@ -143,9 +81,8 @@ public class PreferenceMgmtService { ...@@ -143,9 +81,8 @@ public class PreferenceMgmtService {
final Iterator<String> keys = preference.keys(); final Iterator<String> keys = preference.keys();
while (keys.hasNext()) { while (keys.hasNext()) {
final String key = keys.next(); final String key = keys.next();
if (preference.isNull(key)) { if (preference.isNull(key)) {
throw new ServiceException("A value is null of preference[key=" + key + "]"); throw new ServiceException("A value is null of preference [key=" + key + "]");
} }
} }
...@@ -271,23 +208,6 @@ public class PreferenceMgmtService { ...@@ -271,23 +208,6 @@ public class PreferenceMgmtService {
signsOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_SIGNS)); signsOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_SIGNS));
optionRepository.update(Option.ID_C_SIGNS, signsOpt); optionRepository.update(Option.ID_C_SIGNS, signsOpt);
final JSONObject skinDirNameOpt = optionRepository.get(Option.ID_C_SKIN_DIR_NAME);
skinDirNameOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_SKIN_DIR_NAME));
optionRepository.update(Option.ID_C_SKIN_DIR_NAME, skinDirNameOpt);
JSONObject mobileSkinDirNameOpt = optionRepository.get(Option.ID_C_MOBILE_SKIN_DIR_NAME);
// TODO: 在 v3.5.0 发布后可移除判空
if (null == mobileSkinDirNameOpt) {
mobileSkinDirNameOpt = new JSONObject();
mobileSkinDirNameOpt.put(Keys.OBJECT_ID, Option.ID_C_MOBILE_SKIN_DIR_NAME);
mobileSkinDirNameOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
mobileSkinDirNameOpt.put(Option.OPTION_VALUE, Option.DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME);
optionRepository.add(mobileSkinDirNameOpt);
} else {
mobileSkinDirNameOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_MOBILE_SKIN_DIR_NAME));
optionRepository.update(Option.ID_C_MOBILE_SKIN_DIR_NAME, mobileSkinDirNameOpt);
}
final JSONObject skinsOpt = optionRepository.get(Option.ID_C_SKINS); final JSONObject skinsOpt = optionRepository.get(Option.ID_C_SKINS);
skinsOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_SKINS)); skinsOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_SKINS));
optionRepository.update(Option.ID_C_SKINS, skinsOpt); optionRepository.update(Option.ID_C_SKINS, skinsOpt);
......
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2019, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.b3log.solo.service;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.Set;
import static org.b3log.solo.model.Skin.SKINS;
import static org.b3log.solo.model.Skin.SKIN_DIR_NAME;
import static org.b3log.solo.util.Skins.getSkinDirNames;
/**
* Skin management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Mar 29, 2019
* @since 3.5.0
*/
@Service
public class SkinMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(SkinMgmtService.class);
/**
* Option query service.
*/
@Inject
private OptionQueryService optionQueryService;
/**
* Option repository.
*/
@Inject
private OptionRepository optionRepository;
/**
* Language service.
*/
@Inject
private LangPropsService langPropsService;
/**
* Loads skins.
*
* @param skin the specified skin
* @throws Exception exception
*/
public void loadSkins(final JSONObject skin) throws Exception {
Stopwatchs.start("Load Skins");
LOGGER.debug("Loading skins....");
final Set<String> skinDirNames = getSkinDirNames();
LOGGER.log(Level.DEBUG, "Loaded skins [dirNames={0}]", skinDirNames);
final JSONArray skinArray = new JSONArray();
for (final String dirName : skinDirNames) {
final JSONObject s = new JSONObject();
final String name = Latkes.getSkinName(dirName);
if (null == name) {
LOGGER.log(Level.WARN, "The directory [{0}] does not contain any skin, ignored it", dirName);
continue;
}
s.put(SKIN_DIR_NAME, dirName);
skinArray.put(s);
}
final String currentSkinDirName = skin.optString(SKIN_DIR_NAME);
if (!skinDirNames.contains(currentSkinDirName)) {
LOGGER.log(Level.WARN, "Configured skin [dirName={0}] can not find, try to use " + "default skin [dirName="
+ Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME + "] instead.", currentSkinDirName);
if (!skinDirNames.contains(Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME)) {
LOGGER.log(Level.ERROR, "Can not find default skin [dirName=" + Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME
+ "], please redeploy your Solo and make sure contains the default skin. If you are using git, try to re-pull with 'git pull --recurse-submodules'");
System.exit(-1);
}
skin.put(SKIN_DIR_NAME, Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
updateSkin(skin);
}
final String skinsString = skinArray.toString();
if (!skinsString.equals(skin.getString(SKINS))) {
LOGGER.debug("The skins directory has been changed, persists it into database");
skin.put(SKINS, skinsString);
updateSkin(skin);
}
LOGGER.debug("Loaded skins....");
Stopwatchs.end();
}
/**
* Updates the skin with the specified skin.
*
* @param skin the specified skin
* @throws ServiceException service exception
*/
public void updateSkin(final JSONObject skin) throws ServiceException {
final Transaction transaction = optionRepository.beginTransaction();
try {
final JSONObject skinDirNameOpt = optionRepository.get(Option.ID_C_SKIN_DIR_NAME);
skinDirNameOpt.put(Option.OPTION_VALUE, skin.optString(Option.ID_C_SKIN_DIR_NAME));
optionRepository.update(Option.ID_C_SKIN_DIR_NAME, skinDirNameOpt);
JSONObject mobileSkinDirNameOpt = optionRepository.get(Option.ID_C_MOBILE_SKIN_DIR_NAME);
// TODO: 在 v3.5.0 发布后可移除判空
if (null == mobileSkinDirNameOpt) {
mobileSkinDirNameOpt = new JSONObject();
mobileSkinDirNameOpt.put(Keys.OBJECT_ID, Option.ID_C_MOBILE_SKIN_DIR_NAME);
mobileSkinDirNameOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_SKIN);
mobileSkinDirNameOpt.put(Option.OPTION_VALUE, Option.DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME);
optionRepository.add(mobileSkinDirNameOpt);
} else {
mobileSkinDirNameOpt.put(Option.OPTION_VALUE, skin.optString(Option.ID_C_MOBILE_SKIN_DIR_NAME));
optionRepository.update(Option.ID_C_MOBILE_SKIN_DIR_NAME, mobileSkinDirNameOpt);
}
transaction.commit();
} catch (final Exception e) {
if (transaction.isActive()) {
transaction.rollback();
}
LOGGER.log(Level.ERROR, "Updates skin failed", e);
throw new ServiceException(langPropsService.get("updateFailLabel"));
}
}
}
...@@ -58,6 +58,12 @@ public final class V340_350 { ...@@ -58,6 +58,12 @@ public final class V340_350 {
final Transaction transaction = optionRepository.beginTransaction(); final Transaction transaction = optionRepository.beginTransaction();
optionRepository.remove("skinName"); optionRepository.remove("skinName");
final JSONObject skinOpt = optionRepository.get(Option.ID_C_SKIN_DIR_NAME);
skinOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_SKIN);
optionRepository.update(Option.ID_C_SKIN_DIR_NAME, skinOpt);
final JSONObject mobileSkinOpt = optionRepository.get(Option.ID_C_MOBILE_SKIN_DIR_NAME);
mobileSkinOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_SKIN);
optionRepository.update(Option.ID_C_SKIN_DIR_NAME, mobileSkinOpt);
JSONObject hljsThemeOpt = optionRepository.get(Option.ID_C_HLJS_THEME); JSONObject hljsThemeOpt = optionRepository.get(Option.ID_C_HLJS_THEME);
if (null == hljsThemeOpt) { if (null == hljsThemeOpt) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment