From 9ae72a95a2eae7f5483b30bea627af8f2f2f8330 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 14 Mar 2012 16:20:29 -0400
Subject: [PATCH] Wrapped activity page charts with table due to GoogleCharts update :(
---
src/com/gitblit/GitBlit.java | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index 9c1cd40..e224025 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -136,6 +136,8 @@
private MailExecutor mailExecutor;
+ private LuceneExecutor luceneExecutor;
+
private TimeZone timezone;
public GitBlit() {
@@ -182,6 +184,7 @@
}
return self().timezone;
}
+
/**
* Returns the boolean value for the specified key. If the key does not
@@ -780,7 +783,7 @@
RepositoryModel model = new RepositoryModel();
model.name = repositoryName;
model.hasCommits = JGitUtils.hasCommits(r);
- model.lastChange = JGitUtils.getLastChange(r, null);
+ model.lastChange = JGitUtils.getLastChange(r);
model.isBare = r.isBare();
StoredConfig config = JGitUtils.readConfig(r);
if (config != null) {
@@ -882,7 +885,7 @@
if (repositoryMetricsCache.hasCurrent(model.name, model.lastChange)) {
return new ArrayList<Metric>(repositoryMetricsCache.getObject(model.name));
}
- List<Metric> metrics = MetricUtils.getDateMetrics(repository, null, true, null);
+ List<Metric> metrics = MetricUtils.getDateMetrics(repository, null, true, null, getTimezone());
repositoryMetricsCache.updateObject(model.name, model.lastChange, metrics);
return new ArrayList<Metric>(metrics);
}
@@ -1695,6 +1698,15 @@
}
/**
+ * Update the Lucene index of a repository.
+ *
+ * @param repository
+ */
+ public void updateLuceneIndex(RepositoryModel repository) {
+ luceneExecutor.queue(repository);
+ }
+
+ /**
* Returns the descriptions/comments of the Gitblit config settings.
*
* @return SettingsModel
@@ -1806,9 +1818,17 @@
setUserService(loginService);
mailExecutor = new MailExecutor(settings);
if (mailExecutor.isReady()) {
+ logger.info("Mail executor is scheduled to process the message queue every 2 minutes.");
scheduledExecutor.scheduleAtFixedRate(mailExecutor, 1, 2, TimeUnit.MINUTES);
} else {
logger.warn("Mail server is not properly configured. Mail services disabled.");
+ }
+ luceneExecutor = new LuceneExecutor(settings);
+ if (luceneExecutor.isReady()) {
+ logger.info("Lucene executor is scheduled to process the repository queue every 2 minutes.");
+ scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, 2, TimeUnit.MINUTES);
+ } else {
+ logger.warn("Lucene executor is disabled.");
}
if (startFederation) {
configureFederation();
@@ -1838,14 +1858,18 @@
WebXmlSettings webxmlSettings = new WebXmlSettings(context);
// 0.7.0 web.properties in the deployed war folder
- File overrideFile = new File(context.getRealPath("/WEB-INF/web.properties"));
- if (overrideFile.exists()) {
- webxmlSettings.applyOverrides(overrideFile);
+ String webProps = context.getRealPath("/WEB-INF/web.properties");
+ if (!StringUtils.isEmpty(webProps)) {
+ File overrideFile = new File(webProps);
+ if (overrideFile.exists()) {
+ webxmlSettings.applyOverrides(overrideFile);
+ }
}
+
// 0.8.0 gitblit.properties file located outside the deployed war
// folder lie, for example, on RedHat OpenShift.
- overrideFile = getFileOrFolder("gitblit.properties");
+ File overrideFile = getFileOrFolder("gitblit.properties");
if (!overrideFile.getPath().equals("gitblit.properties")) {
webxmlSettings.applyOverrides(overrideFile);
}
@@ -1878,5 +1902,6 @@
public void contextDestroyed(ServletContextEvent contextEvent) {
logger.info("Gitblit context destroyed by servlet container.");
scheduledExecutor.shutdownNow();
+ luceneExecutor.close();
}
}
--
Gitblit v1.9.1