From 8b87994373f018fe8a7b092831ad6f6bdca1ad6e Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 19 Mar 2014 09:04:50 -0400 Subject: [PATCH] Improve isServingRepositories check --- src/main/java/com/gitblit/GitBlit.java | 5 +++++ src/main/java/com/gitblit/manager/RuntimeManager.java | 4 +++- src/main/java/com/gitblit/manager/ServicesManager.java | 6 ++++++ .../java/com/gitblit/wicket/panels/RepositoryUrlPanel.java | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java index fa681ac1..59408a68 100644 --- a/src/main/java/com/gitblit/GitBlit.java +++ b/src/main/java/com/gitblit/GitBlit.java @@ -107,6 +107,11 @@ public class GitBlit extends GitblitManager { return this; } + @Override + public boolean isServingRepositories() { + return servicesManager.isServingRepositories(); + } + protected Object [] getModules() { return new Object [] { new GitBlitModule()}; } diff --git a/src/main/java/com/gitblit/manager/RuntimeManager.java b/src/main/java/com/gitblit/manager/RuntimeManager.java index 45d1ea12..9805701b 100644 --- a/src/main/java/com/gitblit/manager/RuntimeManager.java +++ b/src/main/java/com/gitblit/manager/RuntimeManager.java @@ -116,7 +116,9 @@ public class RuntimeManager implements IRuntimeManager { */ @Override public boolean isServingRepositories() { - return settings.getBoolean(Keys.git.enableGitServlet, true) || (settings.getInteger(Keys.git.daemonPort, 0) > 0); + return settings.getBoolean(Keys.git.enableGitServlet, true) + || (settings.getInteger(Keys.git.daemonPort, 0) > 0) + || (settings.getInteger(Keys.git.sshPort, 0) > 0); } /** diff --git a/src/main/java/com/gitblit/manager/ServicesManager.java b/src/main/java/com/gitblit/manager/ServicesManager.java index 93121cfb..e0fc8bbd 100644 --- a/src/main/java/com/gitblit/manager/ServicesManager.java +++ b/src/main/java/com/gitblit/manager/ServicesManager.java @@ -102,6 +102,12 @@ public class ServicesManager implements IManager { return this; } + public boolean isServingRepositories() { + return settings.getBoolean(Keys.git.enableGitServlet, true) + || (gitDaemon != null && gitDaemon.isRunning()) + || (sshDaemon != null && sshDaemon.isRunning()); + } + protected void configureFederation() { boolean validPassphrase = true; String passphrase = settings.getString(Keys.federation.passphrase, ""); diff --git a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java index bcd84b66..0f31b31e 100644 --- a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java @@ -165,7 +165,7 @@ public class RepositoryUrlPanel extends BasePanel { if (repository.isMirror) { urlPanel.add(WicketUtils.newImage("accessRestrictionIcon", "mirror_16x16.png", getString("gb.isMirror"))); - } else if (app().runtime().isServingRepositories()) { + } else if (app().gitblit().isServingRepositories()) { switch (repository.accessRestriction) { case NONE: urlPanel.add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false)); -- 2.39.5