fix #2363 eol check
This commit is contained in:
parent
ba9dcebcca
commit
3bc848bc6f
8 changed files with 50 additions and 3 deletions
|
@ -29,6 +29,7 @@ import java.nio.file.Files;
|
|||
import java.nio.file.Path;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -36,6 +37,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -107,11 +109,19 @@ public class SystemHelper {
|
|||
|
||||
protected String productVersion;
|
||||
|
||||
protected long eolTime;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Initialize {}", this.getClass().getSimpleName());
|
||||
}
|
||||
final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||
cal.set(2021, 6 - 1, 2);
|
||||
eolTime = cal.getTimeInMillis();
|
||||
if (isEoled()) {
|
||||
logger.error("Your system is out of service. See https://fess.codelibs.org/eol.html");
|
||||
}
|
||||
updateSystemProperties();
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
filterPathEncoding = fessConfig.getPathEncoding();
|
||||
|
@ -398,10 +408,20 @@ public class SystemHelper {
|
|||
public void setupAdminHtmlData(final TypicalAction action, final ActionRuntime runtime) {
|
||||
runtime.registerData("developmentMode", ComponentUtil.getFessEsClient().isEmbedded());
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final String url = fessConfig.getOnlineHelpInstallation();
|
||||
runtime.registerData("installationLink", getHelpUrl(url));
|
||||
final String installationLink = fessConfig.getOnlineHelpInstallation();
|
||||
runtime.registerData("installationLink", getHelpUrl(installationLink));
|
||||
runtime.registerData("storageEnabled",
|
||||
StringUtil.isNotBlank(fessConfig.getStorageEndpoint()) && StringUtil.isNotBlank(fessConfig.getStorageBucket()));
|
||||
final boolean eoled = isEoled();
|
||||
runtime.registerData("eoled", eoled);
|
||||
if (eoled) {
|
||||
final String eolLink = fessConfig.getOnlineHelpEol();
|
||||
runtime.registerData("eolLink", getHelpUrl(eolLink));
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isEoled() {
|
||||
return getCurrentTimeAsLong() > eolTime;
|
||||
}
|
||||
|
||||
public String getSearchRoleByUser(final String name) {
|
||||
|
|
|
@ -2880,6 +2880,9 @@ public class FessLabels extends UserMessages {
|
|||
/** The key of the message: Running as Development mode. For production use, please install a standalone elasticsearch server. */
|
||||
public static final String LABELS_development_mode_warning = "{labels.development_mode_warning}";
|
||||
|
||||
/** The key of the message: Your system is out of service. See EOL page. */
|
||||
public static final String LABELS_eol_error = "{labels.eol_error}";
|
||||
|
||||
/** The key of the message: Advance */
|
||||
public static final String LABELS_ADVANCE = "{labels.advance}";
|
||||
|
||||
|
|
|
@ -1209,6 +1209,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
/** The key of the configuration. e.g. https://fess.codelibs.org/{lang}/{version}/install/install.html */
|
||||
String ONLINE_HELP_INSTALLATION = "online.help.installation";
|
||||
|
||||
/** The key of the configuration. e.g. https://fess.codelibs.org/{lang}/eol.html */
|
||||
String ONLINE_HELP_EOL = "online.help.eol";
|
||||
|
||||
/** The key of the configuration. e.g. failureurl */
|
||||
String ONLINE_HELP_NAME_FAILUREURL = "online.help.name.failureurl";
|
||||
|
||||
|
@ -5394,6 +5397,13 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
*/
|
||||
String getOnlineHelpInstallation();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'online.help.eol'. <br>
|
||||
* The value is, e.g. https://fess.codelibs.org/{lang}/eol.html <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getOnlineHelpEol();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'online.help.name.failureurl'. <br>
|
||||
* The value is, e.g. failureurl <br>
|
||||
|
@ -8428,6 +8438,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
return get(FessConfig.ONLINE_HELP_INSTALLATION);
|
||||
}
|
||||
|
||||
public String getOnlineHelpEol() {
|
||||
return get(FessConfig.ONLINE_HELP_EOL);
|
||||
}
|
||||
|
||||
public String getOnlineHelpNameFailureurl() {
|
||||
return get(FessConfig.ONLINE_HELP_NAME_FAILUREURL);
|
||||
}
|
||||
|
@ -9366,6 +9380,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
defaultMap.put(FessConfig.SCHEDULER_MONITOR_INTERVAL, "30");
|
||||
defaultMap.put(FessConfig.ONLINE_HELP_BASE_LINK, "https://fess.codelibs.org/{lang}/{version}/admin/");
|
||||
defaultMap.put(FessConfig.ONLINE_HELP_INSTALLATION, "https://fess.codelibs.org/{lang}/{version}/install/install.html");
|
||||
defaultMap.put(FessConfig.ONLINE_HELP_EOL, "https://fess.codelibs.org/{lang}/eol.html");
|
||||
defaultMap.put(FessConfig.ONLINE_HELP_NAME_FAILUREURL, "failureurl");
|
||||
defaultMap.put(FessConfig.ONLINE_HELP_NAME_ELEVATEWORD, "elevateword");
|
||||
defaultMap.put(FessConfig.ONLINE_HELP_NAME_REQHEADER, "reqheader");
|
||||
|
|
|
@ -675,6 +675,7 @@ scheduler.monitor.interval=30
|
|||
# ------
|
||||
online.help.base.link=https://fess.codelibs.org/{lang}/{version}/admin/
|
||||
online.help.installation=https://fess.codelibs.org/{lang}/{version}/install/install.html
|
||||
online.help.eol=https://fess.codelibs.org/{lang}/eol.html
|
||||
online.help.name.failureurl=failureurl
|
||||
online.help.name.elevateword=elevateword
|
||||
online.help.name.reqheader=reqheader
|
||||
|
|
|
@ -951,6 +951,7 @@ labels.esreq_button_upload=Send
|
|||
labels.facet_is_not_found=No match
|
||||
labels.doc_score=Score:
|
||||
labels.development_mode_warning=Running as Development mode. For production use, please install a standalone elasticsearch server.
|
||||
labels.eol_error=Your system is out of service. See EOL page.
|
||||
labels.advance=Advance
|
||||
labels.advance_search_title=Advanced Search
|
||||
labels.advance_search_must_queries=All these words
|
||||
|
|
|
@ -951,6 +951,7 @@ labels.esreq_button_upload=Send
|
|||
labels.facet_is_not_found=No match
|
||||
labels.doc_score=Score:
|
||||
labels.development_mode_warning=Running as Development mode. For production use, please install a standalone elasticsearch server.
|
||||
labels.eol_error=Your system is out of service. See EOL page.
|
||||
labels.advance=Advance
|
||||
labels.advance_search_title=Advanced Search
|
||||
labels.advance_search_must_queries=All these words
|
||||
|
|
|
@ -951,6 +951,7 @@ labels.esreq_button_upload=送信
|
|||
labels.facet_is_not_found=該当なし
|
||||
labels.doc_score=スコア:
|
||||
labels.development_mode_warning=開発モードで起動しています。本運用環境ではElasticsearchを別途インストールしてください。
|
||||
labels.eol_error=ご利用のシステムはサポートが終了しています。製品サポート期限のページを参照して、再インストールしてください。
|
||||
labels.advance=詳細検索
|
||||
labels.advance_search_title=詳細検索
|
||||
labels.advance_search_must_queries=すべての単語を含む
|
||||
|
|
|
@ -17,10 +17,15 @@
|
|||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<c:if test="${eoled}">
|
||||
<li data-toggle="tooltip" data-placement="left" title="<la:message
|
||||
key="labels.eol_error" />">
|
||||
<a href="${eolLink}" target="_olh"><em class="fas fa-times-circle" style="color:yellow;"></em></a></li>
|
||||
</c:if>
|
||||
<c:if test="${developmentMode}">
|
||||
<li data-toggle="tooltip" data-placement="left" title="<la:message
|
||||
key="labels.development_mode_warning" />">
|
||||
<a href="${installationLink}" target="_olh"><em class="fa fa-exclamation-triangle"></em></a></li>
|
||||
<a href="${installationLink}" target="_olh"><em class="fa fa-exclamation-triangle" style="color:yellow;"></em></a></li>
|
||||
</c:if>
|
||||
<li><a href="${contextPath}/"><em class="fa fa-list-alt"></em></a></li>
|
||||
<c:if test="${fe:permission('admin-scheduler')}">
|
||||
|
|
Loading…
Add table
Reference in a new issue