Skip to content

Commit b9a7461

Browse files
author
Vladimir Kotal
authored
send Message before indexing with "set projectsEnabled = true" if running with -P (#1682)
fixes #1678
1 parent 8fee442 commit b9a7461

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/org/opensolaris/opengrok/index/Indexer.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.opensolaris.opengrok.configuration.Configuration;
4949
import org.opensolaris.opengrok.configuration.Project;
5050
import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
51+
import org.opensolaris.opengrok.configuration.messages.Message;
5152
import org.opensolaris.opengrok.history.HistoryException;
5253
import org.opensolaris.opengrok.history.HistoryGuru;
5354
import org.opensolaris.opengrok.history.Repository;
@@ -582,6 +583,18 @@ public static void main(String argv[]) {
582583
System.exit(1);
583584
}
584585

586+
// If the webapp is running with a config that does not contain
587+
// 'projectsEnabled' property (case of upgrade or transition
588+
// from project-less config to one with projects), set the property
589+
// using a message so that the 'project/indexed' messages
590+
// emitted during indexing do not cause validation error.
591+
if (addProjects && host != null && port > 0) {
592+
Message m = Message.createMessage("config");
593+
m.addTag("set");
594+
m.setText("projectsEnabled = true");
595+
m.write(host, port);
596+
}
597+
585598
// Get history first.
586599
getInstance().prepareIndexer(env, searchRepositories, addProjects,
587600
defaultProjects,

0 commit comments

Comments
 (0)