Commit bc416c8b authored by Liang Ding's avatar Liang Ding

BAE 下禁用页面缓存。

parent 4936c648
......@@ -18,6 +18,8 @@ package org.b3log.solo.model;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.RuntimeEnv;
import org.json.JSONArray;
import org.json.JSONObject;
......@@ -25,7 +27,7 @@ import org.json.JSONObject;
* This class defines all comment model relevant keys.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.1.0.6, May 4, 2012
* @version 1.1.0.7, Sep 10, 2012
* @since 0.3.1
*/
public final class Preference {
......@@ -296,7 +298,7 @@ public final class Preference {
/**
* Default page cache enabled.
*/
public static final boolean DEFAULT_PAGE_CACHE_ENABLED = true;
public static final boolean DEFAULT_PAGE_CACHE_ENABLED;
/**
* Default allow visit draft via permalink.
*/
......@@ -356,6 +358,12 @@ public final class Preference {
+ "${postTitle}</a>] received an reply: <p>${replier}"
+ ": <span><a href='${replyURL}'>${replyContent}</a></span></p>");
DEFAULT_REPLY_NOTIFICATION_TEMPLATE = replyNotificationTemplate.toString();
if (RuntimeEnv.BAE == Latkes.getRuntimeEnv()) {
DEFAULT_PAGE_CACHE_ENABLED = false; // https://github.com/b3log/b3log-solo/issues/73
} else {
DEFAULT_PAGE_CACHE_ENABLED = true;
}
} catch (final Exception e) {
LOGGER.log(Level.SEVERE, "Creates sign error!", e);
throw new IllegalStateException(e);
......
......@@ -28,6 +28,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Latkes;
import org.b3log.latke.RuntimeEnv;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.ServiceException;
......@@ -142,7 +143,7 @@ public final class PreferenceMgmtService {
final String skinPath = webRootPath + Skin.SKINS + "/" + skinDirName;
LOGGER.log(Level.FINER, "Skin path[{0}]", skinPath);
Templates.CACHE.clear();
preference.put(Skin.SKINS, skinArray.toString());
final String timeZoneId = preference.getString(TIME_ZONE_ID);
......@@ -156,8 +157,14 @@ public final class PreferenceMgmtService {
if (!preference.has(PAGE_CACHE_ENABLED)) {
preference.put(PAGE_CACHE_ENABLED, oldPreference.getBoolean(PAGE_CACHE_ENABLED));
} else {
if (RuntimeEnv.BAE == Latkes.getRuntimeEnv()) {
// XXX: Ignores user's setting, uses default
// https://github.com/b3log/b3log-solo/issues/73
preference.put(PAGE_CACHE_ENABLED, Default.DEFAULT_PAGE_CACHE_ENABLED);
}
}
final boolean pageCacheEnabled = preference.getBoolean(Preference.PAGE_CACHE_ENABLED);
Templates.enableCache(pageCacheEnabled);
......
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